Fixed meshes in wrong places

This commit is contained in:
MontyTRC89 2020-07-24 07:03:36 +02:00
parent 6cd500008c
commit 9a5f1950ee
3 changed files with 10 additions and 12 deletions

View file

@ -148,15 +148,15 @@ namespace T5M::Renderer
}*/ }*/
} }
void Renderer11::updateEffects() void Renderer11::updateEffects(RenderView& view)
{ {
for (int i = 0; i < m_effectsToDraw.size(); i++) for (int i = 0; i < view.effectsToDraw.size(); i++)
{ {
RendererEffect *fx = m_effectsToDraw[i]; RendererEffect *fx = m_effectsToDraw[i];
Matrix translation = Matrix::CreateTranslation(fx->Effect->pos.xPos, fx->Effect->pos.yPos, fx->Effect->pos.zPos); Matrix translation = Matrix::CreateTranslation(fx->Effect->pos.xPos, fx->Effect->pos.yPos, fx->Effect->pos.zPos);
Matrix rotation = Matrix::CreateFromYawPitchRoll(TO_RAD(fx->Effect->pos.yRot), TO_RAD(fx->Effect->pos.xRot), TO_RAD(fx->Effect->pos.zRot)); Matrix rotation = Matrix::CreateFromYawPitchRoll(TO_RAD(fx->Effect->pos.yRot), TO_RAD(fx->Effect->pos.xRot), TO_RAD(fx->Effect->pos.zRot));
m_effectsToDraw[i]->World = rotation * translation; view.effectsToDraw[i]->World = rotation * translation;
} }
} }
@ -310,16 +310,14 @@ namespace T5M::Renderer
itemToDraw->DoneAnimations = true; itemToDraw->DoneAnimations = true;
} }
void Renderer11::updateItemsAnimations() void Renderer11::updateItemsAnimations(RenderView& view)
{ {
Matrix translation; Matrix translation;
Matrix rotation; Matrix rotation;
int numItems = m_itemsToDraw.size(); for (int i = 0; i < view.itemsToDraw.size(); i++)
for (int i = 0; i < numItems; i++)
{ {
RendererItem *itemToDraw = m_itemsToDraw[i]; RendererItem *itemToDraw = view.itemsToDraw[i];
ITEM_INFO *item = itemToDraw->Item; ITEM_INFO *item = itemToDraw->Item;
CREATURE_INFO *creature = (CREATURE_INFO *)item->data; CREATURE_INFO *creature = (CREATURE_INFO *)item->data;

View file

@ -553,8 +553,8 @@ namespace T5M::Renderer
void prepareLights(); void prepareLights();
void collectEffects(short roomNumber, RenderView& renderView); void collectEffects(short roomNumber, RenderView& renderView);
void clearSceneItems(); void clearSceneItems();
void updateItemsAnimations(); void updateItemsAnimations(RenderView& view);
void updateEffects(); void updateEffects(RenderView& view);
int getFrame(short animation, short frame, short** framePtr, int* rate); int getFrame(short animation, short frame, short** framePtr, int* rate);
bool drawAmbientCubeMap(short roomNumber); bool drawAmbientCubeMap(short roomNumber);
bool sphereBoxIntersection(DirectX::SimpleMath::Vector3 boxMin, DirectX::SimpleMath::Vector3 boxMax, DirectX::SimpleMath::Vector3 sphereCentre, float sphereRadius); bool sphereBoxIntersection(DirectX::SimpleMath::Vector3 boxMin, DirectX::SimpleMath::Vector3 boxMax, DirectX::SimpleMath::Vector3 sphereCentre, float sphereRadius);

View file

@ -1924,8 +1924,8 @@ namespace T5M::Renderer
clearSceneItems(); clearSceneItems();
collectRooms(view); collectRooms(view);
UpdateLaraAnimations(false); UpdateLaraAnimations(false);
updateItemsAnimations(); updateItemsAnimations(view);
updateEffects(); updateEffects(view);
if (g_Configuration.EnableShadows) if (g_Configuration.EnableShadows)
drawShadowMap(); drawShadowMap();
m_items[Lara.itemNumber].Item = LaraItem; m_items[Lara.itemNumber].Item = LaraItem;