Fix water rendering (transparent objects now appear correctly when underwater/in reflections)

Add a new config option (renderactors) that, if set to false, will
prevent actors from rendering in-game (grass…)

This was SVN commit r14447.
This commit is contained in:
wraitii 2013-12-30 15:52:42 +00:00
parent 4a15ac406b
commit 08b44fe647
6 changed files with 24 additions and 4 deletions

View File

@ -43,6 +43,9 @@ bpp = 0
; System settings:
; if false, actors won't be rendered but anything entity will be.
renderactors = false
waternormals = true
waterrealdepth = true
waterfoam = false

View File

@ -36,6 +36,8 @@ bool g_NoGLVBO = false;
bool g_PauseOnFocusLoss = false;
bool g_RenderActors = true;
bool g_Shadows = false;
bool g_ShadowPCF = false;
@ -88,6 +90,7 @@ static void LoadGlobals()
CFG_GET_VAL("noautomipmap", Bool, g_NoGLAutoMipmap);
CFG_GET_VAL("novbo", Bool, g_NoGLVBO);
CFG_GET_VAL("pauseonfocusloss", Bool, g_PauseOnFocusLoss);
CFG_GET_VAL("renderactors", Bool, g_RenderActors);
CFG_GET_VAL("shadows", Bool, g_Shadows);
CFG_GET_VAL("shadowpcf", Bool, g_ShadowPCF);

View File

@ -44,6 +44,9 @@ extern bool g_NoGLVBO;
// flag to pause the game on window focus loss
extern bool g_PauseOnFocusLoss;
// flag to switch on actor rendering
extern bool g_RenderActors;
// flag to switch on shadows
extern bool g_Shadows;

View File

@ -1187,7 +1187,7 @@ SScreenRect CRenderer::RenderReflections(const CShaderDefines& context, const CB
ogl_WarnIfError();
RenderModels(context, &m_ViewCamera.GetFrustum());
ogl_WarnIfError();
RenderTransparentModels(context, TRANSPARENT_BLEND, &m_ViewCamera.GetFrustum());
RenderTransparentModels(context, TRANSPARENT_OPAQUE, &m_ViewCamera.GetFrustum());
ogl_WarnIfError();
glFrontFace(GL_CCW);
@ -1267,7 +1267,7 @@ SScreenRect CRenderer::RenderRefractions(const CShaderDefines& context, const CB
ogl_WarnIfError();
RenderModels(context, &m_ViewCamera.GetFrustum());
ogl_WarnIfError();
RenderTransparentModels(context, TRANSPARENT_BLEND, &m_ViewCamera.GetFrustum());
RenderTransparentModels(context, TRANSPARENT_OPAQUE, &m_ViewCamera.GetFrustum());
ogl_WarnIfError();
glDisable(GL_SCISSOR_TEST);

View File

@ -417,7 +417,7 @@ void CCmpTemplateManager::ConstructTemplateActor(const std::string& actorName, C
std::wstring actorNameW = wstring_from_utf8(actorName);
std::string name = utf8_from_wstring(CParamNode::EscapeXMLString(actorNameW));
std::string xml = "<Entity>"
"<VisualActor><Actor>" + name + "</Actor></VisualActor>"
"<VisualActor><Actor>" + name + "</Actor><ActorOnly/></VisualActor>"
// arbitrary-sized Footprint definition to make actors' selection outlines show up in Atlas
"<Footprint><Circle radius='2.0'/><Height>1.0</Height></Footprint>"
"<Selectable>"

View File

@ -43,6 +43,7 @@
#include "maths/Matrix3D.h"
#include "maths/Vector3D.h"
#include "ps/CLogger.h"
#include "ps/GameSetup/Config.h"
#include "renderer/Scene.h"
#include "tools/atlas/GameInterface/GameLoop.h"
@ -86,6 +87,7 @@ private:
fixed m_ConstructionProgress;
bool m_VisibleInAtlasOnly;
bool m_IsActorOnly; // an in-world entity should not have this or it might not be rendered.
/// Whether the visual actor has been rendered at least once.
/// Necessary because the visibility update runs on simulation update,
@ -127,6 +129,11 @@ public:
"<empty/>"
"</element>"
"</optional>"
"<optional>"
"<element name='ActorOnly' a:help='Used internally; if present, the unit will only be rendered if the user has high enough graphical settings.'>"
"<empty/>"
"</element>"
"</optional>"
"<element name='SilhouetteDisplay'>"
"<data type='boolean'/>"
"</element>"
@ -187,7 +194,8 @@ public:
m_ActorName = paramNode.GetChild("Actor").ToString();
m_VisibleInAtlasOnly = paramNode.GetChild("VisibleInAtlasOnly").ToBool();
m_IsActorOnly = paramNode.GetChild("ActorOnly").IsOk();
InitModel(paramNode);
// We need to select animation even if graphics are disabled, as this modifies serialized state
@ -812,6 +820,9 @@ void CCmpVisualActor::RenderSubmit(SceneCollector& collector, const CFrustum& fr
return;
CModelAbstract& model = m_Unit->GetModel();
if (!g_AtlasGameLoop->running && !g_RenderActors && m_IsActorOnly)
return;
if (culling && !frustum.IsBoxVisible(CVector3D(0, 0, 0), model.GetWorldBoundsRec()))
return;