mirror of
https://github.com/sigonasr2/Shep.git
synced 2026-08-18 05:43:22 -05:00
Flip OBJ Model loading around for proper rendering
This commit is contained in:
parent
c300e5b87a
commit
538c4a3a61
@ -100,11 +100,9 @@ bool ShepGame::OnUserCreate(){
|
||||
AddGameObject({{float(i),0,0},{1,2,1},"nico-Trapper_512.png",MeshType::SPRITE});
|
||||
}
|
||||
AddGameObject({{0,0,0},{1,1,1},"space.png",MeshType::FLOOR});
|
||||
AddGameObject({{0,0,0},{1,1,1},"building1.png",MeshType::OBJ});
|
||||
AddGameObject({{-8,0,0},{1,1,1},"building1.png",MeshType::OBJ});
|
||||
|
||||
for(int i:std::ranges::iota_view(0,3)){
|
||||
AddLight({{-4,-20,100},WHITE});
|
||||
}
|
||||
AddLight({{4,0,10},WHITE});
|
||||
|
||||
Clear(olc::VERY_DARK_BLUE);
|
||||
HW3D_Projection(matProject.m);
|
||||
@ -181,8 +179,7 @@ bool ShepGame::OnUserUpdate(float fElapsedTime){
|
||||
HW3D_DrawObject((matView * matWorld * scale).m, obj.GetSprite().Decal(), mesh.layout, mesh.pos, mesh.uv, mesh.col);
|
||||
};
|
||||
|
||||
HW3D_SetCullMode(olc::CullMode::CCW);
|
||||
for(GameObject&obj:objects|std::views::filter([](const GameObject&obj){return obj.GetMeshType()==MeshType::FLOOR||obj.GetMeshType()==MeshType::SPRITE;})){
|
||||
for(GameObject&obj:objects){
|
||||
Render3DModel(obj);
|
||||
}
|
||||
|
||||
@ -195,12 +192,6 @@ bool ShepGame::OnUserUpdate(float fElapsedTime){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HW3D_SetCullMode(olc::CullMode::CW);
|
||||
for(GameObject&obj:objects|std::views::filter([](const GameObject&obj){return obj.GetMeshType()==MeshType::OBJ;})){
|
||||
Render3DModel(obj);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -874,13 +874,13 @@ namespace olc::utils::hw3d
|
||||
{
|
||||
// Line is a 3D normal
|
||||
s >> junk >> junk >> x >> y >> z;
|
||||
norms.push_back({ -x, y, z });
|
||||
norms.push_back({ x, y, z });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Line is a 3D vertex
|
||||
s >> junk >> x >> y >> z;
|
||||
verts.push_back({ -x, y, z });
|
||||
verts.push_back({ x, y, z });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user