demo map and weapon
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
------------ Tyra's v2.0 roadmap to publish on GitHub ------------
|
------------ Tyra's v2.0 roadmap to publish on GitHub ------------
|
||||||
|
- [General] Tyra version
|
||||||
- [Renderer] Test clipper
|
- [Renderer] Test clipper
|
||||||
- [Renderer] Fog
|
- [Renderer] Fog
|
||||||
- [Demo] Create cool demo which will show all features of Tyra
|
- [Demo] Create cool demo which will show all features of Tyra
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <renderer/3d/mesh/static/static_mesh.hpp>
|
||||||
|
#include <renderer/3d/pipeline/static/stapip_options.hpp>
|
||||||
|
#include <renderer/renderer.hpp>
|
||||||
|
#include "states/game/renderer/renderer_static_pair.hpp"
|
||||||
|
|
||||||
|
using Tyra::Renderer;
|
||||||
|
using Tyra::StaPipOptions;
|
||||||
|
using Tyra::StaticMesh;
|
||||||
|
using Tyra::TextureRepository;
|
||||||
|
using Tyra::Vec4;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
class DebugObject {
|
||||||
|
public:
|
||||||
|
DebugObject(TextureRepository* repo);
|
||||||
|
~DebugObject();
|
||||||
|
|
||||||
|
StaticMesh* mesh;
|
||||||
|
StaPipOptions* options;
|
||||||
|
RendererStaticPair* pair;
|
||||||
|
|
||||||
|
void setPosition(const Vec4& v);
|
||||||
|
|
||||||
|
private:
|
||||||
|
float rotator;
|
||||||
|
void allocateOptions();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
#include "state/state.hpp"
|
#include "state/state.hpp"
|
||||||
#include "state/global_state_type.hpp"
|
#include "state/global_state_type.hpp"
|
||||||
|
#include "./player/player.hpp"
|
||||||
|
#include "./renderer/game_renderer.hpp"
|
||||||
|
#include "./terrain/terrain.hpp"
|
||||||
|
#include "./debug_object.hpp"
|
||||||
|
|
||||||
namespace Demo {
|
namespace Demo {
|
||||||
|
|
||||||
@@ -35,6 +39,12 @@ class GameState : public State<GlobalStateType> {
|
|||||||
GlobalStateType state;
|
GlobalStateType state;
|
||||||
bool _wantFinish;
|
bool _wantFinish;
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
u8 fpsChecker;
|
||||||
|
|
||||||
|
GameRenderer renderer;
|
||||||
|
Player player;
|
||||||
|
Terrain terrain;
|
||||||
|
DebugObject dbgObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Demo
|
} // namespace Demo
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "math/vec4.hpp"
|
||||||
|
#include "renderer/core/3d/camera_info_3d.hpp"
|
||||||
|
#include "pad/pad.hpp"
|
||||||
|
|
||||||
|
using Tyra::CameraInfo3D;
|
||||||
|
using Tyra::Pad;
|
||||||
|
using Tyra::Vec4;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
class Camera {
|
||||||
|
public:
|
||||||
|
Camera(Pad* pad);
|
||||||
|
~Camera();
|
||||||
|
|
||||||
|
Vec4 lookAt;
|
||||||
|
Vec4 position;
|
||||||
|
Vec4 unitCircle;
|
||||||
|
|
||||||
|
CameraInfo3D getCameraInfo() { return CameraInfo3D(&position, &lookAt); }
|
||||||
|
|
||||||
|
void update(const Vec4& playerPosition);
|
||||||
|
|
||||||
|
private:
|
||||||
|
float circleRotation, lengthFromOrigin, height;
|
||||||
|
|
||||||
|
Pad* pad;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "states/game/renderer/renderer_dynamic_pair.hpp"
|
||||||
|
#include "states/game/renderer/renderer_static_pair.hpp"
|
||||||
|
#include "./weapon.hpp"
|
||||||
|
#include "./camera.hpp"
|
||||||
|
#include <engine.hpp>
|
||||||
|
|
||||||
|
using Tyra::Engine;
|
||||||
|
using Tyra::Pad;
|
||||||
|
using Tyra::Vec4;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
class Player {
|
||||||
|
public:
|
||||||
|
Player(Engine* engine);
|
||||||
|
~Player();
|
||||||
|
|
||||||
|
CameraInfo3D getCameraInfo() { return camera.getCameraInfo(); }
|
||||||
|
|
||||||
|
std::vector<RendererStaticPair*> staticPairs;
|
||||||
|
std::vector<RendererDynamicPair*> dynamicPairs;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void handlePlayerPosition();
|
||||||
|
|
||||||
|
float speed;
|
||||||
|
Pad* pad;
|
||||||
|
Vec4 position;
|
||||||
|
Weapon weapon;
|
||||||
|
Camera camera;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <renderer/3d/mesh/static/static_mesh.hpp>
|
||||||
|
#include <renderer/3d/pipeline/static/stapip_options.hpp>
|
||||||
|
#include <renderer/renderer.hpp>
|
||||||
|
|
||||||
|
using Tyra::Renderer;
|
||||||
|
using Tyra::StaPipOptions;
|
||||||
|
using Tyra::StaticMesh;
|
||||||
|
using Tyra::TextureRepository;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
class Weapon {
|
||||||
|
public:
|
||||||
|
Weapon(TextureRepository* repo);
|
||||||
|
~Weapon();
|
||||||
|
|
||||||
|
StaticMesh* mesh;
|
||||||
|
StaPipOptions* options;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void allocateOptions();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "renderer/renderer.hpp"
|
||||||
|
#include "renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp"
|
||||||
|
#include "renderer/3d/pipeline/static/static_pipeline.hpp"
|
||||||
|
#include "./renderer_dynamic_pair.hpp"
|
||||||
|
#include "./renderer_static_pair.hpp"
|
||||||
|
|
||||||
|
using Tyra::DynamicPipeline;
|
||||||
|
using Tyra::Renderer;
|
||||||
|
using Tyra::StaticPipeline;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
class GameRenderer {
|
||||||
|
public:
|
||||||
|
GameRenderer(Renderer* renderer);
|
||||||
|
~GameRenderer();
|
||||||
|
|
||||||
|
void add(std::vector<RendererStaticPair*> staticPairs);
|
||||||
|
void add(std::vector<RendererDynamicPair*> dynamicPairs);
|
||||||
|
void add(RendererStaticPair* staticPair);
|
||||||
|
void add(RendererDynamicPair* dynamicPair);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
void render();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Renderer* renderer;
|
||||||
|
|
||||||
|
StaticPipeline stpip;
|
||||||
|
DynamicPipeline dypip;
|
||||||
|
|
||||||
|
std::vector<RendererStaticPair*> staticPairs;
|
||||||
|
std::vector<RendererDynamicPair*> dynamicPairs;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "renderer/3d/pipeline/dynamic/dynamic_pipeline.hpp"
|
||||||
|
#include "renderer/3d/mesh/dynamic/dynamic_mesh.hpp"
|
||||||
|
|
||||||
|
using Tyra::DynamicMesh;
|
||||||
|
using Tyra::DynPipOptions;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
struct RendererDynamicPair {
|
||||||
|
DynamicMesh* mesh;
|
||||||
|
DynPipOptions* options;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "renderer/3d/pipeline/static/static_pipeline.hpp"
|
||||||
|
#include "renderer/3d/mesh/static/static_mesh.hpp"
|
||||||
|
|
||||||
|
using Tyra::StaPipOptions;
|
||||||
|
using Tyra::StaticMesh;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
struct RendererStaticPair {
|
||||||
|
StaticMesh* mesh;
|
||||||
|
StaPipOptions* options;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <renderer/3d/mesh/static/static_mesh.hpp>
|
||||||
|
#include <renderer/3d/pipeline/static/stapip_options.hpp>
|
||||||
|
#include "states/game/renderer/renderer_static_pair.hpp"
|
||||||
|
#include <renderer/renderer.hpp>
|
||||||
|
|
||||||
|
using Tyra::StaPipOptions;
|
||||||
|
using Tyra::StaticMesh;
|
||||||
|
using Tyra::TextureRepository;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
class Terrain {
|
||||||
|
public:
|
||||||
|
Terrain(TextureRepository* repo);
|
||||||
|
~Terrain();
|
||||||
|
|
||||||
|
StaticMesh* mesh;
|
||||||
|
StaPipOptions* options;
|
||||||
|
RendererStaticPair* pair;
|
||||||
|
|
||||||
|
void update();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void allocateOptions();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
namespace Demo {
|
namespace Demo {
|
||||||
|
|
||||||
DemoGame::DemoGame(Engine* t_engine)
|
DemoGame::DemoGame(Engine* t_engine)
|
||||||
: engine(t_engine), stateManager(STATE_INTRO, STATE_EXIT) {}
|
: engine(t_engine), stateManager(STATE_GAME, STATE_EXIT) {}
|
||||||
DemoGame::~DemoGame() {}
|
DemoGame::~DemoGame() {}
|
||||||
|
|
||||||
void DemoGame::init() {
|
void DemoGame::init() {
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "states/game/debug_object.hpp"
|
||||||
|
#include <loaders/3d/tyrobj/tyrobj_loader.hpp>
|
||||||
|
#include <file/file_utils.hpp>
|
||||||
|
|
||||||
|
using Tyra::Color;
|
||||||
|
using Tyra::FileUtils;
|
||||||
|
using Tyra::TyrobjLoader;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
DebugObject::DebugObject(TextureRepository* repo) {
|
||||||
|
TyrobjLoader loader;
|
||||||
|
auto* data =
|
||||||
|
loader.load(FileUtils::fromCwd("game/models/debug.obj"), 1, .5F, true);
|
||||||
|
data->normalsEnabled = false;
|
||||||
|
data->textureCoordsEnabled = false;
|
||||||
|
mesh = new StaticMesh(*data);
|
||||||
|
delete data;
|
||||||
|
mesh->getMaterial(0)->color = Color(192.0F, 32.0F, 32.0F, 128.0F);
|
||||||
|
rotator = 0.0F;
|
||||||
|
allocateOptions();
|
||||||
|
|
||||||
|
pair = new RendererStaticPair{mesh, options};
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugObject::setPosition(const Vec4& v) {
|
||||||
|
mesh->translation.identity();
|
||||||
|
mesh->rotation.identity();
|
||||||
|
mesh->translation.translate(v);
|
||||||
|
mesh->rotation.rotateX(rotator);
|
||||||
|
mesh->rotation.rotateY(rotator);
|
||||||
|
mesh->rotation.rotateZ(rotator);
|
||||||
|
|
||||||
|
rotator += 0.05F;
|
||||||
|
if (rotator >= 360.0F) rotator = 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugObject::~DebugObject() {
|
||||||
|
delete mesh;
|
||||||
|
delete options;
|
||||||
|
delete pair;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugObject::allocateOptions() {
|
||||||
|
options = new StaPipOptions();
|
||||||
|
options->shadingType = Tyra::TyraShadingGouraud;
|
||||||
|
options->blendingEnabled = false;
|
||||||
|
options->antiAliasingEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -9,19 +9,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "states/game/game_state.hpp"
|
#include "states/game/game_state.hpp"
|
||||||
#include "file/file_utils.hpp"
|
|
||||||
#include "thread/threading.hpp"
|
|
||||||
#include "debug/debug.hpp"
|
#include "debug/debug.hpp"
|
||||||
|
|
||||||
using Tyra::FileUtils;
|
|
||||||
using Tyra::Threading;
|
|
||||||
|
|
||||||
namespace Demo {
|
namespace Demo {
|
||||||
|
|
||||||
GameState::GameState(Engine* t_engine) : State(t_engine) {
|
GameState::GameState(Engine* t_engine)
|
||||||
|
: State(t_engine),
|
||||||
|
renderer(&t_engine->renderer),
|
||||||
|
player(t_engine),
|
||||||
|
terrain(&t_engine->renderer.core.texture.repository),
|
||||||
|
dbgObj(&t_engine->renderer.core.texture.repository) {
|
||||||
state = STATE_GAME;
|
state = STATE_GAME;
|
||||||
_wantFinish = false;
|
_wantFinish = false;
|
||||||
initialized = false;
|
initialized = false;
|
||||||
|
fpsChecker = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameState::~GameState() {}
|
GameState::~GameState() {}
|
||||||
@@ -42,8 +43,26 @@ GlobalStateType GameState::onFinish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameState::update() {
|
void GameState::update() {
|
||||||
engine->renderer.beginFrame();
|
if (fpsChecker++ > 100) {
|
||||||
Threading::switchThread();
|
TYRA_LOG("FPS: ", engine->info.getFps());
|
||||||
|
fpsChecker = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto cameraInfo = player.getCameraInfo();
|
||||||
|
engine->renderer.beginFrame(cameraInfo);
|
||||||
|
|
||||||
|
player.update();
|
||||||
|
dbgObj.setPosition(*cameraInfo.looksAt);
|
||||||
|
|
||||||
|
renderer.clear();
|
||||||
|
{
|
||||||
|
renderer.add(player.staticPairs);
|
||||||
|
renderer.add(player.dynamicPairs);
|
||||||
|
renderer.add(terrain.pair);
|
||||||
|
renderer.add(dbgObj.pair);
|
||||||
|
}
|
||||||
|
renderer.render();
|
||||||
|
|
||||||
engine->renderer.endFrame();
|
engine->renderer.endFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "states/game/player/camera.hpp"
|
||||||
|
#include "debug/debug.hpp"
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
Camera::Camera(Pad* t_pad) : lookAt(0.0F), position(0.0F), pad(t_pad) {
|
||||||
|
lengthFromOrigin = 30.0F;
|
||||||
|
circleRotation = -3.5F;
|
||||||
|
height = 1.5F;
|
||||||
|
}
|
||||||
|
|
||||||
|
Camera::~Camera() {}
|
||||||
|
|
||||||
|
void Camera::update(const Vec4& playerPosition) {
|
||||||
|
const float rotationOffset = 0.03F;
|
||||||
|
const float heightOffset = 0.5F;
|
||||||
|
|
||||||
|
const auto& rightJoy = pad->getRightJoyPad();
|
||||||
|
|
||||||
|
if (rightJoy.h <= 100) {
|
||||||
|
circleRotation -= rotationOffset;
|
||||||
|
} else if (rightJoy.h >= 200) {
|
||||||
|
circleRotation += rotationOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rightJoy.v <= 100) {
|
||||||
|
height -= heightOffset;
|
||||||
|
} else if (rightJoy.v >= 200) {
|
||||||
|
height += heightOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
unitCircle.x = (sin(circleRotation) * lengthFromOrigin);
|
||||||
|
unitCircle.y = height + playerPosition.y;
|
||||||
|
unitCircle.z = (cos(circleRotation) * lengthFromOrigin);
|
||||||
|
|
||||||
|
lookAt = unitCircle + playerPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "states/game/player/player.hpp"
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
Player::Player(Engine* engine)
|
||||||
|
: position(0.0F),
|
||||||
|
weapon(&engine->renderer.core.texture.repository),
|
||||||
|
camera(&engine->pad) {
|
||||||
|
staticPairs.push_back(new RendererStaticPair{weapon.mesh, weapon.options});
|
||||||
|
pad = &engine->pad;
|
||||||
|
position = Vec4(3.0F, 3.0F, 0.0F);
|
||||||
|
camera.lookAt = Vec4(0.0F, 0.0F, -30.0F);
|
||||||
|
speed = 0.5F;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player::~Player() {
|
||||||
|
for (auto pair : staticPairs) {
|
||||||
|
delete pair;
|
||||||
|
}
|
||||||
|
for (auto pair : dynamicPairs) {
|
||||||
|
delete pair;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::update() {
|
||||||
|
handlePlayerPosition();
|
||||||
|
camera.update(position);
|
||||||
|
weapon.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::handlePlayerPosition() {
|
||||||
|
const auto& leftJoy = pad->getLeftJoyPad();
|
||||||
|
|
||||||
|
auto normalizedCamera = Vec4(camera.unitCircle);
|
||||||
|
normalizedCamera.normalize();
|
||||||
|
normalizedCamera *= speed;
|
||||||
|
|
||||||
|
Vec4 nextPosition(position);
|
||||||
|
|
||||||
|
if (leftJoy.v <= 100) {
|
||||||
|
nextPosition.x += normalizedCamera.x;
|
||||||
|
nextPosition.z += normalizedCamera.z;
|
||||||
|
} else if (leftJoy.v >= 200) {
|
||||||
|
nextPosition.x += -normalizedCamera.x;
|
||||||
|
nextPosition.z += -normalizedCamera.z;
|
||||||
|
}
|
||||||
|
if (leftJoy.h <= 100) {
|
||||||
|
nextPosition.x += normalizedCamera.z;
|
||||||
|
nextPosition.z += -normalizedCamera.x;
|
||||||
|
} else if (leftJoy.h >= 200) {
|
||||||
|
nextPosition.x += -normalizedCamera.z;
|
||||||
|
nextPosition.z += normalizedCamera.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
position = nextPosition;
|
||||||
|
|
||||||
|
camera.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "states/game/player/weapon.hpp"
|
||||||
|
#include <loaders/3d/tyrobj/tyrobj_loader.hpp>
|
||||||
|
#include <file/file_utils.hpp>
|
||||||
|
|
||||||
|
using Tyra::FileUtils;
|
||||||
|
using Tyra::TyrobjLoader;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
Weapon::Weapon(TextureRepository* repo) {
|
||||||
|
TyrobjLoader loader;
|
||||||
|
auto* data = loader.load(FileUtils::fromCwd("game/models/ak47/ak47.obj"), 1,
|
||||||
|
1.0F, true);
|
||||||
|
data->normalsEnabled = false;
|
||||||
|
mesh = new StaticMesh(*data);
|
||||||
|
delete data;
|
||||||
|
|
||||||
|
mesh->translation.translateZ(-50.0F);
|
||||||
|
|
||||||
|
repo->addByMesh(mesh, FileUtils::fromCwd("game/models/ak47/"), "png");
|
||||||
|
|
||||||
|
allocateOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
// float testRotation = 0.0F;
|
||||||
|
|
||||||
|
void Weapon::update() {
|
||||||
|
// testRotation += 0.001F;
|
||||||
|
mesh->rotation.identity();
|
||||||
|
mesh->rotation.rotateZ(0.1F);
|
||||||
|
mesh->rotation.rotateY(-4.3F);
|
||||||
|
// TYRA_LOG(testRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
Weapon::~Weapon() {
|
||||||
|
delete mesh;
|
||||||
|
delete options;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Weapon::allocateOptions() {
|
||||||
|
options = new StaPipOptions();
|
||||||
|
options->shadingType = Tyra::TyraShadingGouraud;
|
||||||
|
options->blendingEnabled = false;
|
||||||
|
options->antiAliasingEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "states/game/renderer/game_renderer.hpp"
|
||||||
|
#include "thread/threading.hpp"
|
||||||
|
|
||||||
|
using Tyra::Threading;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
GameRenderer::GameRenderer(Renderer* t_renderer) {
|
||||||
|
renderer = t_renderer;
|
||||||
|
|
||||||
|
stpip.setRenderer(&renderer->core);
|
||||||
|
dypip.setRenderer(&renderer->core);
|
||||||
|
}
|
||||||
|
|
||||||
|
GameRenderer::~GameRenderer() {}
|
||||||
|
|
||||||
|
void GameRenderer::add(std::vector<RendererStaticPair*> t_staticPairs) {
|
||||||
|
staticPairs.insert(staticPairs.end(), t_staticPairs.begin(),
|
||||||
|
t_staticPairs.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameRenderer::add(std::vector<RendererDynamicPair*> t_dynamicPairs) {
|
||||||
|
dynamicPairs.insert(dynamicPairs.end(), t_dynamicPairs.begin(),
|
||||||
|
t_dynamicPairs.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameRenderer::add(RendererStaticPair* staticPair) {
|
||||||
|
staticPairs.push_back(staticPair);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameRenderer::add(RendererDynamicPair* dynamicPair) {
|
||||||
|
dynamicPairs.push_back(dynamicPair);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameRenderer::clear() {
|
||||||
|
staticPairs.clear();
|
||||||
|
dynamicPairs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameRenderer::render() {
|
||||||
|
if (staticPairs.size()) {
|
||||||
|
renderer->renderer3D.usePipeline(&stpip);
|
||||||
|
|
||||||
|
for (auto& pair : staticPairs) {
|
||||||
|
stpip.render(pair->mesh, pair->options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Threading::switchThread();
|
||||||
|
|
||||||
|
if (dynamicPairs.size()) {
|
||||||
|
renderer->renderer3D.usePipeline(&dypip);
|
||||||
|
|
||||||
|
for (auto& pair : dynamicPairs) {
|
||||||
|
dypip.render(pair->mesh, pair->options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "states/game/terrain/terrain.hpp"
|
||||||
|
#include <loaders/3d/tyrobj/tyrobj_loader.hpp>
|
||||||
|
#include <file/file_utils.hpp>
|
||||||
|
|
||||||
|
using Tyra::FileUtils;
|
||||||
|
using Tyra::TyrobjLoader;
|
||||||
|
|
||||||
|
namespace Demo {
|
||||||
|
|
||||||
|
Terrain::Terrain(TextureRepository* repo) {
|
||||||
|
TyrobjLoader loader;
|
||||||
|
auto* data = loader.load(
|
||||||
|
FileUtils::fromCwd("game/models/terrain/terrain.obj"), 1, 5.0F, true);
|
||||||
|
data->normalsEnabled = false;
|
||||||
|
mesh = new StaticMesh(*data);
|
||||||
|
mesh->getMaterial(0)->color.r = 96.0F;
|
||||||
|
mesh->getMaterial(0)->color.g = 96.0F;
|
||||||
|
mesh->getMaterial(0)->color.b = 96.0F;
|
||||||
|
delete data;
|
||||||
|
|
||||||
|
repo->addByMesh(mesh, FileUtils::fromCwd("game/models/terrain/"), "png");
|
||||||
|
|
||||||
|
allocateOptions();
|
||||||
|
|
||||||
|
pair = new RendererStaticPair{mesh, options};
|
||||||
|
}
|
||||||
|
|
||||||
|
// float testRotation = 0.0F;
|
||||||
|
|
||||||
|
void Terrain::update() {
|
||||||
|
// testRotation += 0.001F;
|
||||||
|
mesh->rotation.identity();
|
||||||
|
mesh->rotation.rotateZ(0.1F);
|
||||||
|
mesh->rotation.rotateY(-4.3F);
|
||||||
|
// TYRA_LOG(testRotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
Terrain::~Terrain() {
|
||||||
|
delete mesh;
|
||||||
|
delete options;
|
||||||
|
delete pair;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Terrain::allocateOptions() {
|
||||||
|
options = new StaPipOptions();
|
||||||
|
options->shadingType = Tyra::TyraShadingGouraud;
|
||||||
|
options->blendingEnabled = true;
|
||||||
|
options->antiAliasingEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Demo
|
||||||
@@ -29,6 +29,7 @@ class DynPipCore {
|
|||||||
|
|
||||||
/** Force starting VU1 program instead of continueing */
|
/** Force starting VU1 program instead of continueing */
|
||||||
void clear() { qbufferRenderer.clearLastProgramName(); }
|
void clear() { qbufferRenderer.clearLastProgramName(); }
|
||||||
|
void updatePrimLod(PipelineInfoBag* bag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send model matrix, lighting data and other
|
* Send model matrix, lighting data and other
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "math/m4x4.hpp"
|
#include "math/m4x4.hpp"
|
||||||
#include "math/vec4.hpp"
|
#include "math/vec4.hpp"
|
||||||
#include "../pipeline_shading_type.hpp"
|
#include "../pipeline_shading_type.hpp"
|
||||||
|
#include "../pipeline_texture_mapping_type.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ class PipelineInfoBag {
|
|||||||
M4x4* model;
|
M4x4* model;
|
||||||
|
|
||||||
PipelineShadingType shadingType;
|
PipelineShadingType shadingType;
|
||||||
|
PipelineTextureMappingType textureMappingType;
|
||||||
bool blendingEnabled;
|
bool blendingEnabled;
|
||||||
bool antiAliasingEnabled;
|
bool antiAliasingEnabled;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "renderer/3d/pipeline/shared/pipeline_shading_type.hpp"
|
#include "../shared/pipeline_shading_type.hpp"
|
||||||
#include "../shared/pipeline_lighting_options.hpp"
|
#include "../shared/pipeline_lighting_options.hpp"
|
||||||
|
#include "../shared/pipeline_texture_mapping_type.hpp"
|
||||||
#include "./pipeline_frustum_culling.hpp"
|
#include "./pipeline_frustum_culling.hpp"
|
||||||
|
|
||||||
namespace Tyra {
|
namespace Tyra {
|
||||||
@@ -23,11 +24,13 @@ class PipelineOptions {
|
|||||||
antiAliasingEnabled = false;
|
antiAliasingEnabled = false;
|
||||||
blendingEnabled = true;
|
blendingEnabled = true;
|
||||||
shadingType = TyraShadingFlat;
|
shadingType = TyraShadingFlat;
|
||||||
|
textureMappingType = TyraLinear;
|
||||||
}
|
}
|
||||||
~PipelineOptions() {}
|
~PipelineOptions() {}
|
||||||
|
|
||||||
PipelineFrustumCulling frustumCulling;
|
PipelineFrustumCulling frustumCulling;
|
||||||
PipelineShadingType shadingType;
|
PipelineShadingType shadingType;
|
||||||
|
PipelineTextureMappingType textureMappingType;
|
||||||
bool blendingEnabled;
|
bool blendingEnabled;
|
||||||
bool antiAliasingEnabled;
|
bool antiAliasingEnabled;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
# ______ ____ ___
|
||||||
|
# | \/ ____| |___|
|
||||||
|
# | | | \ | |
|
||||||
|
#-----------------------------------------------------------------------
|
||||||
|
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||||
|
# Licenced under Apache License 2.0
|
||||||
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Tyra {
|
||||||
|
|
||||||
|
enum PipelineTextureMappingType {
|
||||||
|
TyraNearest,
|
||||||
|
TyraLinear,
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Tyra
|
||||||
@@ -41,8 +41,8 @@ void DynPipCore::setPrim() {
|
|||||||
void DynPipCore::setLod() {
|
void DynPipCore::setLod() {
|
||||||
lod.calculation = LOD_USE_K;
|
lod.calculation = LOD_USE_K;
|
||||||
lod.max_level = 0;
|
lod.max_level = 0;
|
||||||
lod.mag_filter = LOD_MAG_NEAREST;
|
lod.mag_filter = LOD_MAG_LINEAR;
|
||||||
lod.min_filter = LOD_MIN_NEAREST;
|
lod.min_filter = LOD_MIN_LINEAR;
|
||||||
lod.mipmap_select = LOD_MIPMAP_REGISTER;
|
lod.mipmap_select = LOD_MIPMAP_REGISTER;
|
||||||
lod.l = 0;
|
lod.l = 0;
|
||||||
lod.k = 0.0F;
|
lod.k = 0.0F;
|
||||||
@@ -70,6 +70,20 @@ void DynPipCore::initParts(DynPipBag* bag) {
|
|||||||
delete texBuffers;
|
delete texBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynPipCore::updatePrimLod(PipelineInfoBag* bag) {
|
||||||
|
prim.antialiasing = bag->antiAliasingEnabled;
|
||||||
|
prim.blending = bag->blendingEnabled;
|
||||||
|
prim.shading = bag->shadingType;
|
||||||
|
|
||||||
|
if (bag->textureMappingType == TyraLinear) {
|
||||||
|
lod.mag_filter = LOD_MAG_LINEAR;
|
||||||
|
lod.min_filter = LOD_MIN_LINEAR;
|
||||||
|
} else {
|
||||||
|
lod.mag_filter = LOD_MAG_NEAREST;
|
||||||
|
lod.min_filter = LOD_MIN_NEAREST;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DynPipCore::renderPart(DynPipBag** bags, const u32& count,
|
void DynPipCore::renderPart(DynPipBag** bags, const u32& count,
|
||||||
const bool& frustumCull) {
|
const bool& frustumCull) {
|
||||||
if (count <= 0) return;
|
if (count <= 0) return;
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ void DynamicPipeline::render(DynamicMesh* mesh, const DynPipOptions* options) {
|
|||||||
|
|
||||||
setBuffersDefaultVars(buffers, mesh, infoBag);
|
setBuffersDefaultVars(buffers, mesh, infoBag);
|
||||||
core.clear();
|
core.clear();
|
||||||
|
core.updatePrimLod(infoBag);
|
||||||
|
|
||||||
for (u32 i = 0; i < mesh->getMaterialsCount(); i++) {
|
for (u32 i = 0; i < mesh->getMaterialsCount(); i++) {
|
||||||
auto* material = mesh->getMaterial(i);
|
auto* material = mesh->getMaterial(i);
|
||||||
@@ -210,10 +211,12 @@ PipelineInfoBag* DynamicPipeline::getInfoBag(DynamicMesh* mesh,
|
|||||||
result->antiAliasingEnabled = options->antiAliasingEnabled;
|
result->antiAliasingEnabled = options->antiAliasingEnabled;
|
||||||
result->blendingEnabled = options->blendingEnabled;
|
result->blendingEnabled = options->blendingEnabled;
|
||||||
result->shadingType = options->shadingType;
|
result->shadingType = options->shadingType;
|
||||||
|
result->textureMappingType = options->textureMappingType;
|
||||||
} else {
|
} else {
|
||||||
result->antiAliasingEnabled = false;
|
result->antiAliasingEnabled = false;
|
||||||
result->blendingEnabled = true;
|
result->blendingEnabled = true;
|
||||||
result->shadingType = TyraShadingFlat;
|
result->shadingType = TyraShadingFlat;
|
||||||
|
result->textureMappingType = TyraLinear;
|
||||||
}
|
}
|
||||||
|
|
||||||
result->model = model;
|
result->model = model;
|
||||||
@@ -243,8 +246,9 @@ DynPipTextureBag* DynamicPipeline::getTextureBag(
|
|||||||
|
|
||||||
result->texture =
|
result->texture =
|
||||||
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
|
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
|
||||||
TYRA_ASSERT(result->texture, "Texture for material id: ", material->getId(),
|
TYRA_ASSERT(
|
||||||
"was not found in texture repository!");
|
result->texture, "Texture for material id: ", material->getId(),
|
||||||
|
"was not found in texture repository! Did you forget to add texture?");
|
||||||
|
|
||||||
result->coordinatesFrom = &materialFrameFrom->getTextureCoords()[startIndex];
|
result->coordinatesFrom = &materialFrameFrom->getTextureCoords()[startIndex];
|
||||||
result->coordinatesTo = &materialFrameTo->getTextureCoords()[startIndex];
|
result->coordinatesTo = &materialFrameTo->getTextureCoords()[startIndex];
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace Tyra {
|
|||||||
|
|
||||||
PipelineInfoBag::PipelineInfoBag() {
|
PipelineInfoBag::PipelineInfoBag() {
|
||||||
shadingType = TyraShadingFlat;
|
shadingType = TyraShadingFlat;
|
||||||
|
textureMappingType = TyraLinear;
|
||||||
blendingEnabled = true;
|
blendingEnabled = true;
|
||||||
antiAliasingEnabled = false;
|
antiAliasingEnabled = false;
|
||||||
model = nullptr;
|
model = nullptr;
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ void StaPipCore::setPrim() {
|
|||||||
void StaPipCore::setLod() {
|
void StaPipCore::setLod() {
|
||||||
lod.calculation = LOD_USE_K;
|
lod.calculation = LOD_USE_K;
|
||||||
lod.max_level = 0;
|
lod.max_level = 0;
|
||||||
lod.mag_filter = LOD_MAG_NEAREST;
|
lod.mag_filter = LOD_MAG_LINEAR;
|
||||||
lod.min_filter = LOD_MIN_NEAREST;
|
lod.min_filter = LOD_MIN_LINEAR;
|
||||||
lod.mipmap_select = LOD_MIPMAP_REGISTER;
|
lod.mipmap_select = LOD_MIPMAP_REGISTER;
|
||||||
lod.l = 0;
|
lod.l = 0;
|
||||||
lod.k = 0.0F;
|
lod.k = 0.0F;
|
||||||
|
|||||||
@@ -159,6 +159,14 @@ void StaPipQBufferRenderer::setInfo(PipelineInfoBag* bag) {
|
|||||||
prim->antialiasing = bag->antiAliasingEnabled;
|
prim->antialiasing = bag->antiAliasingEnabled;
|
||||||
prim->blending = bag->blendingEnabled;
|
prim->blending = bag->blendingEnabled;
|
||||||
prim->shading = bag->shadingType;
|
prim->shading = bag->shadingType;
|
||||||
|
|
||||||
|
if (bag->textureMappingType == TyraLinear) {
|
||||||
|
lod->mag_filter = LOD_MAG_LINEAR;
|
||||||
|
lod->min_filter = LOD_MIN_LINEAR;
|
||||||
|
} else {
|
||||||
|
lod->mag_filter = LOD_MAG_NEAREST;
|
||||||
|
lod->min_filter = LOD_MIN_NEAREST;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaPipQBufferRenderer::sendStaticData() const {
|
void StaPipQBufferRenderer::sendStaticData() const {
|
||||||
|
|||||||
@@ -94,10 +94,12 @@ PipelineInfoBag* StaticPipeline::getInfoBag(StaticMesh* mesh,
|
|||||||
result->blendingEnabled = options->blendingEnabled;
|
result->blendingEnabled = options->blendingEnabled;
|
||||||
result->shadingType = options->shadingType;
|
result->shadingType = options->shadingType;
|
||||||
result->fullClipChecks = options->fullClipChecks;
|
result->fullClipChecks = options->fullClipChecks;
|
||||||
|
result->textureMappingType = options->textureMappingType;
|
||||||
} else {
|
} else {
|
||||||
result->antiAliasingEnabled = false;
|
result->antiAliasingEnabled = false;
|
||||||
result->blendingEnabled = true;
|
result->blendingEnabled = true;
|
||||||
result->shadingType = TyraShadingFlat;
|
result->shadingType = TyraShadingFlat;
|
||||||
|
result->textureMappingType = TyraLinear;
|
||||||
result->fullClipChecks = false;
|
result->fullClipChecks = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,8 +129,9 @@ StaPipTextureBag* StaticPipeline::getTextureBag(
|
|||||||
|
|
||||||
result->texture =
|
result->texture =
|
||||||
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
|
rendererCore->texture.repository.getBySpriteOrMesh(material->getId());
|
||||||
TYRA_ASSERT(result->texture, "Texture for material id: ", material->getId(),
|
TYRA_ASSERT(
|
||||||
"was not found in texture repository!");
|
result->texture, "Texture for material id: ", material->getId(),
|
||||||
|
"was not found in texture repository! Did you forget to add texture?");
|
||||||
|
|
||||||
result->coordinates = materialFrame->getTextureCoords();
|
result->coordinates = materialFrame->getTextureCoords();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user