mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-04-30 08:47:58 +03:00
Merge branch 'renderer_fixes_and_features' into develop
This commit is contained in:
commit
d292a60cb6
6 changed files with 13 additions and 18 deletions
|
@ -18,6 +18,7 @@ Version 1.0.9
|
|||
* Fix gamepad still vibrating if Lara was poisoned prior to death.
|
||||
* Fix flare brightness.
|
||||
* Fix grenade firing angle.
|
||||
* Fix rendering for static meshes with custom blending modes and alpha transparency.
|
||||
* Fix inconsistent multiline string spacing on different display modes.
|
||||
* Remove search object 4 hardcoded meshswap activated with a flipmap.
|
||||
* Add TR1 cowboy.
|
||||
|
|
|
@ -46,7 +46,8 @@ namespace TEN::Renderer
|
|||
RoomsToDraw.clear();
|
||||
LightsToDraw.clear();
|
||||
SpritesToDraw.clear();
|
||||
StaticsToDraw.clear();
|
||||
SortedStaticsToDraw.clear();
|
||||
FogBulbsToDraw.clear();
|
||||
}
|
||||
|
||||
RenderViewCamera::RenderViewCamera(CAMERA_INFO* cam, float roll, float fov, float n, float f, int w, int h)
|
||||
|
|
|
@ -55,8 +55,7 @@ namespace TEN::Renderer
|
|||
std::vector<RendererLight*> LightsToDraw;
|
||||
std::vector<RendererFogBulb> FogBulbsToDraw;
|
||||
std::vector<RendererSpriteToDraw> SpritesToDraw;
|
||||
std::vector<RendererStatic*> StaticsToDraw;
|
||||
std::map<int, std::vector<RendererStatic*>> SortedStatics;
|
||||
std::map<int, std::vector<RendererStatic*>> SortedStaticsToDraw;
|
||||
|
||||
RenderView(CAMERA_INFO* cam, float roll, float fov, float nearPlane, float farPlane, int w, int h);
|
||||
RenderView(const Vector3& pos, const Vector3& dir, const Vector3& up, int w, int h, int room, float nearPlane, float farPlane, float fov);
|
||||
|
|
|
@ -261,6 +261,7 @@ namespace TEN::Renderer
|
|||
staticInfo->Pose = oldMesh->pos;
|
||||
staticInfo->Scale = oldMesh->scale;
|
||||
staticInfo->OriginalVisibilityBox = StaticObjects[staticInfo->ObjectNumber].visibilityBox;
|
||||
staticInfo->IndexInRoom = l;
|
||||
|
||||
staticInfo->Update();
|
||||
}
|
||||
|
|
|
@ -1797,7 +1797,7 @@ namespace TEN::Renderer
|
|||
|
||||
void Renderer11::DrawStatics(RenderView& view, bool transparent)
|
||||
{
|
||||
if (m_staticsTextures.size() == 0 || view.SortedStatics.size() == 0)
|
||||
if (m_staticsTextures.size() == 0 || view.SortedStaticsToDraw.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1817,7 +1817,7 @@ namespace TEN::Renderer
|
|||
m_context->IASetInputLayout(m_inputLayout.Get());
|
||||
m_context->IASetIndexBuffer(m_staticsIndexBuffer.Buffer.Get(), DXGI_FORMAT_R32_UINT, 0);
|
||||
|
||||
for (auto it = view.SortedStatics.begin(); it != view.SortedStatics.end(); it++)
|
||||
for (auto it = view.SortedStaticsToDraw.begin(); it != view.SortedStaticsToDraw.end(); it++)
|
||||
{
|
||||
int staticObjectNumber = it->first;
|
||||
std::vector<RendererStatic*> statics = it->second;
|
||||
|
@ -1910,7 +1910,7 @@ namespace TEN::Renderer
|
|||
|
||||
for (auto room : view.RoomsToDraw)
|
||||
{
|
||||
for (auto& msh : view.StaticsToDraw)
|
||||
for (auto& msh : room->StaticsToDraw)
|
||||
{
|
||||
RendererObject& staticObj = *m_staticObjects[msh->ObjectNumber];
|
||||
|
||||
|
|
|
@ -56,14 +56,7 @@ namespace TEN::Renderer
|
|||
room->ClipBounds.top = (1.0f - room->ViewPort.w) * m_screenHeight * 0.5f;
|
||||
}
|
||||
|
||||
// Sort statics for doing instancing later
|
||||
std::sort(renderView.StaticsToDraw.begin(), renderView.StaticsToDraw.end(), [](const RendererStatic* a, const RendererStatic* b)
|
||||
{
|
||||
return a->ObjectNumber < b->ObjectNumber;
|
||||
});
|
||||
|
||||
// Collect fog bulbs
|
||||
renderView.FogBulbsToDraw.clear();
|
||||
vector<RendererFogBulb> tempFogBulbs;
|
||||
tempFogBulbs.reserve(MAX_FOG_BULBS_DRAW);
|
||||
|
||||
|
@ -77,10 +70,10 @@ namespace TEN::Renderer
|
|||
if (light.Type != LIGHT_TYPE_FOG_BULB)
|
||||
continue;
|
||||
|
||||
if (renderView.Camera.Frustum.SphereInFrustum(light.Position, light.Out))
|
||||
if (renderView.Camera.Frustum.SphereInFrustum(light.Position, light.Out * 1.2f)) /* Test a bigger radius for avoiding bad clipping */
|
||||
{
|
||||
RendererFogBulb bulb;
|
||||
|
||||
|
||||
bulb.Position = light.Position;
|
||||
bulb.Density = light.Intensity;
|
||||
bulb.Color = light.Color;
|
||||
|
@ -464,12 +457,12 @@ namespace TEN::Renderer
|
|||
// At this point, we are sure that we must draw the static mesh
|
||||
room.StaticsToDraw.push_back(mesh);
|
||||
|
||||
if (renderView.SortedStatics.find(mesh->ObjectNumber) == renderView.SortedStatics.end())
|
||||
if (renderView.SortedStaticsToDraw.find(mesh->ObjectNumber) == renderView.SortedStaticsToDraw.end())
|
||||
{
|
||||
std::vector<RendererStatic*> vec;
|
||||
renderView.SortedStatics.insert(std::pair<int, std::vector<RendererStatic*>>(mesh->ObjectNumber, std::vector<RendererStatic*>()));
|
||||
renderView.SortedStaticsToDraw.insert(std::pair<int, std::vector<RendererStatic*>>(mesh->ObjectNumber, std::vector<RendererStatic*>()));
|
||||
}
|
||||
renderView.SortedStatics[mesh->ObjectNumber].push_back(mesh);
|
||||
renderView.SortedStaticsToDraw[mesh->ObjectNumber].push_back(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue