finished tutorial 03
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
#include <vector>
|
||||
#include "./tutorial_block.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class Tutorial03 : public Game {
|
||||
public:
|
||||
Tutorial03(Engine* engine);
|
||||
~Tutorial03();
|
||||
|
||||
void init();
|
||||
void loop();
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
|
||||
TutorialBlock getBlock(const u8& atlasX, const u8& atlasY,
|
||||
const float& translationX);
|
||||
void rotateBlock(TutorialBlock& block);
|
||||
|
||||
Engine* engine;
|
||||
|
||||
std::vector<TutorialBlock> blocks;
|
||||
|
||||
Texture* textureAtlas;
|
||||
|
||||
/**
|
||||
* This is a 3D pipeline (renderer) which we will be using.
|
||||
*
|
||||
* Tyra has 3 pipelines:
|
||||
* - Minecraft (this one)
|
||||
* - Static (for static 3D objects)
|
||||
* - Dynamic (for dynamic 3D objects)
|
||||
*/
|
||||
MinecraftPipeline mcpip;
|
||||
|
||||
/** Our camera */
|
||||
Vec4 cameraPosition, cameraLookAt;
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
# _____ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licensed under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tyra>
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
class TutorialBlock {
|
||||
public:
|
||||
TutorialBlock();
|
||||
TutorialBlock(const TutorialBlock& v);
|
||||
~TutorialBlock();
|
||||
|
||||
void updateModelMatrix();
|
||||
|
||||
M4x4 translation, rotation, scale;
|
||||
|
||||
/** Result matrix with translation, rotation and scale */
|
||||
M4x4 model;
|
||||
|
||||
/** Color */
|
||||
Color color;
|
||||
|
||||
/** Texture atlas offset */
|
||||
Vec4 atlasOffset;
|
||||
|
||||
McpipBlock renderData;
|
||||
|
||||
private:
|
||||
void setRenderData();
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
Reference in New Issue
Block a user