generated from RuiFPB/tyra-linux-template
Rendering minecraft Blocks using the MinecraftPipeline
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
|
||||
namespace Test {
|
||||
|
||||
class Block {
|
||||
public:
|
||||
Block();
|
||||
Block(const Block& v);
|
||||
~Block();
|
||||
|
||||
void updateModelMatrix();
|
||||
|
||||
Tyra::M4x4 translation, rotation, scale;
|
||||
|
||||
// Result matrix after transformations
|
||||
Tyra::M4x4 modelMatrix;
|
||||
|
||||
Tyra::Color color;
|
||||
|
||||
Tyra::Vec4 atlasOffset;
|
||||
|
||||
Tyra::McpipBlock renderData;
|
||||
|
||||
private:
|
||||
void setRenderData();
|
||||
};
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
|
||||
namespace Racer {
|
||||
|
||||
class RacerGame : public Tyra::Game {
|
||||
public:
|
||||
RacerGame(Tyra::Engine* engine);
|
||||
~RacerGame();
|
||||
|
||||
void init();
|
||||
void loop();
|
||||
|
||||
private:
|
||||
Tyra::Engine* engine;
|
||||
void loadTexture();
|
||||
void loadSprite();
|
||||
|
||||
Tyra::Sprite sprite;
|
||||
};
|
||||
|
||||
} // namespace Racer
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
#include "block.hpp"
|
||||
|
||||
namespace Test {
|
||||
|
||||
class RenderTest : public Tyra::Game {
|
||||
public:
|
||||
RenderTest(Tyra::Engine* engine);
|
||||
~RenderTest();
|
||||
|
||||
void init();
|
||||
void loop();
|
||||
|
||||
private:
|
||||
Tyra::Engine* engine;
|
||||
Tyra::Texture* textureAtlas;
|
||||
|
||||
Tyra::MinecraftPipeline mcpip;
|
||||
Tyra::Vec4 cameraPosition, cameraLookAt;
|
||||
|
||||
void loadTexture();
|
||||
Block getBlock(const u8& atlasX, const u8& atlasY, const float& translationX);
|
||||
void rotateBlock(Block& block);
|
||||
std::vector<Block> blocks;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace Test
|
||||
Reference in New Issue
Block a user