Renamed transparency to ghost mode
parent
9a07c1d858
commit
39b6621463
|
@ -54,22 +54,22 @@ namespace Gfx
|
|||
const float MOUSE_EDGE_MARGIN = 0.01f;
|
||||
|
||||
//! Changes the level of transparency of an object and objects transported (battery & cargo)
|
||||
static void SetTransparency(CObject* obj, float value)
|
||||
static void SetGhostMode(CObject* obj, bool enabled)
|
||||
{
|
||||
obj->SetTransparency(value);
|
||||
obj->SetGhostMode(enabled);
|
||||
|
||||
if (obj->Implements(ObjectInterfaceType::Carrier))
|
||||
{
|
||||
CObject* cargo = dynamic_cast<CCarrierObject&>(*obj).GetCargo();
|
||||
if (cargo != nullptr)
|
||||
cargo->SetTransparency(value);
|
||||
cargo->SetGhostMode(enabled);
|
||||
}
|
||||
|
||||
if (obj->Implements(ObjectInterfaceType::Powered))
|
||||
{
|
||||
CObject* power = dynamic_cast<CPoweredObject&>(*obj).GetPower();
|
||||
if (power != nullptr)
|
||||
power->SetTransparency(value);
|
||||
power->SetGhostMode(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ void CCamera::SetType(CameraType type)
|
|||
if (IsObjectBeingTransported(obj))
|
||||
continue;
|
||||
|
||||
SetTransparency(obj, 0.0f); // opaque object
|
||||
SetGhostMode(obj, false); // opaque object
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -839,7 +839,7 @@ void CCamera::IsCollisionBack()
|
|||
if (IsObjectBeingTransported(obj))
|
||||
continue;
|
||||
|
||||
SetTransparency(obj, 0.0f); // opaque object
|
||||
SetGhostMode(obj, false); // opaque object
|
||||
|
||||
if (obj == m_cameraObj) continue;
|
||||
|
||||
|
@ -899,7 +899,7 @@ void CCamera::IsCollisionBack()
|
|||
float len = glm::distance(m_actualEye, proj);
|
||||
if (len > del) continue;
|
||||
|
||||
SetTransparency(obj, 1.0f); // transparent object
|
||||
SetGhostMode(obj, true); // ghost mode
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ void CEngine::DebugObject(int objRank)
|
|||
l->Debug(" type = %d\n", m_objects[objRank].type);
|
||||
l->Debug(" distance = %f\n", m_objects[objRank].distance);
|
||||
l->Debug(" shadowRank = %d\n", m_objects[objRank].shadowRank);
|
||||
l->Debug(" transparency = %f\n", m_objects[objRank].transparency);
|
||||
l->Debug(" ghost = %s\n", m_objects[objRank].ghost ? "true" : "false");
|
||||
|
||||
l->Debug(" baseObj:\n");
|
||||
int baseObjRank = m_objects[objRank].baseObjRank;
|
||||
|
@ -984,11 +984,11 @@ void CEngine::SetObjectDrawFront(int objRank, bool draw)
|
|||
m_objects[objRank].drawFront = draw;
|
||||
}
|
||||
|
||||
void CEngine::SetObjectTransparency(int objRank, float value)
|
||||
void CEngine::SetObjectGhostMode(int objRank, bool enabled)
|
||||
{
|
||||
assert(objRank >= 0 && objRank < static_cast<int>( m_objects.size() ));
|
||||
|
||||
m_objects[objRank].transparency = value;
|
||||
m_objects[objRank].ghost = enabled;
|
||||
}
|
||||
|
||||
void CEngine::GetObjectBBox(int objRank, glm::vec3& min, glm::vec3& max)
|
||||
|
@ -3544,7 +3544,7 @@ void CEngine::Draw3DScene()
|
|||
{
|
||||
EngineBaseObjDataTier& p3 = p2.next[l3];
|
||||
|
||||
if (m_objects[objRank].transparency != 0.0f) // transparent ?
|
||||
if (m_objects[objRank].ghost) // transparent ?
|
||||
{
|
||||
transparent = true;
|
||||
continue;
|
||||
|
@ -3629,7 +3629,7 @@ void CEngine::Draw3DScene()
|
|||
{
|
||||
EngineBaseObjDataTier& p3 = p2.next[l3];
|
||||
|
||||
if (m_objects[objRank].transparency == 0.0f)
|
||||
if (!m_objects[objRank].ghost)
|
||||
continue;
|
||||
|
||||
float dirty = (p3.state & ENG_RSTATE_DUAL_BLACK) && m_dirty ? 1.0 : 0.0;
|
||||
|
@ -5646,10 +5646,10 @@ const glm::mat4& CEngine::GetStaticMeshWorldMatrix(int meshHandle)
|
|||
return m_objects[objRank].transform;
|
||||
}
|
||||
|
||||
void CEngine::SetStaticMeshTransparency(int meshHandle, float value)
|
||||
void CEngine::SetStaticMeshGhostMode(int meshHandle, bool enabled)
|
||||
{
|
||||
int objRank = meshHandle;
|
||||
SetObjectTransparency(objRank, value);
|
||||
SetObjectGhostMode(objRank, enabled);
|
||||
}
|
||||
|
||||
void CEngine::SetDebugLights(bool debugLights)
|
||||
|
|
|
@ -274,8 +274,8 @@ struct EngineObject
|
|||
float distance = 0.0f;
|
||||
//! Rank of the associated shadow
|
||||
int shadowRank = -1;
|
||||
//! Transparency of the object [0, 1]
|
||||
float transparency = 0.0f;
|
||||
//! Ghost mode
|
||||
bool ghost = false;
|
||||
|
||||
//! Loads default values
|
||||
inline void LoadDefault()
|
||||
|
@ -706,7 +706,7 @@ public:
|
|||
const glm::mat4& GetStaticMeshWorldMatrix(int meshHandle);
|
||||
|
||||
//! Sets transparency for static mesh
|
||||
void SetStaticMeshTransparency(int meshHandle, float value);
|
||||
void SetStaticMeshGhostMode(int meshHandle, bool enabled);
|
||||
|
||||
|
||||
/* *************** Object management *************** */
|
||||
|
@ -767,7 +767,7 @@ public:
|
|||
void SetObjectDrawFront(int objRank, bool draw);
|
||||
|
||||
//! Sets the transparency level for given object
|
||||
void SetObjectTransparency(int objRank, float value);
|
||||
void SetObjectGhostMode(int objRank, bool enabled);
|
||||
|
||||
//! Returns the bounding box for an object
|
||||
void GetObjectBBox(int objRank, glm::vec3& min, glm::vec3& max);
|
||||
|
|
|
@ -162,8 +162,8 @@ public:
|
|||
// TODO: remove from here once no longer necessary
|
||||
void SetCameraCollisionSphere(const Math::Sphere& sphere);
|
||||
|
||||
//! Sets the transparency of object
|
||||
virtual void SetTransparency(float value) = 0;
|
||||
//! Sets object's ghost mode
|
||||
virtual void SetGhostMode(bool enabled) = 0;
|
||||
|
||||
//! Sets flag controlling animation effect on level reset
|
||||
void SetAnimateOnReset(bool animateOnReset);
|
||||
|
|
|
@ -2547,7 +2547,7 @@ float COldObject::GetReactorRange()
|
|||
|
||||
// Management of transparency of the object.
|
||||
|
||||
void COldObject::SetTransparency(float value)
|
||||
void COldObject::SetGhostMode(bool enabled)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -2560,7 +2560,7 @@ void COldObject::SetTransparency(float value)
|
|||
if ( i != 9 ) continue; // no central pillar?
|
||||
}
|
||||
|
||||
m_engine->SetObjectTransparency(m_objectPart[i].object, value);
|
||||
m_engine->SetObjectGhostMode(m_objectPart[i].object, enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public:
|
|||
void SetReactorRange(float reactorRange) override;
|
||||
float GetReactorRange() override;
|
||||
|
||||
void SetTransparency(float value) override;
|
||||
void SetGhostMode(bool enabled) override;
|
||||
|
||||
Math::Sphere GetJostlingSphere() const override;
|
||||
bool JostleObject(float force) override;
|
||||
|
|
|
@ -105,9 +105,9 @@ void CStaticObject::TransformCameraCollisionSphere(Math::Sphere& collisionSphere
|
|||
Math::Transform(worldMatrix, collisionSphere.pos);
|
||||
}
|
||||
|
||||
void CStaticObject::SetTransparency(float value)
|
||||
void CStaticObject::SetGhostMode(bool enabled)
|
||||
{
|
||||
m_engine->SetStaticMeshTransparency(m_meshHandle, value);
|
||||
m_engine->SetStaticMeshGhostMode(m_meshHandle, enabled);
|
||||
}
|
||||
|
||||
bool CStaticObject::IsStaticObject(ObjectType type)
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
void Read(CLevelParserLine* line) override;
|
||||
void Write(CLevelParserLine* line) override;
|
||||
|
||||
void SetTransparency(float value) override;
|
||||
void SetGhostMode(bool enabled) override;
|
||||
|
||||
public:
|
||||
static bool IsStaticObject(ObjectType type);
|
||||
|
|
Loading…
Reference in New Issue