Got it working but its not working...
The UVs are off for some reason but I'm not 100% sure why. Possibly caused by some sort of offset not being accounted for.
This commit is contained in:
parent
e3c85324c6
commit
94de35536a
@ -17,7 +17,9 @@ namespace charcoal
|
|||||||
void setup_vao_vertex() override
|
void setup_vao_vertex() override
|
||||||
{
|
{
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, m_vertex_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, m_vertex_vbo);
|
||||||
|
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), NULL);
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), NULL);
|
||||||
|
|
||||||
glVertexAttribDivisor(0, 0);
|
glVertexAttribDivisor(0, 0);
|
||||||
|
@ -159,6 +159,11 @@ copy "$(ProjectDir)*.h" "$(SolutionDir)include\charcoal-builtin\"</Command>
|
|||||||
<ClInclude Include="MeshGenerator.h" />
|
<ClInclude Include="MeshGenerator.h" />
|
||||||
<ClInclude Include="PoseableBatch.h" />
|
<ClInclude Include="PoseableBatch.h" />
|
||||||
<ClInclude Include="SpriteBatch.h" />
|
<ClInclude Include="SpriteBatch.h" />
|
||||||
|
<ClInclude Include="TexturedBatch.h" />
|
||||||
|
<ClInclude Include="TexturedPipeline.h" />
|
||||||
|
<ClInclude Include="TexturedRenderable.h" />
|
||||||
|
<ClInclude Include="TexturedShaderProgram.h" />
|
||||||
|
<ClInclude Include="TexturedTypes.h" />
|
||||||
<ClInclude Include="TextureGenerator.h" />
|
<ClInclude Include="TextureGenerator.h" />
|
||||||
<ClInclude Include="WithCamera.h" />
|
<ClInclude Include="WithCamera.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
<Filter Include="Header Files\Pipelines\Basic">
|
<Filter Include="Header Files\Pipelines\Basic">
|
||||||
<UniqueIdentifier>{1dbc28a4-b52f-4171-a385-79490dfa9b0a}</UniqueIdentifier>
|
<UniqueIdentifier>{1dbc28a4-b52f-4171-a385-79490dfa9b0a}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Header Files\Pipelines\Textured">
|
||||||
|
<UniqueIdentifier>{a0a4d461-a490-40ce-bc57-22c47460f60e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="GLUtil.cpp">
|
<ClCompile Include="GLUtil.cpp">
|
||||||
@ -89,5 +92,20 @@
|
|||||||
<ClInclude Include="BuiltinPipeline.h">
|
<ClInclude Include="BuiltinPipeline.h">
|
||||||
<Filter>Header Files\General</Filter>
|
<Filter>Header Files\General</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="TexturedBatch.h">
|
||||||
|
<Filter>Header Files\Pipelines\Textured</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="TexturedTypes.h">
|
||||||
|
<Filter>Header Files\Pipelines\Textured</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="TexturedShaderProgram.h">
|
||||||
|
<Filter>Header Files\Pipelines\Textured</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="TexturedPipeline.h">
|
||||||
|
<Filter>Header Files\Pipelines\Textured</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="TexturedRenderable.h">
|
||||||
|
<Filter>Header Files\Pipelines\Textured</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
40
CharcoalBuiltin/TexturedBatch.h
Normal file
40
CharcoalBuiltin/TexturedBatch.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "TexturedTypes.h"
|
||||||
|
#include "TexturedRenderable.h"
|
||||||
|
#include "PoseableBatch.h"
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace builtin
|
||||||
|
{
|
||||||
|
namespace textured
|
||||||
|
{
|
||||||
|
class Batch : public PoseableBatch<Vertex, Index, 2, Renderable>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using PoseableBatch<Vertex, Index, 2, Renderable>::PoseableBatch;
|
||||||
|
protected:
|
||||||
|
void setup_vao_vertex() override
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, m_vertex_vbo);
|
||||||
|
|
||||||
|
glEnableVertexAttribArray(0);
|
||||||
|
glEnableVertexAttribArray(1);
|
||||||
|
|
||||||
|
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position));
|
||||||
|
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, uv));
|
||||||
|
|
||||||
|
glVertexAttribDivisor(0, 0);
|
||||||
|
glVertexAttribDivisor(1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void preprender() const override {
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_p_renderable->get_texture()->get_texture());
|
||||||
|
glBindSampler(0, m_p_renderable->get_sampler()->get_sampler());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
CharcoalBuiltin/TexturedPipeline.h
Normal file
31
CharcoalBuiltin/TexturedPipeline.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GLUtil.h"
|
||||||
|
#include "BuiltinPipeline.h"
|
||||||
|
#include "WithCamera.h"
|
||||||
|
#include "TexturedShaderProgram.h"
|
||||||
|
#include "TexturedBatch.h"
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace builtin
|
||||||
|
{
|
||||||
|
namespace textured
|
||||||
|
{
|
||||||
|
class Pipeline : public builtin::Pipeline<ShaderProgram, Batch>, public WithCamera
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void prepare_opengl() override
|
||||||
|
{
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glDepthFunc(GL_LESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void prepare_uniforms() override
|
||||||
|
{
|
||||||
|
glutil::uniform_matrix(0, get_camera()->get_world_to_view_matrix());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
CharcoalBuiltin/TexturedRenderable.h
Normal file
38
CharcoalBuiltin/TexturedRenderable.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <charcoal/Renderable.h>
|
||||||
|
#include <charcoal/Texture.h>
|
||||||
|
#include <charcoal/Sampler.h>
|
||||||
|
|
||||||
|
#include "TexturedTypes.h"
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace builtin
|
||||||
|
{
|
||||||
|
namespace textured
|
||||||
|
{
|
||||||
|
class Renderable : public RenderableT<Vertex, Index>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Renderable(
|
||||||
|
const Mesh<Vertex, Index>* mesh,
|
||||||
|
const DrawMode& draw_mode,
|
||||||
|
Texture* texture,
|
||||||
|
Sampler* sampler
|
||||||
|
)
|
||||||
|
: RenderableT<Vertex, Index>(mesh, draw_mode),
|
||||||
|
m_p_texture(texture),
|
||||||
|
m_p_sampler(sampler)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Texture* get_texture() const { return m_p_texture; }
|
||||||
|
Sampler* get_sampler() const { return m_p_sampler; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Texture* m_p_texture;
|
||||||
|
Sampler* m_p_sampler;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
CharcoalBuiltin/TexturedShaderProgram.h
Normal file
18
CharcoalBuiltin/TexturedShaderProgram.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <charcoal/VertexFragmentShaderProgram.h>
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace builtin
|
||||||
|
{
|
||||||
|
namespace textured
|
||||||
|
{
|
||||||
|
class ShaderProgram : public VertexFragmentShaderProgram
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ShaderProgram() : VertexFragmentShaderProgram(SHADER_PATH "TexturedVS.glsl", SHADER_PATH "TexturedFS.glsl") {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
CharcoalBuiltin/TexturedTypes.h
Normal file
15
CharcoalBuiltin/TexturedTypes.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "BuiltinTypes.h"
|
||||||
|
|
||||||
|
namespace charcoal
|
||||||
|
{
|
||||||
|
namespace builtin
|
||||||
|
{
|
||||||
|
namespace textured
|
||||||
|
{
|
||||||
|
typedef PTVertex Vertex;
|
||||||
|
typedef Index Index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@
|
|||||||
<ClCompile Include="MyBasicScene.cpp" />
|
<ClCompile Include="MyBasicScene.cpp" />
|
||||||
<ClCompile Include="MyBatch.cpp" />
|
<ClCompile Include="MyBatch.cpp" />
|
||||||
<ClCompile Include="MyBuiltinCubeScene.cpp" />
|
<ClCompile Include="MyBuiltinCubeScene.cpp" />
|
||||||
|
<ClCompile Include="MyBuiltinTexturedScene.cpp" />
|
||||||
<ClCompile Include="MySimple2DScene.cpp" />
|
<ClCompile Include="MySimple2DScene.cpp" />
|
||||||
<ClCompile Include="MySimple3DScene.cpp" />
|
<ClCompile Include="MySimple3DScene.cpp" />
|
||||||
<ClCompile Include="MySimpleCubeScene.cpp" />
|
<ClCompile Include="MySimpleCubeScene.cpp" />
|
||||||
@ -34,6 +35,7 @@
|
|||||||
<ClInclude Include="MyBasicShaderProgram.h" />
|
<ClInclude Include="MyBasicShaderProgram.h" />
|
||||||
<ClInclude Include="MyBatch.h" />
|
<ClInclude Include="MyBatch.h" />
|
||||||
<ClInclude Include="MyBuiltinCubeScene.h" />
|
<ClInclude Include="MyBuiltinCubeScene.h" />
|
||||||
|
<ClInclude Include="MyBuiltinTexturedScene.h" />
|
||||||
<ClInclude Include="MySimple2DScene.h" />
|
<ClInclude Include="MySimple2DScene.h" />
|
||||||
<ClInclude Include="MySimple3DScene.h" />
|
<ClInclude Include="MySimple3DScene.h" />
|
||||||
<ClInclude Include="MySimpleCubeScene.h" />
|
<ClInclude Include="MySimpleCubeScene.h" />
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
<ClCompile Include="main.cpp">
|
<ClCompile Include="main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="MyBuiltinTexturedScene.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="MyApplication.h">
|
<ClInclude Include="MyApplication.h">
|
||||||
@ -68,5 +71,8 @@
|
|||||||
<ClInclude Include="MySimpleCubeScene.h">
|
<ClInclude Include="MySimpleCubeScene.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="MyBuiltinTexturedScene.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -6,7 +6,8 @@ MyApplication::MyApplication(int width, int height)
|
|||||||
m_simple_2d_scene(*this),
|
m_simple_2d_scene(*this),
|
||||||
m_simple_3d_scene(*this),
|
m_simple_3d_scene(*this),
|
||||||
m_simple_cube_scene(*this),
|
m_simple_cube_scene(*this),
|
||||||
m_builtin_basic_cube_scene(*this)
|
m_builtin_basic_cube_scene(*this),
|
||||||
|
m_builtin_textured_scene(*this)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void MyApplication::init()
|
void MyApplication::init()
|
||||||
@ -16,6 +17,7 @@ void MyApplication::init()
|
|||||||
m_simple_3d_scene.init();
|
m_simple_3d_scene.init();
|
||||||
m_simple_cube_scene.init();
|
m_simple_cube_scene.init();
|
||||||
m_builtin_basic_cube_scene.init();
|
m_builtin_basic_cube_scene.init();
|
||||||
|
m_builtin_textured_scene.init();
|
||||||
|
|
||||||
m_p_current_scene = &m_basic_scene;
|
m_p_current_scene = &m_basic_scene;
|
||||||
m_p_current_scene->use();
|
m_p_current_scene->use();
|
||||||
@ -43,6 +45,10 @@ void MyApplication::update(float delta_time, clock_t clock)
|
|||||||
{
|
{
|
||||||
swap_scene(&m_builtin_basic_cube_scene);
|
swap_scene(&m_builtin_basic_cube_scene);
|
||||||
}
|
}
|
||||||
|
else if (m_glfw_input_manager.is_key_pressed(GLFW_KEY_6))
|
||||||
|
{
|
||||||
|
swap_scene(&m_builtin_textured_scene);
|
||||||
|
}
|
||||||
m_p_current_scene->update(delta_time, clock);
|
m_p_current_scene->update(delta_time, clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "MySimple3DScene.h"
|
#include "MySimple3DScene.h"
|
||||||
#include "MySimpleCubeScene.h"
|
#include "MySimpleCubeScene.h"
|
||||||
#include "MyBuiltinCubeScene.h"
|
#include "MyBuiltinCubeScene.h"
|
||||||
|
#include "MyBuiltinTexturedScene.h"
|
||||||
|
|
||||||
using namespace charcoal;
|
using namespace charcoal;
|
||||||
|
|
||||||
@ -36,5 +37,6 @@ private:
|
|||||||
MySimple3DScene m_simple_3d_scene;
|
MySimple3DScene m_simple_3d_scene;
|
||||||
MySimpleCubeScene m_simple_cube_scene;
|
MySimpleCubeScene m_simple_cube_scene;
|
||||||
MyBuiltinCubeScene m_builtin_basic_cube_scene;
|
MyBuiltinCubeScene m_builtin_basic_cube_scene;
|
||||||
|
MyBuiltinTexturedScene m_builtin_textured_scene;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <charcoal/Poseable.h>
|
#include <charcoal/Poseable.h>
|
||||||
#include <charcoal-builtin/BasicScene.h>
|
#include <charcoal/Scene.h>
|
||||||
#include <charcoal-builtin/BuiltinCamera3D.h>
|
#include <charcoal-builtin/BuiltinCamera3D.h>
|
||||||
#include <charcoal-builtin/BasicPipeline.h>
|
#include <charcoal-builtin/BasicPipeline.h>
|
||||||
|
|
||||||
|
98
Example/MyBuiltinTexturedScene.cpp
Normal file
98
Example/MyBuiltinTexturedScene.cpp
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#include "MyBuiltinTexturedScene.h"
|
||||||
|
|
||||||
|
#include <charcoal/constants.h>
|
||||||
|
#include <charcoal/TextureFactory.h>
|
||||||
|
|
||||||
|
#include <charcoal-builtin/MeshGenerator.h>
|
||||||
|
#include <charcoal-builtin/TextureGenerator.h>
|
||||||
|
#include <charcoal-builtin/GLUtil.h>
|
||||||
|
|
||||||
|
MyBuiltinTexturedScene::MyBuiltinTexturedScene(Application& application)
|
||||||
|
: Scene(application),
|
||||||
|
m_sprite_image(image_loader::load_file(IMAGE_PATH "uber.png")),
|
||||||
|
m_cube(
|
||||||
|
meshgenerator::gen_cube_pt<textured::Vertex, textured::Index>(DRAW_TRIANGLES, 2.0f, 2.0f, 2.0f),
|
||||||
|
DRAW_TRIANGLES,
|
||||||
|
texturegenerator::gen_quick_cube_texture(),
|
||||||
|
texturegenerator::gen_quick_sampler()
|
||||||
|
),
|
||||||
|
m_sprite(
|
||||||
|
meshgenerator::gen_rect_pt<textured::Vertex, textured::Index>(DRAW_TRIANGLES, 2.0f, 2.0f),
|
||||||
|
DRAW_TRIANGLES,
|
||||||
|
TextureFactory::gen_image_texture(m_sprite_image),
|
||||||
|
texturegenerator::gen_quick_sampler()
|
||||||
|
),
|
||||||
|
m_camera((float)TAU_1_4, (float)m_screen_size.x / m_screen_size.y, 1.0f, 10.0f, vec3(0.0f, 0.0f, -5.0f)),
|
||||||
|
m_cube_batch(&m_cube, 2),
|
||||||
|
m_sprite_batch(&m_sprite, 1)
|
||||||
|
{
|
||||||
|
m_pipeline.add_batch(&m_cube_batch);
|
||||||
|
m_pipeline.add_batch(&m_sprite_batch);
|
||||||
|
m_pipeline.set_camera(&m_camera);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyBuiltinTexturedScene::init()
|
||||||
|
{
|
||||||
|
m_cube_batch.init();
|
||||||
|
m_sprite_batch.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyBuiltinTexturedScene::update(float delta_time, clock_t clock)
|
||||||
|
{
|
||||||
|
float brightness;
|
||||||
|
float radians;
|
||||||
|
|
||||||
|
clock_t c;
|
||||||
|
const clock_t intervals = 512 * CLOCKS_PER_SEC / 100;
|
||||||
|
const clock_t half_interval = 256 * CLOCKS_PER_SEC / 100;
|
||||||
|
c = clock % intervals;
|
||||||
|
if (c < half_interval)
|
||||||
|
brightness = (float)c / half_interval;
|
||||||
|
else
|
||||||
|
brightness = (float)(intervals - c) / half_interval;
|
||||||
|
|
||||||
|
radians = (float)TAU * c / intervals;
|
||||||
|
|
||||||
|
m_cube_pose_a.rotate(glm::normalize(vec3(1.0f, 1.0f, 0.0f)), (float)TAU_1_2 * delta_time);
|
||||||
|
m_cube_pose_a.update_position(vec3(3 * (float)cos(radians), 1.0f, 0.0f));
|
||||||
|
|
||||||
|
m_cube_pose_b.rotate(glm::normalize(vec3(1.0f, 1.0f, 0.0f)), (float)TAU_1_2 * delta_time);
|
||||||
|
m_cube_pose_b.update_position(vec3(-3 * (float)cos(radians), -1.0f, 0.0f));
|
||||||
|
|
||||||
|
vec3 camera_translation(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_W)) camera_translation.y += 1;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_S)) camera_translation.y -= 1;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_A)) camera_translation.x -= 1;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_D)) camera_translation.x += 1;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_Q)) camera_translation.z -= 1;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_E)) camera_translation.z += 1;
|
||||||
|
|
||||||
|
float camera_rotation = 0.0f;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_Z)) camera_rotation += 1;
|
||||||
|
if (m_input_manager.is_key_down(GLFW_KEY_C)) camera_rotation -= 1;
|
||||||
|
|
||||||
|
m_camera.translate(camera_translation * delta_time);
|
||||||
|
m_camera.rotate(vec3(0.0f, 1.0f, 0.0f), camera_rotation * (float)TAU_1_8 * delta_time);
|
||||||
|
|
||||||
|
m_cube_batch.reset_rendered();
|
||||||
|
m_cube_batch.add_rendered(m_cube_pose_a);
|
||||||
|
m_cube_batch.add_rendered(m_cube_pose_b);
|
||||||
|
|
||||||
|
m_sprite_batch.reset_rendered();
|
||||||
|
m_sprite_batch.add_rendered(m_sprite_pose);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyBuiltinTexturedScene::prerender()
|
||||||
|
{
|
||||||
|
m_camera.prerender();
|
||||||
|
m_cube_batch.prerender();
|
||||||
|
m_sprite_batch.prerender();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyBuiltinTexturedScene::render()
|
||||||
|
{
|
||||||
|
glutil::clear_screen();
|
||||||
|
m_pipeline.render();
|
||||||
|
}
|
||||||
|
|
47
Example/MyBuiltinTexturedScene.h
Normal file
47
Example/MyBuiltinTexturedScene.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <charcoal/Poseable.h>
|
||||||
|
#include <charcoal/Scene.h>
|
||||||
|
#include <charcoal/ImageLoader.h>
|
||||||
|
#include <charcoal-builtin/TexturedPipeline.h>
|
||||||
|
#include <charcoal-builtin/BuiltinCamera3D.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
using namespace charcoal;
|
||||||
|
using namespace charcoal::builtin;
|
||||||
|
|
||||||
|
class MyBuiltinTexturedScene : public Scene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MyBuiltinTexturedScene(Application& application);
|
||||||
|
|
||||||
|
void init() override;
|
||||||
|
|
||||||
|
void use() override {}
|
||||||
|
|
||||||
|
void unuse() override {}
|
||||||
|
|
||||||
|
void update(float delta_time, clock_t clock) override;
|
||||||
|
|
||||||
|
void prerender() override;
|
||||||
|
|
||||||
|
void render() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
image_loader::ImageRGBA m_sprite_image;
|
||||||
|
|
||||||
|
textured::Renderable m_cube;
|
||||||
|
textured::Renderable m_sprite;
|
||||||
|
builtin::Camera3D m_camera;
|
||||||
|
|
||||||
|
textured::Batch m_cube_batch;
|
||||||
|
textured::Batch m_sprite_batch;
|
||||||
|
|
||||||
|
textured::Pipeline m_pipeline;
|
||||||
|
|
||||||
|
Poseable m_cube_pose_a;
|
||||||
|
Poseable m_cube_pose_b;
|
||||||
|
|
||||||
|
Poseable m_sprite_pose;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user