Fixed reverse-texture rendering by flipping the camera "handedness"

This commit is contained in:
elipzer 2018-10-15 11:42:12 -04:00
parent 402ef29734
commit 04c31686ec
5 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@
MyBuiltinCubeScene::MyBuiltinCubeScene(Application& application) MyBuiltinCubeScene::MyBuiltinCubeScene(Application& application)
: Scene(application), : Scene(application),
m_shape(meshgenerator::gen_cube_p<basic::Vertex, basic::Index>(DRAW_TRIANGLES, 2.0f, 2.0f, 2.0f), DrawMode::DRAW_TRIANGLES), m_shape(meshgenerator::gen_cube_p<basic::Vertex, basic::Index>(DRAW_TRIANGLES, 2.0f, 2.0f, 2.0f), DrawMode::DRAW_TRIANGLES),
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_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_batch(&m_shape, 2) m_batch(&m_shape, 2)
{ {
m_pipeline.add_batch(&m_batch); m_pipeline.add_batch(&m_batch);

View File

@ -22,7 +22,7 @@ MyBuiltinTexturedScene::MyBuiltinTexturedScene(Application& application)
TextureFactory::gen_image_texture(m_sprite_image), TextureFactory::gen_image_texture(m_sprite_image),
texturegenerator::gen_quick_sampler() 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_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), vec3(0.0f, 0.0f, -1.0f)),
m_cube_batch(&m_cube, 2), m_cube_batch(&m_cube, 2),
m_sprite_batch(&m_sprite, 1) m_sprite_batch(&m_sprite, 1)
{ {

View File

@ -18,7 +18,7 @@ MySimple3DScene::MySimple3DScene(Application& application)
MySimpleShaderProgram::Vertex(2.0f, -1.0f, 0.0f) MySimpleShaderProgram::Vertex(2.0f, -1.0f, 0.0f)
), DrawMode::DRAW_TRIANGLES), ), DrawMode::DRAW_TRIANGLES),
m_batch(&m_shape, 2), m_batch(&m_shape, 2),
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_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))
{} {}
MySimple3DScene::~MySimple3DScene() MySimple3DScene::~MySimple3DScene()

View File

@ -18,7 +18,7 @@ MySimpleCubeScene::MySimpleCubeScene(Application& application)
MySimpleShaderProgram::Vertex( 1.0f, -1.0f, 1.0f) MySimpleShaderProgram::Vertex( 1.0f, -1.0f, 1.0f)
), DrawMode::DRAW_TRIANGLES), ), DrawMode::DRAW_TRIANGLES),
m_batch(&m_shape, 1), m_batch(&m_shape, 1),
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_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))
{} {}
MySimpleCubeScene::~MySimpleCubeScene() MySimpleCubeScene::~MySimpleCubeScene()

View File

@ -17,7 +17,7 @@ namespace charcoal
float znear, float znear,
float zfar, float zfar,
const vec3& position, const vec3& position,
const vec3& forward = vec3(0.0f, 0.0f, 1.0f), const vec3& forward = vec3(0.0f, 0.0f, -1.0f),
const vec3& up = vec3(0.0f, 1.0f, 0.0f), const vec3& up = vec3(0.0f, 1.0f, 0.0f),
const vec3& right = vec3(0.0f) // Zero for auto-calculated const vec3& right = vec3(0.0f) // Zero for auto-calculated
); );
@ -27,7 +27,7 @@ namespace charcoal
// Updates the orientation based on three vectors. // Updates the orientation based on three vectors.
// If right is equal to zero it is calculated with glm::cross(forward, up). // If right is equal to zero it is calculated with glm::cross(forward, up).
// Then the true up is calculated with glm::cross(right, forward) // Then the true up is calculated with glm::cross(right, forward)
void update_orientation(const vec3& forward = vec3(0.0f, 0.0f, 1.0f), const vec3& up = vec3(0.0f, 1.0f, 0.0f), const vec3& right = vec3(0.0f)); void update_orientation(const vec3& forward = vec3(0.0f, 0.0f, -1.0f), const vec3& up = vec3(0.0f, 1.0f, 0.0f), const vec3& right = vec3(0.0f));
// Directly sets the forward, up, and right values. // Directly sets the forward, up, and right values.
void direct_update_orientation(const vec3& forward, const vec3& up, const vec3& right); void direct_update_orientation(const vec3& forward, const vec3& up, const vec3& right);