demo map and weapon
This commit is contained in:
@@ -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/global_state_type.hpp"
|
||||
#include "./player/player.hpp"
|
||||
#include "./renderer/game_renderer.hpp"
|
||||
#include "./terrain/terrain.hpp"
|
||||
#include "./debug_object.hpp"
|
||||
|
||||
namespace Demo {
|
||||
|
||||
@@ -35,6 +39,12 @@ class GameState : public State<GlobalStateType> {
|
||||
GlobalStateType state;
|
||||
bool _wantFinish;
|
||||
bool initialized;
|
||||
u8 fpsChecker;
|
||||
|
||||
GameRenderer renderer;
|
||||
Player player;
|
||||
Terrain terrain;
|
||||
DebugObject dbgObj;
|
||||
};
|
||||
|
||||
} // 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
|
||||
Reference in New Issue
Block a user