Some refactors to reduce extensive recompilation cascades
Renamed AlphaMode::OPAQUE to AlphaMode::NONE due to clash with preprocessor define Moved Gfx::EngineTriangle to a separate filedev
parent
e839f0dec7
commit
baa616050a
|
@ -95,6 +95,7 @@ add_library(colobotbase STATIC
|
||||||
graphics/core/material.h
|
graphics/core/material.h
|
||||||
graphics/core/texture.h
|
graphics/core/texture.h
|
||||||
graphics/core/transparency.h
|
graphics/core/transparency.h
|
||||||
|
graphics/core/triangle.h
|
||||||
graphics/core/type.cpp
|
graphics/core/type.cpp
|
||||||
graphics/core/type.h
|
graphics/core/type.h
|
||||||
graphics/core/renderers.h
|
graphics/core/renderers.h
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include "graphics/core/color.h"
|
#include "graphics/core/color.h"
|
||||||
#include "graphics/core/texture.h"
|
#include "graphics/core/texture.h"
|
||||||
#include "graphics/core/transparency.h"
|
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
@ -59,6 +58,7 @@ struct VertexCol;
|
||||||
struct Vertex3D;
|
struct Vertex3D;
|
||||||
|
|
||||||
enum class CullFace : unsigned char;
|
enum class CullFace : unsigned char;
|
||||||
|
enum class TransparencyMode : unsigned char;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct DeviceConfig
|
* \struct DeviceConfig
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct Material
|
||||||
//! Normal map
|
//! Normal map
|
||||||
std::string normalTexture = "";
|
std::string normalTexture = "";
|
||||||
//! Alpha mode
|
//! Alpha mode
|
||||||
AlphaMode alphaMode = AlphaMode::OPAQUE;
|
AlphaMode alphaMode = AlphaMode::NONE;
|
||||||
//! Alpha threshold
|
//! Alpha threshold
|
||||||
float alphaThreshold = 0.0;
|
float alphaThreshold = 0.0;
|
||||||
// Cull face
|
// Cull face
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "graphics/core/transparency.h"
|
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
@ -36,6 +35,7 @@ namespace Gfx
|
||||||
class CVertexBuffer;
|
class CVertexBuffer;
|
||||||
enum class CullFace : unsigned char;
|
enum class CullFace : unsigned char;
|
||||||
enum class PrimitiveType : unsigned char;
|
enum class PrimitiveType : unsigned char;
|
||||||
|
enum class TransparencyMode : unsigned char;
|
||||||
struct Texture;
|
struct Texture;
|
||||||
|
|
||||||
struct ShadowParam
|
struct ShadowParam
|
||||||
|
|
|
@ -40,7 +40,7 @@ enum class TransparencyMode : unsigned char
|
||||||
//! Alpha transparency mode
|
//! Alpha transparency mode
|
||||||
enum class AlphaMode : unsigned char
|
enum class AlphaMode : unsigned char
|
||||||
{
|
{
|
||||||
OPAQUE, // opaque material
|
NONE, // opaque material
|
||||||
MASK, // alpha scissor with threshold
|
MASK, // alpha scissor with threshold
|
||||||
BLEND, // alpha blending
|
BLEND, // alpha blending
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the Colobot: Gold Edition source code
|
||||||
|
* Copyright (C) 2001-2021, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||||
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see http://gnu.org/licenses
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file graphics/core/triangle.h
|
||||||
|
* \brief Triangle struct
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
|
// Graphics module namespace
|
||||||
|
namespace Gfx
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \struct EngineTriangle
|
||||||
|
* \brief A triangle drawn by the graphics engine
|
||||||
|
*/
|
||||||
|
struct EngineTriangle
|
||||||
|
{
|
||||||
|
//! Triangle vertices
|
||||||
|
Vertex3D triangle[3];
|
||||||
|
//! Triangle material
|
||||||
|
Material material;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Gfx
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "common/event.h"
|
#include "common/event.h"
|
||||||
|
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
#include "graphics/engine/water.h"
|
#include "graphics/engine/water.h"
|
||||||
|
@ -582,7 +584,7 @@ void CCamera::FlushOver()
|
||||||
{
|
{
|
||||||
m_overType = CAM_OVER_EFFECT_NULL;
|
m_overType = CAM_OVER_EFFECT_NULL;
|
||||||
m_overColorBase = Color(0.0f, 0.0f, 0.0f, 0.0f); // black
|
m_overColorBase = Color(0.0f, 0.0f, 0.0f, 0.0f); // black
|
||||||
m_engine->SetOverColor(); // nothing
|
m_engine->SetOverColor(Color(), TransparencyMode::BLACK); // nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCamera::SetOverBaseColor(Color color)
|
void CCamera::SetOverBaseColor(Color color)
|
||||||
|
|
|
@ -37,6 +37,7 @@ struct Event;
|
||||||
namespace Gfx
|
namespace Gfx
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum class TransparencyMode : unsigned char;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\enum CameraType
|
\enum CameraType
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
|
@ -34,7 +34,9 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/framebuffer.h"
|
#include "graphics/core/framebuffer.h"
|
||||||
|
#include "graphics/core/material.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/triangle.h"
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "graphics/engine/camera.h"
|
||||||
#include "graphics/engine/cloud.h"
|
#include "graphics/engine/cloud.h"
|
||||||
|
@ -70,6 +72,56 @@ using TimeUtils::TimeUnit;
|
||||||
namespace Gfx
|
namespace Gfx
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \struct EngineBaseObjDataTier
|
||||||
|
* \brief Tier 3 of object tree (data)
|
||||||
|
*/
|
||||||
|
struct EngineBaseObjDataTier
|
||||||
|
{
|
||||||
|
EngineTriangleType type = EngineTriangleType::TRIANGLES;
|
||||||
|
Material material = {};
|
||||||
|
|
||||||
|
std::vector<Vertex3D> vertices;
|
||||||
|
CVertexBuffer* buffer = nullptr;
|
||||||
|
bool updateStaticBuffer = false;
|
||||||
|
|
||||||
|
Texture albedoTexture;
|
||||||
|
Texture emissiveTexture;
|
||||||
|
Texture materialTexture;
|
||||||
|
Texture normalTexture;
|
||||||
|
Texture detailTexture;
|
||||||
|
|
||||||
|
glm::vec2 uvOffset = { 0.0f, 0.0f };
|
||||||
|
glm::vec2 uvScale = { 1.0f, 1.0f };
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \struct BaseEngineObject
|
||||||
|
* \brief Base (template) object - geometry for engine objects
|
||||||
|
*
|
||||||
|
* This is also the tier 1 of base object tree.
|
||||||
|
*/
|
||||||
|
struct EngineBaseObject
|
||||||
|
{
|
||||||
|
//! If true, base object is valid in objects vector
|
||||||
|
bool used = false;
|
||||||
|
//! Number of triangles
|
||||||
|
int totalTriangles = 0;
|
||||||
|
//! Bounding box min (origin 0,0,0 always included)
|
||||||
|
glm::vec3 bboxMin{ 0, 0, 0 };
|
||||||
|
//! bounding box max (origin 0,0,0 always included)
|
||||||
|
glm::vec3 bboxMax{ 0, 0, 0 };
|
||||||
|
//! A bounding sphere that contains all the vertices in this EngineBaseObject
|
||||||
|
Math::Sphere boundingSphere;
|
||||||
|
//! Next tier
|
||||||
|
std::vector<EngineBaseObjDataTier> next;
|
||||||
|
|
||||||
|
inline void LoadDefault()
|
||||||
|
{
|
||||||
|
*this = EngineBaseObject();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct EngineMouse
|
* \struct EngineMouse
|
||||||
* \brief Information about mouse cursor
|
* \brief Information about mouse cursor
|
||||||
|
@ -237,7 +289,6 @@ CEngine::CEngine(CApplication *app, CSystemUtils* systemUtils)
|
||||||
Math::LoadTranslationMatrix(temp2, glm::vec3(1.0f, 1.0f, 1.0f));
|
Math::LoadTranslationMatrix(temp2, glm::vec3(1.0f, 1.0f, 1.0f));
|
||||||
m_shadowBias = temp1 * temp2;
|
m_shadowBias = temp1 * temp2;
|
||||||
|
|
||||||
m_lastState = -1;
|
|
||||||
m_statisticTriangle = 0;
|
m_statisticTriangle = 0;
|
||||||
m_fps = 0.0f;
|
m_fps = 0.0f;
|
||||||
m_firstGroundSpot = false;
|
m_firstGroundSpot = false;
|
||||||
|
@ -2592,9 +2643,6 @@ void CEngine::Render()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_statisticTriangle = 0;
|
m_statisticTriangle = 0;
|
||||||
m_lastState = -1;
|
|
||||||
m_lastColor = Color(-1.0f);
|
|
||||||
m_lastMaterial = Material();
|
|
||||||
|
|
||||||
m_lightMan->UpdateLights();
|
m_lightMan->UpdateLights();
|
||||||
|
|
||||||
|
@ -2824,7 +2872,7 @@ void CEngine::Draw3DScene()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.material.alphaMode != AlphaMode::OPAQUE)
|
if (data.material.alphaMode != AlphaMode::NONE)
|
||||||
{
|
{
|
||||||
objectRenderer->SetAlphaScissor(data.material.alphaThreshold);
|
objectRenderer->SetAlphaScissor(data.material.alphaThreshold);
|
||||||
}
|
}
|
||||||
|
@ -3450,7 +3498,6 @@ void CEngine::DrawInterface()
|
||||||
|
|
||||||
// Force new state to disable lighting
|
// Force new state to disable lighting
|
||||||
m_interfaceMode = true;
|
m_interfaceMode = true;
|
||||||
m_lastState = -1;
|
|
||||||
|
|
||||||
// Draw the entire interface
|
// Draw the entire interface
|
||||||
Ui::CInterface* interface = CRobotMain::GetInstancePointer()->GetInterface();
|
Ui::CInterface* interface = CRobotMain::GetInstancePointer()->GetInterface();
|
||||||
|
@ -3460,7 +3507,6 @@ void CEngine::DrawInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_interfaceMode = false;
|
m_interfaceMode = false;
|
||||||
m_lastState = -1;
|
|
||||||
|
|
||||||
if (!m_screenshotMode && m_renderInterface)
|
if (!m_screenshotMode && m_renderInterface)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "common/system/system.h"
|
#include "common/system/system.h"
|
||||||
|
|
||||||
#include "graphics/core/color.h"
|
#include "graphics/core/color.h"
|
||||||
#include "graphics/core/material.h"
|
|
||||||
#include "graphics/core/texture.h"
|
#include "graphics/core/texture.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
@ -69,9 +68,14 @@ class CTerrain;
|
||||||
class CPyroManager;
|
class CPyroManager;
|
||||||
class CModelMesh;
|
class CModelMesh;
|
||||||
class CVertexBuffer;
|
class CVertexBuffer;
|
||||||
|
struct EngineBaseObjDataTier;
|
||||||
|
struct EngineBaseObject;
|
||||||
|
struct EngineTriangle;
|
||||||
|
struct Material;
|
||||||
struct ModelShadowSpot;
|
struct ModelShadowSpot;
|
||||||
struct ModelTriangle;
|
struct ModelTriangle;
|
||||||
|
|
||||||
|
enum class TransparencyMode : unsigned char;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \enum EngineTriangleType
|
* \enum EngineTriangleType
|
||||||
|
@ -85,18 +89,6 @@ enum class EngineTriangleType
|
||||||
SURFACE = 2
|
SURFACE = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct EngineTriangle
|
|
||||||
* \brief A triangle drawn by the graphics engine
|
|
||||||
*/
|
|
||||||
struct EngineTriangle
|
|
||||||
{
|
|
||||||
//! Triangle vertices
|
|
||||||
Vertex3D triangle[3];
|
|
||||||
//! Triangle material
|
|
||||||
Material material;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\enum EngineObjectType
|
\enum EngineObjectType
|
||||||
\brief Class of graphics engine object */
|
\brief Class of graphics engine object */
|
||||||
|
@ -118,57 +110,6 @@ enum EngineObjectType
|
||||||
ENG_OBJTYPE_METAL = 6
|
ENG_OBJTYPE_METAL = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct EngineBaseObjDataTier
|
|
||||||
* \brief Tier 3 of object tree (data)
|
|
||||||
*/
|
|
||||||
struct EngineBaseObjDataTier
|
|
||||||
{
|
|
||||||
EngineTriangleType type = EngineTriangleType::TRIANGLES;
|
|
||||||
Material material = {};
|
|
||||||
|
|
||||||
std::vector<Vertex3D> vertices;
|
|
||||||
CVertexBuffer* buffer = nullptr;
|
|
||||||
bool updateStaticBuffer = false;
|
|
||||||
|
|
||||||
Texture albedoTexture;
|
|
||||||
Texture emissiveTexture;
|
|
||||||
Texture materialTexture;
|
|
||||||
Texture normalTexture;
|
|
||||||
Texture detailTexture;
|
|
||||||
|
|
||||||
glm::vec2 uvOffset = { 0.0f, 0.0f };
|
|
||||||
glm::vec2 uvScale = { 1.0f, 1.0f };
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \struct BaseEngineObject
|
|
||||||
* \brief Base (template) object - geometry for engine objects
|
|
||||||
*
|
|
||||||
* This is also the tier 1 of base object tree.
|
|
||||||
*/
|
|
||||||
struct EngineBaseObject
|
|
||||||
{
|
|
||||||
//! If true, base object is valid in objects vector
|
|
||||||
bool used = false;
|
|
||||||
//! Number of triangles
|
|
||||||
int totalTriangles = 0;
|
|
||||||
//! Bounding box min (origin 0,0,0 always included)
|
|
||||||
glm::vec3 bboxMin{ 0, 0, 0 };
|
|
||||||
//! bounding box max (origin 0,0,0 always included)
|
|
||||||
glm::vec3 bboxMax{ 0, 0, 0 };
|
|
||||||
//! A bounding sphere that contains all the vertices in this EngineBaseObject
|
|
||||||
Math::Sphere boundingSphere;
|
|
||||||
//! Next tier
|
|
||||||
std::vector<EngineBaseObjDataTier> next;
|
|
||||||
|
|
||||||
inline void LoadDefault()
|
|
||||||
{
|
|
||||||
*this = EngineBaseObject();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \struct EngineObject
|
* \struct EngineObject
|
||||||
* \brief Object drawn by the graphics engine
|
* \brief Object drawn by the graphics engine
|
||||||
|
@ -875,7 +816,7 @@ public:
|
||||||
//! Specifies whether to draw the foreground
|
//! Specifies whether to draw the foreground
|
||||||
void SetOverFront(bool front);
|
void SetOverFront(bool front);
|
||||||
//! Sets the foreground overlay color
|
//! Sets the foreground overlay color
|
||||||
void SetOverColor(const Color& color = Color(), TransparencyMode mode = TransparencyMode::BLACK);
|
void SetOverColor(const Color& color, TransparencyMode mode);
|
||||||
|
|
||||||
//@{
|
//@{
|
||||||
//! Management of the particle density
|
//! Management of the particle density
|
||||||
|
@ -1335,15 +1276,6 @@ protected:
|
||||||
//! Type of mouse cursor
|
//! Type of mouse cursor
|
||||||
EngineMouseType m_mouseType;
|
EngineMouseType m_mouseType;
|
||||||
|
|
||||||
//! Last engine render state (-1 at the beginning of frame)
|
|
||||||
int m_lastState;
|
|
||||||
//! Last color set with render state
|
|
||||||
Color m_lastColor;
|
|
||||||
//! Last texture names for 2 used texture stages
|
|
||||||
std::string m_lastTexture[2];
|
|
||||||
//! Last material
|
|
||||||
Material m_lastMaterial;
|
|
||||||
|
|
||||||
//! True when drawing 2D UI
|
//! True when drawing 2D UI
|
||||||
bool m_interfaceMode;
|
bool m_interfaceMode;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "graphics/engine/camera.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/triangle.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
@ -73,7 +74,7 @@ static bool IsAlien(ObjectType type)
|
||||||
}
|
}
|
||||||
|
|
||||||
CParticle::CParticle(CEngine* engine)
|
CParticle::CParticle(CEngine* engine)
|
||||||
: m_engine(engine)
|
: m_engine(engine), m_triangle(MAXPARTICULE)
|
||||||
{
|
{
|
||||||
std::fill_n(m_frameUpdate, SH_MAX, true);
|
std::fill_n(m_frameUpdate, SH_MAX, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "sound/sound_type.h"
|
#include "sound/sound_type.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class CRobotMain;
|
class CRobotMain;
|
||||||
class CObject;
|
class CObject;
|
||||||
|
@ -42,6 +43,7 @@ namespace Gfx
|
||||||
{
|
{
|
||||||
|
|
||||||
class CParticleRenderer;
|
class CParticleRenderer;
|
||||||
|
struct EngineTriangle;
|
||||||
|
|
||||||
const short MAXPARTICULE = 500;
|
const short MAXPARTICULE = 500;
|
||||||
const short MAXPARTITYPE = 6;
|
const short MAXPARTITYPE = 6;
|
||||||
|
@ -344,7 +346,7 @@ protected:
|
||||||
CParticleRenderer* m_renderer = nullptr;
|
CParticleRenderer* m_renderer = nullptr;
|
||||||
|
|
||||||
Particle m_particle[MAXPARTICULE*MAXPARTITYPE];
|
Particle m_particle[MAXPARTICULE*MAXPARTITYPE];
|
||||||
EngineTriangle m_triangle[MAXPARTICULE]; // triangle if PartiType == 0
|
std::vector<EngineTriangle> m_triangle; // triangle if PartiType == 0
|
||||||
Track m_track[MAXTRACK];
|
Track m_track[MAXTRACK];
|
||||||
int m_wheelTraceTotal = 0;
|
int m_wheelTraceTotal = 0;
|
||||||
int m_wheelTraceIndex = 0;
|
int m_wheelTraceIndex = 0;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
|
#include "graphics/core/triangle.h"
|
||||||
|
|
||||||
#include "graphics/engine/lightman.h"
|
#include "graphics/engine/lightman.h"
|
||||||
#include "graphics/engine/particle.h"
|
#include "graphics/engine/particle.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with this program. If not, see http://gnu.org/licenses
|
* along with this program. If not, see http://gnu.org/licenses
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
@ -25,6 +24,8 @@
|
||||||
#include "common/image.h"
|
#include "common/image.h"
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
||||||
|
#include "graphics/core/triangle.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/water.h"
|
#include "graphics/engine/water.h"
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "common/resources/resourcemanager.h"
|
#include "common/resources/resourcemanager.h"
|
||||||
|
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
|
|
|
@ -402,7 +402,7 @@ CModelMesh ModelInput::ReadTextMesh(std::istream& stream)
|
||||||
bool doubleSided = ReadLineString(stream, "dbl_side") == std::string("Y");
|
bool doubleSided = ReadLineString(stream, "dbl_side") == std::string("Y");
|
||||||
t.material.cullFace = doubleSided ? CullFace::NONE : CullFace::BACK;
|
t.material.cullFace = doubleSided ? CullFace::NONE : CullFace::BACK;
|
||||||
|
|
||||||
if (t.material.alphaMode != AlphaMode::OPAQUE)
|
if (t.material.alphaMode != AlphaMode::NONE)
|
||||||
t.material.alphaThreshold = 0.5f;
|
t.material.alphaThreshold = 0.5f;
|
||||||
|
|
||||||
mesh.AddTriangle(t);
|
mesh.AddTriangle(t);
|
||||||
|
@ -647,7 +647,7 @@ void ModelInput::ConvertFromOldRenderState(ModelTriangle& triangle, int state)
|
||||||
triangle.material.alphaThreshold = 0.5f;
|
triangle.material.alphaThreshold = 0.5f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
triangle.material.alphaMode = AlphaMode::OPAQUE;
|
triangle.material.alphaMode = AlphaMode::NONE;
|
||||||
|
|
||||||
if ((state & static_cast<int>(ModelRenderState::Part1)) != 0)
|
if ((state & static_cast<int>(ModelRenderState::Part1)) != 0)
|
||||||
triangle.material.tag = "tracker_right";
|
triangle.material.tag = "tracker_right";
|
||||||
|
@ -891,11 +891,11 @@ Math::Sphere ModelInput::ParseCameraCollisionSphere(const std::string& text)
|
||||||
AlphaMode ModelInput::ParseTransparentMode(const std::string& text)
|
AlphaMode ModelInput::ParseTransparentMode(const std::string& text)
|
||||||
{
|
{
|
||||||
if (text == "none")
|
if (text == "none")
|
||||||
return AlphaMode::OPAQUE;
|
return AlphaMode::NONE;
|
||||||
else if (text == "alpha")
|
else if (text == "alpha")
|
||||||
return AlphaMode::MASK;
|
return AlphaMode::MASK;
|
||||||
else
|
else
|
||||||
return AlphaMode::OPAQUE;
|
return AlphaMode::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ModelInput::ParseSpecialMark(const std::string& text)
|
std::string ModelInput::ParseSpecialMark(const std::string& text)
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include "common/make_unique.h"
|
#include "common/make_unique.h"
|
||||||
|
|
||||||
#include "graphics/core/light.h"
|
#include "graphics/core/light.h"
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
|
|
||||||
#include "graphics/core/material.h"
|
|
||||||
|
|
||||||
#include "graphics/opengl/glframebuffer.h"
|
#include "graphics/opengl/glframebuffer.h"
|
||||||
#include "graphics/opengl/glutil.h"
|
#include "graphics/opengl/glutil.h"
|
||||||
|
|
||||||
|
@ -43,6 +41,9 @@
|
||||||
namespace Gfx
|
namespace Gfx
|
||||||
{
|
{
|
||||||
|
|
||||||
|
enum class CullFace : unsigned char;
|
||||||
|
enum class TransparencyMode : unsigned char;
|
||||||
|
|
||||||
//! Struct for dynamic buffers
|
//! Struct for dynamic buffers
|
||||||
struct DynamicBuffer
|
struct DynamicBuffer
|
||||||
{
|
{
|
||||||
|
@ -196,9 +197,9 @@ private:
|
||||||
//! Depth mask
|
//! Depth mask
|
||||||
bool m_depthMask = true;
|
bool m_depthMask = true;
|
||||||
//! Cull face mode
|
//! Cull face mode
|
||||||
CullFace m_cullFace = CullFace::NONE;
|
CullFace m_cullFace = {};
|
||||||
//! Transparency mode
|
//! Transparency mode
|
||||||
TransparencyMode m_transparency = TransparencyMode::NONE;
|
TransparencyMode m_transparency = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Gfx
|
} // namespace Gfx
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "graphics/opengl/gl33device.h"
|
#include "graphics/opengl/gl33device.h"
|
||||||
#include "graphics/opengl/glutil.h"
|
#include "graphics/opengl/glutil.h"
|
||||||
|
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "graphics/opengl/gl33device.h"
|
#include "graphics/opengl/gl33device.h"
|
||||||
#include "graphics/opengl/glutil.h"
|
#include "graphics/opengl/glutil.h"
|
||||||
|
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "graphics/opengl/gl33device.h"
|
#include "graphics/opengl/gl33device.h"
|
||||||
#include "graphics/opengl/glutil.h"
|
#include "graphics/opengl/glutil.h"
|
||||||
|
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
#include "graphics/core/vertex.h"
|
#include "graphics/core/vertex.h"
|
||||||
|
|
||||||
#include "common/logger.h"
|
#include "common/logger.h"
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
#include "common/resources/outputstream.h"
|
#include "common/resources/outputstream.h"
|
||||||
#include "common/resources/resourcemanager.h"
|
#include "common/resources/resourcemanager.h"
|
||||||
|
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
|
||||||
#include "graphics/engine/camera.h"
|
#include "graphics/engine/camera.h"
|
||||||
#include "graphics/engine/cloud.h"
|
#include "graphics/engine/cloud.h"
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
@ -446,7 +448,7 @@ void CRobotMain::ChangePhase(Phase phase)
|
||||||
m_engine->SetBackground("");
|
m_engine->SetBackground("");
|
||||||
m_engine->SetBackForce(false);
|
m_engine->SetBackForce(false);
|
||||||
m_engine->SetForegroundName("");
|
m_engine->SetForegroundName("");
|
||||||
m_engine->SetOverColor();
|
m_engine->SetOverColor(Gfx::Color(), Gfx::TransparencyMode::BLACK);
|
||||||
m_engine->DeleteGroundMark(0);
|
m_engine->DeleteGroundMark(0);
|
||||||
SetSpeed(1.0f);
|
SetSpeed(1.0f);
|
||||||
m_terrain->SetWind(glm::vec3(0.0f, 0.0f, 0.0f));
|
m_terrain->SetWind(glm::vec3(0.0f, 0.0f, 0.0f));
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/text.h"
|
#include "graphics/engine/text.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "level/robotmain.h"
|
#include "level/robotmain.h"
|
||||||
|
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "math/func.h"
|
#include "math/func.h"
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "common/resources/outputstream.h"
|
#include "common/resources/outputstream.h"
|
||||||
|
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
#include "level/parser/parser.h"
|
#include "level/parser/parser.h"
|
||||||
|
|
|
@ -21,8 +21,10 @@
|
||||||
#include "ui/controls/gauge.h"
|
#include "ui/controls/gauge.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
#include "math/func.h"
|
#include "math/func.h"
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
#include "sound/sound.h"
|
#include "sound/sound.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/terrain.h"
|
#include "graphics/engine/terrain.h"
|
||||||
#include "graphics/engine/water.h"
|
#include "graphics/engine/water.h"
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
#include "ui/controls/button.h"
|
#include "ui/controls/button.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
#include "graphics/engine/text.h"
|
#include "graphics/engine/text.h"
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "graphics/core/device.h"
|
#include "graphics/core/device.h"
|
||||||
#include "graphics/core/renderers.h"
|
#include "graphics/core/renderers.h"
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
#include "ui/screen/screen_setup_sound.h"
|
#include "ui/screen/screen_setup_sound.h"
|
||||||
#include "ui/screen/screen_welcome.h"
|
#include "ui/screen/screen_welcome.h"
|
||||||
|
|
||||||
|
#include "graphics/core/transparency.h"
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "common/stringutils.h"
|
#include "common/stringutils.h"
|
||||||
|
|
||||||
|
#include "graphics/core/material.h"
|
||||||
|
|
||||||
#include "graphics/engine/engine.h"
|
#include "graphics/engine/engine.h"
|
||||||
|
|
||||||
#include "level/robotmain.h"
|
#include "level/robotmain.h"
|
||||||
|
|
Loading…
Reference in New Issue