Rendering minecraft Blocks using the MinecraftPipeline

This commit is contained in:
2026-06-18 13:01:54 +01:00
parent c3070ed046
commit 54063cfd9c
9 changed files with 188 additions and 85 deletions
+29
View File
@@ -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();
};
}
-23
View File
@@ -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
+32
View File
@@ -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