fixed backface culling (mesh rotation)
This commit is contained in:
@@ -218,6 +218,9 @@ void Renderer::draw(Mesh &t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||
if (!t_mesh.isDataLoaded())
|
||||
PRINT_ERR("Can't draw, because no mesh data was loaded!");
|
||||
|
||||
Vector3 rotatedCamera = Vector3(*renderData.cameraPosition);
|
||||
rotatedCamera.rotate(t_mesh.rotation, true);
|
||||
|
||||
if (t_mesh.getCurrentAnimationFrame() != t_mesh.getNextAnimationFrame())
|
||||
t_mesh.animate();
|
||||
for (u32 i = 0; i < t_mesh.getMaterialsCount(); i++)
|
||||
@@ -229,7 +232,7 @@ void Renderer::draw(Mesh &t_mesh, LightBulb *t_bulbs, u16 t_bulbsCount)
|
||||
VECTOR *normals = new VECTOR[vertCount];
|
||||
VECTOR *coordinates = new VECTOR[vertCount];
|
||||
changeTexture(t_mesh, t_mesh.getMaterial(i).getId());
|
||||
vertCount = t_mesh.getDrawData(i, vertices, normals, coordinates, *renderData.cameraPosition);
|
||||
vertCount = t_mesh.getDrawData(i, vertices, normals, coordinates, rotatedCamera);
|
||||
vifSender->drawMesh(&renderData, perspective, vertCount, vertices, normals, coordinates, t_mesh, t_bulbs, t_bulbsCount, &textureBuffer);
|
||||
delete[] vertices;
|
||||
delete[] normals;
|
||||
|
||||
@@ -33,8 +33,7 @@ Ari::~Ari() {}
|
||||
void Ari::onInit()
|
||||
{
|
||||
|
||||
engine->renderer->setCameraDefinitions(&camera.worldView, &camera.unitCirclePosition, camera.planes);
|
||||
engine->renderer->disableVSync();
|
||||
engine->renderer->setCameraDefinitions(&camera.worldView, &camera.position, camera.planes);
|
||||
engine->audio.init(0);
|
||||
engine->audio.setVolume(40);
|
||||
engine->audio.loadSong("MOV-CIRC.WAV");
|
||||
@@ -49,6 +48,7 @@ void Ari::onInit()
|
||||
island.shouldBeFrustumCulled = false;
|
||||
|
||||
islandAddons.loadDff("sunnyisl/", "sunnyisl3", 0.1F, false);
|
||||
islandAddons.shouldBeBackfaceCulled = true;
|
||||
islandAddons.rotation.x = -1.6F;
|
||||
islandAddons.position.set(0.0F, 10.0F, 20.0F);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user