Object handling in CEngine
- finished rewriting CEngine object, shadow, etc. handling - refactored texture code - added new log levelsdev-ui
parent
b4b74c30e9
commit
45a5e1e865
|
@ -57,8 +57,10 @@ void CLogger::Log(LogType type, const char *str, va_list args)
|
|||
return;
|
||||
|
||||
switch (type) {
|
||||
case LOG_WARN: fprintf(IsOpened() ? mFile : stderr, "[WARN]: "); break;
|
||||
case LOG_INFO: fprintf(IsOpened() ? mFile : stderr, "[INFO]: "); break;
|
||||
case LOG_TRACE: fprintf(IsOpened() ? mFile : stderr, "[TRACE]: "); break;
|
||||
case LOG_DEBUG: fprintf(IsOpened() ? mFile : stderr, "[DEBUG]: "); break;
|
||||
case LOG_WARN: fprintf(IsOpened() ? mFile : stderr, "[WARN]: "); break;
|
||||
case LOG_INFO: fprintf(IsOpened() ? mFile : stderr, "[INFO]: "); break;
|
||||
case LOG_ERROR: fprintf(IsOpened() ? mFile : stderr, "[ERROR]: "); break;
|
||||
default: break;
|
||||
}
|
||||
|
@ -67,6 +69,24 @@ void CLogger::Log(LogType type, const char *str, va_list args)
|
|||
}
|
||||
|
||||
|
||||
void CLogger::Trace(const char *str, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
Log(LOG_TRACE, str, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void CLogger::Debug(const char *str, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
Log(LOG_DEBUG, str, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
void CLogger::Info(const char *str, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
|
@ -37,10 +37,12 @@
|
|||
**/
|
||||
enum LogType
|
||||
{
|
||||
LOG_INFO = 1, /*!< lowest level, information */
|
||||
LOG_WARN = 2, /*!< warning */
|
||||
LOG_ERROR = 3, /*!< error */
|
||||
LOG_NONE = 4 /*!< none level, used for custom messages */
|
||||
LOG_TRACE = 1, /*!< lowest level, execution tracing */
|
||||
LOG_DEBUG = 2, /*!< debugging messages */
|
||||
LOG_INFO = 3, /*!< information */
|
||||
LOG_WARN = 4, /*!< warning */
|
||||
LOG_ERROR = 5, /*!< error */
|
||||
LOG_NONE = 6 /*!< none level, used for custom messages */
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,6 +64,18 @@ class CLogger : public CSingleton<CLogger>
|
|||
*/
|
||||
void Message(const char *str, ...);
|
||||
|
||||
/** Write message to console or file with LOG_TRACE level
|
||||
* @param str - message to write
|
||||
* @param ... - additional arguments
|
||||
*/
|
||||
void Trace(const char *str, ...);
|
||||
|
||||
/** Write message to console or file with LOG_DEBUG level
|
||||
* @param str - message to write
|
||||
* @param ... - additional arguments
|
||||
*/
|
||||
void Debug(const char *str, ...);
|
||||
|
||||
/** Write message to console or file with LOG_INFO level
|
||||
* @param str - message to write
|
||||
* @param ... - additional arguments
|
||||
|
|
|
@ -45,6 +45,16 @@ struct Material
|
|||
Gfx::Color ambient;
|
||||
//! Specular color
|
||||
Gfx::Color specular;
|
||||
|
||||
bool operator==(const Gfx::Material &mat) const
|
||||
{
|
||||
return diffuse == mat.diffuse && ambient == mat.ambient && specular == mat.specular;
|
||||
}
|
||||
|
||||
bool operator!=(const Gfx::Material &mat) const
|
||||
{
|
||||
return ! operator==(mat);
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace Gfx
|
||||
|
|
|
@ -192,9 +192,7 @@ struct TextureStageParams
|
|||
Also contains some additional data. */
|
||||
struct Texture
|
||||
{
|
||||
//! Whether the texture (ID) is valid
|
||||
bool valid;
|
||||
//! ID of the texture in graphics engine
|
||||
//! ID of the texture in graphics engine; 0 = invalid texture
|
||||
unsigned int id;
|
||||
//! Size of texture
|
||||
Math::IntPoint size;
|
||||
|
@ -203,23 +201,34 @@ struct Texture
|
|||
|
||||
Texture()
|
||||
{
|
||||
valid = false;
|
||||
id = 0;
|
||||
alpha = false;
|
||||
}
|
||||
|
||||
//! Returns whether the texture is valid (ID != 0)
|
||||
bool Valid() const
|
||||
{
|
||||
return id != 0;
|
||||
}
|
||||
|
||||
//! Sets the ID to invalid value (0)
|
||||
void SetInvalid()
|
||||
{
|
||||
id = 0;
|
||||
}
|
||||
|
||||
//! Comparator for use in texture maps and sets
|
||||
inline bool operator<(const Gfx::Texture &other) const
|
||||
{
|
||||
// Invalid textures are always "less than" every other texture
|
||||
|
||||
if ( (!valid) && (!other.valid) )
|
||||
if ( (! Valid()) && (! other.Valid()) )
|
||||
return false;
|
||||
|
||||
if (!valid)
|
||||
if (! Valid())
|
||||
return true;
|
||||
|
||||
if (!other.valid)
|
||||
if (! other.Valid())
|
||||
return false;
|
||||
|
||||
return id < other.id;
|
||||
|
@ -228,9 +237,9 @@ struct Texture
|
|||
//! Comparator
|
||||
inline bool operator==(const Gfx::Texture &other) const
|
||||
{
|
||||
if (valid != other.valid)
|
||||
if (Valid() != other.Valid())
|
||||
return false;
|
||||
if ( (!valid) && (!other.valid) )
|
||||
if ( (! Valid()) && (! other.Valid()) )
|
||||
return true;
|
||||
|
||||
return id == other.id;
|
||||
|
|
|
@ -43,7 +43,7 @@ Gfx::CCloud::CCloud(CInstanceManager* iMan, Gfx::CEngine* engine)
|
|||
m_subdiv = 8;
|
||||
m_enable = true;
|
||||
|
||||
m_line.reserve(CLOUD_LINE_PREALLOCATE_COUNT);
|
||||
m_lines.reserve(CLOUD_LINE_PREALLOCATE_COUNT);
|
||||
}
|
||||
|
||||
Gfx::CCloud::~CCloud()
|
||||
|
@ -107,7 +107,7 @@ void Gfx::CCloud::Draw()
|
|||
|
||||
if ( !m_enable ) return;
|
||||
if ( m_level == 0.0f ) return;
|
||||
if ( m_lineUsed == 0 ) return;
|
||||
if ( m_linesUsed == 0 ) return;
|
||||
|
||||
vertex = (D3DVERTEX2*)malloc(sizeof(D3DVERTEX2)*(m_brick+2)*2);
|
||||
|
||||
|
@ -155,11 +155,11 @@ void Gfx::CCloud::Draw()
|
|||
n = Math::Vector(0.0f, -1.0f, 0.0f);
|
||||
|
||||
// Draws all the lines.
|
||||
for ( i=0 ; i<m_lineUsed ; i++ )
|
||||
for ( i=0 ; i<m_linesUsed ; i++ )
|
||||
{
|
||||
pos.y = m_level;
|
||||
pos.z = m_line[i].pz;
|
||||
pos.x = m_line[i].px1;
|
||||
pos.z = m_lines[i].pz;
|
||||
pos.x = m_lines[i].px1;
|
||||
|
||||
u = 0;
|
||||
p.x = pos.x-size;
|
||||
|
@ -174,7 +174,7 @@ void Gfx::CCloud::Draw()
|
|||
AdjustLevel(p, eye, deep, uv1, uv2);
|
||||
vertex[u++] = D3DVERTEX2(p, n, uv1.x,uv1.y, uv2.x,uv2.y);
|
||||
|
||||
for ( j=0 ; j<m_line[i].len ; j++ )
|
||||
for ( j=0 ; j<m_lines[i].len ; j++ )
|
||||
{
|
||||
p.x = pos.x+size;
|
||||
p.z = pos.z+size;
|
||||
|
@ -216,7 +216,7 @@ void Gfx::CCloud::CreateLine(int x, int y, int len)
|
|||
line.px2 = m_size*(line.x+line.len) - offset;
|
||||
line.pz = m_size* line.y - offset;
|
||||
|
||||
m_line.push_back(line);
|
||||
m_lines.push_back(line);
|
||||
}
|
||||
|
||||
void Gfx::CCloud::Create(const std::string& fileName,
|
||||
|
@ -247,7 +247,7 @@ void Gfx::CCloud::Create(const std::string& fileName,
|
|||
if (m_level == 0.0f)
|
||||
return;
|
||||
|
||||
m_line.clear();
|
||||
m_lines.clear();
|
||||
for (int y = 0; y < m_brick; y++)
|
||||
CreateLine(0, y, m_brick);
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ protected:
|
|||
//! Size of a brick element
|
||||
float m_size;
|
||||
|
||||
std::vector<Gfx::CloudLine> m_line;
|
||||
std::vector<Gfx::CloudLine> m_lines;
|
||||
|
||||
bool m_enable;
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -59,15 +59,70 @@ class CPlanet;
|
|||
class CTerrain;
|
||||
|
||||
|
||||
/**
|
||||
\enum EngineRenderState
|
||||
\brief Render state of graphics engine
|
||||
|
||||
States are used for settings certain modes, for instance texturing and blending.
|
||||
The enum is a bitmask and some of the states can be OR'd together. */
|
||||
enum EngineRenderState
|
||||
{
|
||||
//! Normal opaque materials
|
||||
ENG_RSTATE_NORMAL = 0,
|
||||
//! The transparent texture (black = no)
|
||||
ENG_RSTATE_TTEXTURE_BLACK = (1<<0),
|
||||
//! The transparent texture (white = no)
|
||||
ENG_RSTATE_TTEXTURE_WHITE = (1<<1),
|
||||
//! The transparent diffuse color
|
||||
ENG_RSTATE_TDIFFUSE = (1<<2),
|
||||
//! Texture wrap
|
||||
ENG_RSTATE_WRAP = (1<<3),
|
||||
//! Texture borders with solid color
|
||||
ENG_RSTATE_CLAMP = (1<<4),
|
||||
//! Light texture (ambient max)
|
||||
ENG_RSTATE_LIGHT = (1<<5),
|
||||
//! Double black texturing
|
||||
ENG_RSTATE_DUAL_BLACK = (1<<6),
|
||||
//! Double white texturing
|
||||
ENG_RSTATE_DUAL_WHITE = (1<<7),
|
||||
//! Part 1 (no change in. MOD!)
|
||||
ENG_RSTATE_PART1 = (1<<8),
|
||||
//! Part 2
|
||||
ENG_RSTATE_PART2 = (1<<9),
|
||||
//! Part 3
|
||||
ENG_RSTATE_PART3 = (1<<10),
|
||||
//! Part 4
|
||||
ENG_RSTATE_PART4 = (1<<11),
|
||||
//! Double-sided face
|
||||
ENG_RSTATE_2FACE = (1<<12),
|
||||
//! Image using alpha channel
|
||||
ENG_RSTATE_ALPHA = (1<<13),
|
||||
//! Always use 2nd floor texturing
|
||||
ENG_RSTATE_SECOND = (1<<14),
|
||||
//! Causes the fog
|
||||
ENG_RSTATE_FOG = (1<<15),
|
||||
//! The transparent color (black = no)
|
||||
ENG_RSTATE_TCOLOR_BLACK = (1<<16),
|
||||
//! The transparent color (white = no)
|
||||
ENG_RSTATE_TCOLOR_WHITE = (1<<17),
|
||||
//! Mode for rendering text
|
||||
ENG_RSTATE_TEXT = (1<<18),
|
||||
//! Only opaque texture, no blending, etc.
|
||||
ENG_RSTATE_OPAQUE_TEXTURE = (1<<19),
|
||||
//! Only opaque color, no texture, blending, etc.
|
||||
ENG_RSTATE_OPAQUE_COLOR = (1<<20)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\enum EngineTriangleType
|
||||
\brief Type of triangles drawn for engine objects */
|
||||
enum EngineTriangleType
|
||||
{
|
||||
//! Triangles
|
||||
ENG_TRIANGLE_TYPE_6T = 1,
|
||||
ENG_TRIANGLE_TYPE_TRIANGLES = 1,
|
||||
//! Surfaces
|
||||
ENG_TRIANGLE_TYPE_6S = 2
|
||||
ENG_TRIANGLE_TYPE_SURFACE = 2
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -82,13 +137,13 @@ struct EngineTriangle
|
|||
//! Render state
|
||||
int state;
|
||||
//! 1st texture
|
||||
Gfx::Texture tex1;
|
||||
std::string tex1Name;
|
||||
//! 2nd texture
|
||||
Gfx::Texture tex2;
|
||||
std::string tex2Name;
|
||||
|
||||
EngineTriangle()
|
||||
{
|
||||
state = 0;
|
||||
state = Gfx::ENG_RSTATE_NORMAL;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -118,6 +173,8 @@ enum EngineObjectType
|
|||
\brief Object drawn by the graphics engine */
|
||||
struct EngineObject
|
||||
{
|
||||
//! If true, object is valid in objects vector
|
||||
bool used;
|
||||
//! If true, the object is drawn
|
||||
bool visible;
|
||||
//! If true, object is behind the 2D interface
|
||||
|
@ -130,7 +187,7 @@ struct EngineObject
|
|||
Gfx::EngineObjectType type;
|
||||
//! Transformation matrix
|
||||
Math::Matrix transform;
|
||||
//! Distance view - origin (TODO: ?)
|
||||
//! Distance to object from eye point
|
||||
float distance;
|
||||
//! Bounding box min (origin 0,0,0 always included)
|
||||
Math::Vector bboxMin;
|
||||
|
@ -143,15 +200,27 @@ struct EngineObject
|
|||
//! Transparency of the object [0, 1]
|
||||
float transparency;
|
||||
|
||||
//! Calls LoadDefault()
|
||||
EngineObject()
|
||||
{
|
||||
LoadDefault();
|
||||
}
|
||||
|
||||
//! Loads default values
|
||||
inline void LoadDefault()
|
||||
{
|
||||
used = false;
|
||||
visible = false;
|
||||
drawWorld = false;
|
||||
drawFront = false;
|
||||
totalTriangles = 0;
|
||||
type = Gfx::ENG_OBJTYPE_NULL;
|
||||
transform.LoadIdentity();
|
||||
bboxMax.LoadZero();
|
||||
bboxMin.LoadZero();
|
||||
distance = 0.0f;
|
||||
radius = 0.0f;
|
||||
shadowRank = 0;
|
||||
shadowRank = -1;
|
||||
transparency = 0.0f;
|
||||
}
|
||||
};
|
||||
|
@ -160,37 +229,22 @@ struct EngineObjLevel1;
|
|||
struct EngineObjLevel2;
|
||||
struct EngineObjLevel3;
|
||||
struct EngineObjLevel4;
|
||||
struct EngineObjLevel5;
|
||||
|
||||
/**
|
||||
\struct EngineObjLevel5
|
||||
\brief Tier 5 of object tree */
|
||||
struct EngineObjLevel5
|
||||
{
|
||||
Gfx::Material material;
|
||||
int state;
|
||||
Gfx::EngineTriangleType type;
|
||||
std::vector<Gfx::VertexTex2> vertices;
|
||||
|
||||
EngineObjLevel5()
|
||||
{
|
||||
state = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
\struct EngineObjLevel4
|
||||
\brief Tier 4 of object tree */
|
||||
struct EngineObjLevel4
|
||||
{
|
||||
int reserved;
|
||||
std::vector<Gfx::EngineObjLevel5> up;
|
||||
Gfx::EngineObjLevel3* down;
|
||||
bool used;
|
||||
Gfx::EngineTriangleType type;
|
||||
Gfx::Material material;
|
||||
int state;
|
||||
std::vector<Gfx::VertexTex2> vertices;
|
||||
|
||||
EngineObjLevel4()
|
||||
{
|
||||
reserved = 0;
|
||||
}
|
||||
EngineObjLevel4(bool used = false,
|
||||
Gfx::EngineTriangleType type = Gfx::ENG_TRIANGLE_TYPE_TRIANGLES,
|
||||
const Gfx::Material& material = Gfx::Material(),
|
||||
int state = Gfx::ENG_RSTATE_NORMAL);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -198,15 +252,12 @@ struct EngineObjLevel4
|
|||
\brief Tier 3 of object tree */
|
||||
struct EngineObjLevel3
|
||||
{
|
||||
bool used;
|
||||
float min;
|
||||
float max;
|
||||
std::vector<Gfx::EngineObjLevel4> up;
|
||||
Gfx::EngineObjLevel2* down;
|
||||
std::vector<Gfx::EngineObjLevel4> next;
|
||||
|
||||
EngineObjLevel3()
|
||||
{
|
||||
min = max = 0.0f;
|
||||
}
|
||||
EngineObjLevel3(bool used = false, float min = 0.0f, float max = 0.0f);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -214,14 +265,11 @@ struct EngineObjLevel3
|
|||
\brief Tier 2 of object tree */
|
||||
struct EngineObjLevel2
|
||||
{
|
||||
bool used;
|
||||
int objRank;
|
||||
std::vector<Gfx::EngineObjLevel3> up;
|
||||
Gfx::EngineObjLevel1* down;
|
||||
std::vector<Gfx::EngineObjLevel3> next;
|
||||
|
||||
EngineObjLevel2()
|
||||
{
|
||||
objRank = 0;
|
||||
}
|
||||
EngineObjLevel2(bool used = false, int objRank = -1);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -229,11 +277,15 @@ struct EngineObjLevel2
|
|||
\brief Tier 1 of object tree */
|
||||
struct EngineObjLevel1
|
||||
{
|
||||
bool used;
|
||||
std::string tex1Name;
|
||||
Gfx::Texture tex1;
|
||||
std::string tex2Name;
|
||||
Gfx::Texture tex2;
|
||||
std::vector<Gfx::EngineObjLevel2> up;
|
||||
std::vector<Gfx::EngineObjLevel2> next;
|
||||
|
||||
EngineObjLevel1() {}
|
||||
EngineObjLevel1(bool used = false, const std::string& tex1Name = "",
|
||||
const std::string& tex2Name = "");
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -252,6 +304,8 @@ enum EngineShadowType
|
|||
\brief Shadow drawn by the graphics engine */
|
||||
struct EngineShadow
|
||||
{
|
||||
//! If true, shadow is valid
|
||||
bool used;
|
||||
//! If true, shadow is invisible (object being carried for example)
|
||||
bool hide;
|
||||
//! Rank of the associated object
|
||||
|
@ -273,8 +327,17 @@ struct EngineShadow
|
|||
|
||||
EngineShadow()
|
||||
{
|
||||
LoadDefault();
|
||||
}
|
||||
|
||||
void LoadDefault()
|
||||
{
|
||||
used = false;
|
||||
hide = false;
|
||||
objRank = 0;
|
||||
type = Gfx::ENG_SHADOW_NORM;
|
||||
pos.LoadZero();
|
||||
normal.LoadZero();
|
||||
angle = radius = intensity = height = 0.0f;
|
||||
}
|
||||
};
|
||||
|
@ -284,6 +347,8 @@ struct EngineShadow
|
|||
\brief A spot (large shadow) drawn on the ground by the graphics engine */
|
||||
struct EngineGroundSpot
|
||||
{
|
||||
//! If true, ground spot is valid
|
||||
bool used;
|
||||
//! Color of the shadow
|
||||
Gfx::Color color;
|
||||
//! Min altitude
|
||||
|
@ -303,6 +368,15 @@ struct EngineGroundSpot
|
|||
|
||||
EngineGroundSpot()
|
||||
{
|
||||
LoadDefault();
|
||||
}
|
||||
|
||||
void LoadDefault()
|
||||
{
|
||||
used = false;
|
||||
color = Gfx::Color();
|
||||
pos.LoadZero();
|
||||
drawPos.LoadZero();
|
||||
min = max = smooth = radius = drawRadius = 0.0f;
|
||||
}
|
||||
};
|
||||
|
@ -355,12 +429,20 @@ struct EngineGroundMark
|
|||
char* table;
|
||||
|
||||
EngineGroundMark()
|
||||
{
|
||||
LoadDefault();
|
||||
}
|
||||
|
||||
void LoadDefault()
|
||||
{
|
||||
draw = false;
|
||||
phase = ENG_GR_MARK_PHASE_NULL;
|
||||
pos = Math::Vector();
|
||||
drawPos = Math::Vector();
|
||||
delay[0] = delay[1] = delay[2] = 0.0f;
|
||||
fix = radius = intensity = drawRadius = drawIntensity = 0.0f;
|
||||
dx = dy = 0;
|
||||
table = NULL;
|
||||
table = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -379,61 +461,6 @@ enum EngineTextureMapping
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
\enum EngineRenderState
|
||||
\brief Render state of graphics engine
|
||||
|
||||
States are used for settings certain modes, for instance texturing and blending.
|
||||
The enum is a bitmask and some of the states can be OR'd together. */
|
||||
enum EngineRenderState
|
||||
{
|
||||
//! Normal opaque materials
|
||||
ENG_RSTATE_NORMAL = 0,
|
||||
//! The transparent texture (black = no)
|
||||
ENG_RSTATE_TTEXTURE_BLACK = (1<<0),
|
||||
//! The transparent texture (white = no)
|
||||
ENG_RSTATE_TTEXTURE_WHITE = (1<<1),
|
||||
//! The transparent diffuse color
|
||||
ENG_RSTATE_TDIFFUSE = (1<<2),
|
||||
//! Texture wrap
|
||||
ENG_RSTATE_WRAP = (1<<3),
|
||||
//! Texture borders with solid color
|
||||
ENG_RSTATE_CLAMP = (1<<4),
|
||||
//! Light texture (ambient max)
|
||||
ENG_RSTATE_LIGHT = (1<<5),
|
||||
//! Double black texturing
|
||||
ENG_RSTATE_DUAL_BLACK = (1<<6),
|
||||
//! Double white texturing
|
||||
ENG_RSTATE_DUAL_WHITE = (1<<7),
|
||||
//! Part 1 (no change in. MOD!)
|
||||
ENG_RSTATE_PART1 = (1<<8),
|
||||
//! Part 2
|
||||
ENG_RSTATE_PART2 = (1<<9),
|
||||
//! Part 3
|
||||
ENG_RSTATE_PART3 = (1<<10),
|
||||
//! Part 4
|
||||
ENG_RSTATE_PART4 = (1<<11),
|
||||
//! Double-sided face
|
||||
ENG_RSTATE_2FACE = (1<<12),
|
||||
//! Image using alpha channel
|
||||
ENG_RSTATE_ALPHA = (1<<13),
|
||||
//! Always use 2nd floor texturing
|
||||
ENG_RSTATE_SECOND = (1<<14),
|
||||
//! Causes the fog
|
||||
ENG_RSTATE_FOG = (1<<15),
|
||||
//! The transparent color (black = no)
|
||||
ENG_RSTATE_TCOLOR_BLACK = (1<<16),
|
||||
//! The transparent color (white = no)
|
||||
ENG_RSTATE_TCOLOR_WHITE = (1<<17),
|
||||
//! Mode for rendering text
|
||||
ENG_RSTATE_TEXT = (1<<18),
|
||||
//! Only opaque texture, no blending, etc.
|
||||
ENG_RSTATE_OPAQUE_TEXTURE = (1<<19),
|
||||
//! Only opaque color, no texture, blending, etc.
|
||||
ENG_RSTATE_OPAQUE_COLOR = (1<<20)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
\enum EngineMouseType
|
||||
\brief Type of mouse cursor displayed in-game */
|
||||
|
@ -524,7 +551,7 @@ struct EngineMouse
|
|||
|
||||
The 3D scene is composed of objects which are basically collections of triangles forming
|
||||
a surface or simply independent triangles in space. Objects are stored in the engine
|
||||
as a tree structure which is composed of 5 tiers (EngineObjLevel1, EngineObjLevel2 and so on).
|
||||
as a tree structure which is composed of 4 tiers (EngineObjLevel1, EngineObjLevel2 and so on).
|
||||
Each tier stores some data about object triangle, like textures or materials used.
|
||||
Additional information on objects stored are in EngineObject structure.
|
||||
Each object is uniquely identified by its rank.
|
||||
|
@ -632,74 +659,129 @@ public:
|
|||
|
||||
/* *************** Object management *************** */
|
||||
|
||||
//! Creates a new object and returns its rank
|
||||
int CreateObject();
|
||||
//! Deletes all objects, shadows and ground spots
|
||||
void FlushObject();
|
||||
//! Deletes the given object
|
||||
bool DeleteObject(int objRank);
|
||||
bool SetDrawWorld(int objRank, bool draw);
|
||||
bool SetDrawFront(int objRank, bool draw);
|
||||
|
||||
bool AddTriangle(int objRank, Gfx::VertexTex2* vertex, int nb, const Gfx::Material& mat,
|
||||
int state, std::string texName1, std::string texName2,
|
||||
float min, float max, bool globalUpdate);
|
||||
bool AddSurface(int objRank, Gfx::VertexTex2* vertex, int nb, const Gfx::Material& mat,
|
||||
int state, std::string texName1, std::string texName2,
|
||||
float min, float max, bool globalUpdate);
|
||||
bool AddQuick(int objRank, const Gfx::EngineObjLevel5& buffer,
|
||||
std::string texName1, std::string texName2,
|
||||
float min, float max, bool globalUpdate);
|
||||
Gfx::EngineObjLevel5* SearchTriangle(int objRank, const Gfx::Material& mat,
|
||||
int state, std::string texName1, std::string texName2,
|
||||
float min, float max);
|
||||
|
||||
void ChangeLOD();
|
||||
bool ChangeSecondTexture(int objRank, const std::string& texName2);
|
||||
int GetTotalTriangles(int objRank);
|
||||
int GetTriangles(int objRank, float min, float max, Gfx::EngineTriangle* buffer, int size, float percent);
|
||||
bool GetBBox(int objRank, Math::Vector& min, Math::Vector& max);
|
||||
bool ChangeTextureMapping(int objRank, const Gfx::Material& mat, int state,
|
||||
const std::string& texName1, const std::string& texName2,
|
||||
float min, float max, Gfx::EngineTextureMapping mode,
|
||||
float au, float bu, float av, float bv);
|
||||
bool TrackTextureMapping(int objRank, const Gfx::Material& mat, int state,
|
||||
const std::string& texName1, const std::string& texName2,
|
||||
float min, float max, Gfx::EngineTextureMapping mode,
|
||||
float pos, float factor, float tl, float ts, float tt);
|
||||
bool SetObjectTransform(int objRank, const Math::Matrix& transform);
|
||||
bool GetObjectTransform(int objRank, Math::Matrix& transform);
|
||||
//@{
|
||||
//! Management of engine object type
|
||||
bool SetObjectType(int objRank, Gfx::EngineObjectType type);
|
||||
Gfx::EngineObjectType GetObjectType(int objRank);
|
||||
//@}
|
||||
|
||||
//@{
|
||||
//! Management of object transform
|
||||
bool SetObjectTransform(int objRank, const Math::Matrix& transform);
|
||||
bool GetObjectTransform(int objRank, Math::Matrix& transform);
|
||||
//@}
|
||||
|
||||
//! Sets drawWorld for given object
|
||||
bool SetObjectDrawWorld(int objRank, bool draw);
|
||||
//! Sets drawFront for given object
|
||||
bool SetObjectDrawFront(int objRank, bool draw);
|
||||
|
||||
//! Sets the transparency level for given object
|
||||
bool SetObjectTransparency(int objRank, float value);
|
||||
|
||||
bool ShadowCreate(int objRank);
|
||||
void ShadowDelete(int objRank);
|
||||
//! Returns the bounding box for an object
|
||||
bool GetObjectBBox(int objRank, Math::Vector& min, Math::Vector& max);
|
||||
|
||||
//! Returns the total number of triangles of given object
|
||||
int GetObjectTotalTriangles(int objRank);
|
||||
|
||||
//! Adds triangles to given object with the specified params
|
||||
bool AddTriangles(int objRank, const std::vector<Gfx::VertexTex2>& vertices,
|
||||
const Gfx::Material& material, int state,
|
||||
std::string tex1Name, std::string tex2Name,
|
||||
float min, float max, bool globalUpdate);
|
||||
|
||||
//! Adds a surface to given object with the specified params
|
||||
bool AddSurface(int objRank, const std::vector<Gfx::VertexTex2>& vertices,
|
||||
const Gfx::Material& material, int state,
|
||||
std::string tex1Name, std::string tex2Name,
|
||||
float min, float max, bool globalUpdate);
|
||||
|
||||
//! Adds a tier 4 engine object directly
|
||||
bool AddQuick(int objRank, const Gfx::EngineObjLevel4& buffer,
|
||||
std::string tex1Name, std::string tex2Name,
|
||||
float min, float max, bool globalUpdate);
|
||||
|
||||
//! Returns the first found tier 4 engine object for the given params or nullptr if not found
|
||||
Gfx::EngineObjLevel4* FindTriangles(int objRank, const Gfx::Material& material,
|
||||
int state, std::string tex1Name, std::string tex2Name,
|
||||
float min, float max);
|
||||
|
||||
//! Returns a partial list of triangles for given object
|
||||
int GetPartialTriangles(int objRank, float min, float max, float percent, int maxCount,
|
||||
std::vector<Gfx::EngineTriangle>& triangles);
|
||||
|
||||
//! Updates LOD after parameter or resolution change
|
||||
void ChangeLOD();
|
||||
|
||||
//! Changes the 2nd texure for given object
|
||||
bool ChangeSecondTexture(int objRank, const std::string& tex2Name);
|
||||
|
||||
//! Changes (recalculates) texture mapping for given object
|
||||
bool ChangeTextureMapping(int objRank, const Gfx::Material& mat, int state,
|
||||
const std::string& tex1Name, const std::string& tex2Name,
|
||||
float min, float max, Gfx::EngineTextureMapping mode,
|
||||
float au, float bu, float av, float bv);
|
||||
|
||||
//! Changes texture mapping for robot tracks
|
||||
bool TrackTextureMapping(int objRank, const Gfx::Material& mat, int state,
|
||||
const std::string& tex1Name, const std::string& tex2Name,
|
||||
float min, float max, Gfx::EngineTextureMapping mode,
|
||||
float pos, float factor, float tl, float ts, float tt);
|
||||
|
||||
|
||||
//! Creates a shadow for the given object
|
||||
bool CreateShadow(int objRank);
|
||||
//! Deletes the shadow for given object
|
||||
void DeleteShadow(int objRank);
|
||||
|
||||
//@{
|
||||
//! Management of different shadow params
|
||||
bool SetObjectShadowHide(int objRank, bool hide);
|
||||
bool SetObjectShadowType(int objRank, Gfx::EngineShadowType type);
|
||||
bool SetObjectShadowPos(int objRank, const Math::Vector& pos);
|
||||
bool SetObjectShadowNormal(int objRank, const Math::Vector& n);
|
||||
bool SetObjectShadowNormal(int objRank, const Math::Vector& normal);
|
||||
bool SetObjectShadowAngle(int objRank, float angle);
|
||||
bool SetObjectShadowRadius(int objRank, float radius);
|
||||
bool SetObjectShadowIntensity(int objRank, float intensity);
|
||||
bool SetObjectShadowHeight(int objRank, float h);
|
||||
bool SetObjectShadowHeight(int objRank, float height);
|
||||
float GetObjectShadowRadius(int objRank);
|
||||
//@}
|
||||
|
||||
//! Lists the ranks of objects and subobjects selected
|
||||
void SetHighlightRank(int* rankList);
|
||||
//! Returns the highlighted rectangle
|
||||
bool GetHighlight(Math::Point& p1, Math::Point& p2);
|
||||
|
||||
void GroundSpotFlush();
|
||||
int GroundSpotCreate();
|
||||
void GroundSpotDelete(int rank);
|
||||
//! Deletes all ground spots
|
||||
void FlushGroundSpot();
|
||||
//! Creates a new ground spot and returns its rank
|
||||
int CreateGroundSpot();
|
||||
//! Deletes the given ground spot
|
||||
void DeleteGroundSpot(int rank);
|
||||
|
||||
//@{
|
||||
//! Management of different ground spot params
|
||||
bool SetObjectGroundSpotPos(int rank, const Math::Vector& pos);
|
||||
bool SetObjectGroundSpotRadius(int rank, float radius);
|
||||
bool SetObjectGroundSpotColor(int rank, const Gfx::Color& color);
|
||||
bool SetObjectGroundSpotMinMax(int rank, float min, float max);
|
||||
bool SetObjectGroundSpotSmooth(int rank, float smooth);
|
||||
//@}
|
||||
|
||||
int GroundMarkCreate(Math::Vector pos, float radius,
|
||||
//! Creates the ground mark with the given params
|
||||
void CreateGroundMark(Math::Vector pos, float radius,
|
||||
float delay1, float delay2, float delay3,
|
||||
int dx, int dy, char* table);
|
||||
bool GroundMarkDelete(int rank);
|
||||
//! Deletes the ground mark
|
||||
void DeleteGroundMark(int rank);
|
||||
|
||||
//! Updates the state after creating objects
|
||||
void Update();
|
||||
|
@ -717,22 +799,23 @@ public:
|
|||
void SetViewParams(const Math::Vector& eyePt, const Math::Vector& lookatPt,
|
||||
const Math::Vector& upVec, float eyeDistance);
|
||||
|
||||
//! Creates texture with the specified params
|
||||
Gfx::Texture CreateTexture(const std::string& texName,
|
||||
const Gfx::TextureCreateParams& params);
|
||||
//! Creates texture
|
||||
Gfx::Texture CreateTexture(const std::string& texName);
|
||||
|
||||
//! Destroys texture, unloading it and removing from cache
|
||||
void DestroyTexture(const std::string& texName);
|
||||
|
||||
//! Loads texture, creating it if not already present
|
||||
bool LoadTexture(const std::string& name);
|
||||
Gfx::Texture LoadTexture(const std::string& name);
|
||||
//! Loads texture, creating it with given params if not already present
|
||||
Gfx::Texture LoadTexture(const std::string& name, const Gfx::TextureCreateParams& params);
|
||||
//! Loads all necessary textures
|
||||
bool LoadAllTextures();
|
||||
|
||||
//! Sets texture for given stage; if not present in cache, the texture is loaded
|
||||
/** If loading fails, returns false. */
|
||||
bool SetTexture(const std::string& name, int stage = 0);
|
||||
//! Sets texture for given stage
|
||||
void SetTexture(const Gfx::Texture& tex, int stage = 0);
|
||||
|
||||
//! Deletes the given texture, unloading it and removing from cache
|
||||
void DeleteTexture(const std::string& name);
|
||||
//! Deletes the given texture, unloading it and removing from cache
|
||||
void DeleteTexture(const Gfx::Texture& tex);
|
||||
|
||||
//@{
|
||||
//! Border management (distance limits) depends of the resolution (LOD = level-of-detail)
|
||||
|
@ -1005,7 +1088,7 @@ protected:
|
|||
//! Draws the gradient background
|
||||
void DrawBackgroundGradient(const Gfx::Color& up, const Gfx::Color& down);
|
||||
//! Draws a portion of the image background
|
||||
void DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, const std::string& name);
|
||||
void DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, const Gfx::Texture &tex);
|
||||
//! Draws the image background
|
||||
void DrawBackgroundImage();
|
||||
//! Draws all the planets
|
||||
|
@ -1021,6 +1104,19 @@ protected:
|
|||
//! Draw part of mouse cursor sprite
|
||||
void DrawMouseSprite(Math::Point pos, Math::Point dim, int icon);
|
||||
|
||||
//! Creates new tier 1 object
|
||||
Gfx::EngineObjLevel1& AddLevel1(const std::string& tex1Name, const std::string& tex2Name);
|
||||
//! Creates a new tier 2 object
|
||||
Gfx::EngineObjLevel2& AddLevel2(Gfx::EngineObjLevel1 &p1, int objRank);
|
||||
//! Creates a new tier 3 object
|
||||
Gfx::EngineObjLevel3& AddLevel3(Gfx::EngineObjLevel2 &p2, float min, float max);
|
||||
//! Creates a new tier 4 object
|
||||
Gfx::EngineObjLevel4& AddLevel4(Gfx::EngineObjLevel3 &p3, Gfx::EngineTriangleType type,
|
||||
const Gfx::Material& mat, int state);
|
||||
|
||||
//! Create texture and add it to cache
|
||||
Gfx::Texture CreateTexture(const std::string &texName, const Gfx::TextureCreateParams ¶ms);
|
||||
|
||||
//! Tests whether the given object is visible
|
||||
bool IsVisible(int objRank);
|
||||
|
||||
|
@ -1044,7 +1140,7 @@ protected:
|
|||
//! Calculates the distances between the viewpoint and the origin of different objects
|
||||
void ComputeDistance();
|
||||
|
||||
//! Updates all the geometric parameters of objects
|
||||
//! Updates geometric parameters of objects (bounding box and radius)
|
||||
void UpdateGeometry();
|
||||
|
||||
protected:
|
||||
|
@ -1130,17 +1226,21 @@ protected:
|
|||
bool m_fog;
|
||||
bool m_firstGroundSpot;
|
||||
int m_secondTexNum;
|
||||
bool m_backgroundFull;
|
||||
bool m_backgroundQuarter;
|
||||
std::string m_backgroundName;
|
||||
std::string m_backgroundQuarterNames[4];
|
||||
Gfx::Texture m_backgroundFullTex;
|
||||
Gfx::Texture m_backgroundQuarterTexs[4];
|
||||
Gfx::Color m_backgroundColorUp;
|
||||
Gfx::Color m_backgroundColorDown;
|
||||
Gfx::Color m_backgroundCloudUp;
|
||||
Gfx::Color m_backgroundCloudDown;
|
||||
bool m_backgroundFull;
|
||||
bool m_backgroundQuarter;
|
||||
bool m_overFront;
|
||||
Gfx::Color m_overColor;
|
||||
int m_overMode;
|
||||
std::string m_foregroundName;
|
||||
Gfx::Texture m_foregroundTex;
|
||||
bool m_drawWorld;
|
||||
bool m_drawFront;
|
||||
float m_limitLOD[2];
|
||||
|
|
|
@ -24,66 +24,66 @@
|
|||
|
||||
Gfx::CLightning::CLightning(CInstanceManager* iMan, Gfx::CEngine* engine)
|
||||
{
|
||||
GetLogger()->Info("CLightning::CLightning() stub!\n");
|
||||
GetLogger()->Trace("CLightning::CLightning() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
Gfx::CLightning::~CLightning()
|
||||
{
|
||||
GetLogger()->Info("CLightning::~CLightning() stub!\n");
|
||||
GetLogger()->Trace("CLightning::~CLightning() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CLightning::Flush()
|
||||
{
|
||||
GetLogger()->Info("CLightning::Flush() stub!\n");
|
||||
GetLogger()->Trace("CLightning::Flush() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CLightning::EventProcess(const Event &event)
|
||||
{
|
||||
GetLogger()->Info("CLightning::EventProcess() stub!\n");
|
||||
GetLogger()->Trace("CLightning::EventProcess() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Gfx::CLightning::Create(float sleep, float delay, float magnetic)
|
||||
{
|
||||
GetLogger()->Info("CLightning::Create() stub!\n");
|
||||
GetLogger()->Trace("CLightning::Create() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Gfx::CLightning::GetStatus(float &sleep, float &delay, float &magnetic, float &progress)
|
||||
{
|
||||
GetLogger()->Info("CLightning::GetStatus() stub!\n");
|
||||
GetLogger()->Trace("CLightning::GetStatus() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Gfx::CLightning::SetStatus(float sleep, float delay, float magnetic, float progress)
|
||||
{
|
||||
GetLogger()->Info("CLightning::SetStatus() stub!\n");
|
||||
GetLogger()->Trace("CLightning::SetStatus() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gfx::CLightning::Draw()
|
||||
{
|
||||
GetLogger()->Info("CLightning::Draw() stub!\n");
|
||||
GetLogger()->Trace("CLightning::Draw() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CLightning::EventFrame(const Event &event)
|
||||
{
|
||||
GetLogger()->Info("CLightning::EventFrame() stub!\n");
|
||||
GetLogger()->Trace("CLightning::EventFrame() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
CObject* Gfx::CLightning::SearchObject(Math::Vector pos)
|
||||
{
|
||||
GetLogger()->Info("CLightning::SearchObject() stub!\n");
|
||||
GetLogger()->Trace("CLightning::SearchObject() stub!\n");
|
||||
// TODO!
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -24,31 +24,31 @@
|
|||
|
||||
Gfx::CParticle::CParticle(CInstanceManager* iMan, Gfx::CEngine* engine)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
Gfx::CParticle::~CParticle()
|
||||
{
|
||||
GetLogger()->Info("CParticle::~CParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::~CParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetDevice(Gfx::CDevice* device)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetDevice() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetDevice() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::FlushParticle()
|
||||
{
|
||||
GetLogger()->Info("CParticle::FlushParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::FlushParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::FlushParticle(int sheet)
|
||||
{
|
||||
GetLogger()->Info("CParticle::FlushParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::FlushParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ int Gfx::CParticle::CreateParticle(Math::Vector pos, Math::Vector speed, Math::P
|
|||
Gfx::ParticleType type, float duration, float mass,
|
||||
float windSensitivity, int sheet)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CreateParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CreateParticle() stub!\n");
|
||||
// TODO!
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ int Gfx::CParticle::CreateFrag(Math::Vector pos, Math::Vector speed, Gfx::Engine
|
|||
Gfx::ParticleType type, float duration, float mass,
|
||||
float windSensitivity, int sheet)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CreateFrag() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CreateFrag() stub!\n");
|
||||
// TODO!
|
||||
return 0;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ int Gfx::CParticle::CreatePart(Math::Vector pos, Math::Vector speed, Gfx::Partic
|
|||
float duration, float mass, float weight,
|
||||
float windSensitivity, int sheet)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CreatePart() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CreatePart() stub!\n");
|
||||
// TODO!
|
||||
return 0;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ int Gfx::CParticle::CreatePart(Math::Vector pos, Math::Vector speed, Gfx::Partic
|
|||
int Gfx::CParticle::CreateRay(Math::Vector pos, Math::Vector goal, Gfx::ParticleType type, Math::Point dim,
|
||||
float duration, int sheet)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CreateRay() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CreateRay() stub!\n");
|
||||
// TODO!
|
||||
return 0;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ int Gfx::CParticle::CreateRay(Math::Vector pos, Math::Vector goal, Gfx::Particle
|
|||
int Gfx::CParticle::CreateTrack(Math::Vector pos, Math::Vector speed, Math::Point dim, Gfx::ParticleType type,
|
||||
float duration, float mass, float length, float width)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CreateTrack() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CreateTrack() stub!\n");
|
||||
// TODO!
|
||||
return 0;
|
||||
}
|
||||
|
@ -98,205 +98,205 @@ int Gfx::CParticle::CreateTrack(Math::Vector pos, Math::Vector speed, Math::Poin
|
|||
void Gfx::CParticle::CreateWheelTrace(const Math::Vector &p1, const Math::Vector &p2, const Math::Vector &p3,
|
||||
const Math::Vector &p4, Gfx::ParticleType type)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CreateWheelTrace() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CreateWheelTrace() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DeleteParticle(Gfx::ParticleType type)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DeleteParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DeleteParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DeleteParticle(int channel)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DeleteParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DeleteParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetObjectLink(int channel, CObject *object)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetObjectLink() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetObjectLink() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetObjectFather(int channel, CObject *object)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetObjectFather() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetObjectFather() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetPosition(int channel, Math::Vector pos)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetPosition() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetPosition() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetDimension(int channel, Math::Point dim)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetDimension() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetDimension() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetZoom(int channel, float zoom)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetZoom() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetZoom() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetAngle(int channel, float angle)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetAngle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetAngle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetIntensity(int channel, float intensity)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetIntensity() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetIntensity() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetParam(int channel, Math::Vector pos, Math::Point dim, float zoom, float angle, float intensity)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetParam() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetParam() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetPhase(int channel, Gfx::ParticlePhase phase, float duration)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetPhase() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetPhase() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CParticle::GetPosition(int channel, Math::Vector &pos)
|
||||
{
|
||||
GetLogger()->Info("CParticle::GetPosition() stub!\n");
|
||||
GetLogger()->Trace("CParticle::GetPosition() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
Gfx::Color Gfx::CParticle::GetFogColor(Math::Vector pos)
|
||||
{
|
||||
GetLogger()->Info("CParticle::GetFogColor() stub!\n");
|
||||
GetLogger()->Trace("CParticle::GetFogColor() stub!\n");
|
||||
// TODO!
|
||||
return Gfx::Color();
|
||||
}
|
||||
|
||||
void Gfx::CParticle::SetFrameUpdate(int sheet, bool update)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SetFrameUpdate() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SetFrameUpdate() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::FrameParticle(float rTime)
|
||||
{
|
||||
GetLogger()->Info("CParticle::FrameParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::FrameParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticle(int sheet)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CParticle::WriteWheelTrace(char *filename, int width, int height, Math::Vector dl, Math::Vector ur)
|
||||
{
|
||||
GetLogger()->Info("CParticle::WriteWheelTrace() stub!\n");
|
||||
GetLogger()->Trace("CParticle::WriteWheelTrace() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DeleteRank(int rank)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DeleteRank() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DeleteRank() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CParticle::CheckChannel(int &channel)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CheckChannel() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CheckChannel() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleTriangle(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleTriangle() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleTriangle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleNorm(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleNorm() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleNorm() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleFlat(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleFlat() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleFlat() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleFog(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleFog() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleFog() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleRay(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleRay() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleRay() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleSphere(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleSphere() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleSphere() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleCylinder(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleCylinder() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleCylinder() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CParticle::DrawParticleWheel(int i)
|
||||
{
|
||||
GetLogger()->Info("CParticle::DrawParticleWheel() stub!\n");
|
||||
GetLogger()->Trace("CParticle::DrawParticleWheel() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
CObject* Gfx::CParticle::SearchObjectGun(Math::Vector old, Math::Vector pos, Gfx::ParticleType type, CObject *father)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SearchObjectGun() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SearchObjectGun() stub!\n");
|
||||
// TODO!
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CObject* Gfx::CParticle::SearchObjectRay(Math::Vector pos, Math::Vector goal, Gfx::ParticleType type, CObject *father)
|
||||
{
|
||||
GetLogger()->Info("CParticle::SearchObjectRay() stub!\n");
|
||||
GetLogger()->Trace("CParticle::SearchObjectRay() stub!\n");
|
||||
// TODO!
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Gfx::CParticle::Play(Sound sound, Math::Vector pos, float amplitude)
|
||||
{
|
||||
GetLogger()->Info("CParticle::Play() stub!\n");
|
||||
GetLogger()->Trace("CParticle::Play() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CParticle::TrackMove(int i, Math::Vector pos, float progress)
|
||||
{
|
||||
GetLogger()->Info("CParticle::TrackMove() stub!\n");
|
||||
GetLogger()->Trace("CParticle::TrackMove() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gfx::CParticle::TrackDraw(int i, Gfx::ParticleType type)
|
||||
{
|
||||
GetLogger()->Info("CParticle::TrackDraw() stub!\n");
|
||||
GetLogger()->Trace("CParticle::TrackDraw() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ struct Planet
|
|||
std::string name;
|
||||
//! Texture mapping
|
||||
Math::Point uv1, uv2;
|
||||
|
||||
// TODO: make all textures transparent?
|
||||
//! Transparent texture
|
||||
bool transparent;
|
||||
|
||||
|
|
|
@ -24,156 +24,156 @@
|
|||
|
||||
Gfx::CPyro::CPyro(CInstanceManager* iMan)
|
||||
{
|
||||
GetLogger()->Info("CParticle::CPyro() stub!\n");
|
||||
GetLogger()->Trace("CParticle::CPyro() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
Gfx::CPyro::~CPyro()
|
||||
{
|
||||
GetLogger()->Info("CPyro::~CPyro() stub!");
|
||||
GetLogger()->Trace("CPyro::~CPyro() stub!");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::DeleteObject(bool all)
|
||||
{
|
||||
GetLogger()->Info("CPyro::DeleteObject() stub!");
|
||||
GetLogger()->Trace("CPyro::DeleteObject() stub!");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CPyro::Create(Gfx::PyroType type, CObject* pObj, float force)
|
||||
{
|
||||
GetLogger()->Info("CPyro::Create() stub!");
|
||||
GetLogger()->Trace("CPyro::Create() stub!");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Gfx::CPyro::EventProcess(const Event &event)
|
||||
{
|
||||
GetLogger()->Info("CPyro::EventProcess() stub!\n");
|
||||
GetLogger()->Trace("CPyro::EventProcess() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
Error Gfx::CPyro::IsEnded()
|
||||
{
|
||||
GetLogger()->Info("CPyro::IsEnded() stub!\n");
|
||||
GetLogger()->Trace("CPyro::IsEnded() stub!\n");
|
||||
// TODO!
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void Gfx::CPyro::CutObjectLink(CObject* pObj)
|
||||
{
|
||||
GetLogger()->Info("CPyro::CutObjectLink() stub!\n");
|
||||
GetLogger()->Trace("CPyro::CutObjectLink() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::DisplayError(PyroType type, CObject* pObj)
|
||||
{
|
||||
GetLogger()->Info("CPyro::DisplayError() stub!\n");
|
||||
GetLogger()->Trace("CPyro::DisplayError() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CPyro::CreateLight(Math::Vector pos, float height)
|
||||
{
|
||||
GetLogger()->Info("CPyro::CreateLight() stub!\n");
|
||||
GetLogger()->Trace("CPyro::CreateLight() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gfx::CPyro::DeleteObject(bool primary, bool secondary)
|
||||
{
|
||||
GetLogger()->Info("CPyro::DeleteObject() stub!\n");
|
||||
GetLogger()->Trace("CPyro::DeleteObject() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::CreateTriangle(CObject* pObj, ObjectType oType, int part)
|
||||
{
|
||||
GetLogger()->Info("CPyro::CreateTriangle() stub!\n");
|
||||
GetLogger()->Trace("CPyro::CreateTriangle() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::ExploStart()
|
||||
{
|
||||
GetLogger()->Info("CPyro::ExploStart() stub!\n");
|
||||
GetLogger()->Trace("CPyro::ExploStart() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
void Gfx::CPyro::ExploTerminate()
|
||||
{
|
||||
GetLogger()->Info("CPyro::ExploTerminate() stub!\n");
|
||||
GetLogger()->Trace("CPyro::ExploTerminate() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::BurnStart()
|
||||
{
|
||||
GetLogger()->Info("CPyro::BurnStart() stub!\n");
|
||||
GetLogger()->Trace("CPyro::BurnStart() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::BurnAddPart(int part, Math::Vector pos, Math::Vector angle)
|
||||
{
|
||||
GetLogger()->Info("CPyro::BurnAddPart() stub!\n");
|
||||
GetLogger()->Trace("CPyro::BurnAddPart() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::BurnProgress()
|
||||
{
|
||||
GetLogger()->Info("CPyro::BurnProgress() stub!\n");
|
||||
GetLogger()->Trace("CPyro::BurnProgress() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
bool Gfx::CPyro::BurnIsKeepPart(int part)
|
||||
{
|
||||
GetLogger()->Info("CPyro::BurnIsKeepPart() stub!\n");
|
||||
GetLogger()->Trace("CPyro::BurnIsKeepPart() stub!\n");
|
||||
// TODO!
|
||||
return true;
|
||||
}
|
||||
|
||||
void Gfx::CPyro::BurnTerminate()
|
||||
{
|
||||
GetLogger()->Info("CPyro::BurnTerminate() stub!\n");
|
||||
GetLogger()->Trace("CPyro::BurnTerminate() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::FallStart()
|
||||
{
|
||||
GetLogger()->Info("CPyro::FallStart() stub!\n");
|
||||
GetLogger()->Trace("CPyro::FallStart() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
CObject* Gfx::CPyro::FallSearchBeeExplo()
|
||||
{
|
||||
GetLogger()->Info("CPyro::FallSearchBeeExplo() stub!\n");
|
||||
GetLogger()->Trace("CPyro::FallSearchBeeExplo() stub!\n");
|
||||
// TODO!
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Gfx::CPyro::FallProgress(float rTime)
|
||||
{
|
||||
GetLogger()->Info("CPyro::FallProgress() stub!\n");
|
||||
GetLogger()->Trace("CPyro::FallProgress() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
Error Gfx::CPyro::FallIsEnded()
|
||||
{
|
||||
GetLogger()->Info("CPyro::FallIsEnded() stub!\n");
|
||||
GetLogger()->Trace("CPyro::FallIsEnded() stub!\n");
|
||||
// TODO!
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void Gfx::CPyro::LightOperFlush()
|
||||
{
|
||||
GetLogger()->Info("CPyro::LightOperFlush() stub!\n");
|
||||
GetLogger()->Trace("CPyro::LightOperFlush() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::LightOperAdd(float progress, float intensity, float r, float g, float b)
|
||||
{
|
||||
GetLogger()->Info("CPyro::LightOperAdd() stub!\n");
|
||||
GetLogger()->Trace("CPyro::LightOperAdd() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
||||
void Gfx::CPyro::LightOperFrame(float rTime)
|
||||
{
|
||||
GetLogger()->Info("CPyro::LightOperFrame() stub!\n");
|
||||
GetLogger()->Trace("CPyro::LightOperFrame() stub!\n");
|
||||
// TODO!
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ Gfx::CTerrain::CTerrain(CInstanceManager* iMan)
|
|||
m_wind = Math::Vector(0.0f, 0.0f, 0.0f);
|
||||
m_defHardness = 0.5f;
|
||||
|
||||
m_levelMat.reserve(LEVEL_MAT_PREALLOCATE_COUNT);
|
||||
m_levelMats.reserve(LEVEL_MAT_PREALLOCATE_COUNT);
|
||||
m_flyingLimits.reserve(FLYING_LIMIT_PREALLOCATE_COUNT);
|
||||
m_buildingLevels.reserve(BUILDING_LEVEL_PREALLOCATE_COUNT);
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ bool Gfx::CTerrain::InitTextures(const std::string& baseName, int* table, int dx
|
|||
|
||||
void Gfx::CTerrain::LevelFlush()
|
||||
{
|
||||
m_levelMat.clear();
|
||||
m_levelMats.clear();
|
||||
m_levelMatMax = 0;
|
||||
m_levelID = 1000;
|
||||
LevelCloseTable();
|
||||
|
@ -200,7 +200,7 @@ void Gfx::CTerrain::LevelMaterial(int id, std::string& baseName, float u, float
|
|||
tm.mat[3] = left;
|
||||
tm.hardness = hardness;
|
||||
|
||||
m_levelMat.push_back(tm);
|
||||
m_levelMats.push_back(tm);
|
||||
|
||||
if (m_levelMatMax < up+1 ) m_levelMatMax = up+1;
|
||||
if (m_levelMatMax < right+1) m_levelMatMax = right+1;
|
||||
|
@ -583,10 +583,10 @@ bool Gfx::CTerrain::CreateMosaic(int ox, int oy, int step, int objRank,
|
|||
|
||||
for (int y = 0; y < brick; y += step)
|
||||
{
|
||||
Gfx::EngineObjLevel5 buffer;
|
||||
Gfx::EngineObjLevel4 buffer;
|
||||
buffer.vertices.reserve(total);
|
||||
|
||||
buffer.type = Gfx::ENG_TRIANGLE_TYPE_6S;
|
||||
buffer.type = Gfx::ENG_TRIANGLE_TYPE_SURFACE;
|
||||
buffer.material = mat;
|
||||
|
||||
buffer.state = Gfx::ENG_RSTATE_WRAP;
|
||||
|
@ -695,10 +695,10 @@ bool Gfx::CTerrain::CreateMosaic(int ox, int oy, int step, int objRank,
|
|||
|
||||
Gfx::TerrainMaterial* Gfx::CTerrain::LevelSearchMat(int id)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>( m_levelMat.size() ); i++)
|
||||
for (int i = 0; i < static_cast<int>( m_levelMats.size() ); i++)
|
||||
{
|
||||
if (id == m_levelMat[i].id)
|
||||
return &m_levelMat[i];
|
||||
if (id == m_levelMats[i].id)
|
||||
return &m_levelMats[i];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -709,7 +709,7 @@ void Gfx::CTerrain::LevelTextureName(int x, int y, std::string& name, Math::Poin
|
|||
x /= m_brick/m_subdivMapping;
|
||||
y /= m_brick/m_subdivMapping;
|
||||
|
||||
TerrainMaterial* tm = LevelSearchMat(m_levelDot[x+y*m_levelDotSize].id);
|
||||
TerrainMaterial* tm = LevelSearchMat(m_levelDots[x+y*m_levelDotSize].id);
|
||||
if (tm == nullptr)
|
||||
{
|
||||
name = "xxx.png";
|
||||
|
@ -777,16 +777,16 @@ bool Gfx::CTerrain::LevelGetDot(int x, int y, float min, float max, float slope)
|
|||
}
|
||||
|
||||
|
||||
/** Returns the index within m_levelMat or -1 if there is not.
|
||||
m_levelMat[i].id gives the identifier. */
|
||||
/** Returns the index within m_levelMats or -1 if there is not.
|
||||
m_levelMats[i].id gives the identifier. */
|
||||
int Gfx::CTerrain::LevelTestMat(char *mat)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>( m_levelMat.size() ); i++)
|
||||
for (int i = 0; i < static_cast<int>( m_levelMats.size() ); i++)
|
||||
{
|
||||
if ( m_levelMat[i].mat[0] == mat[0] &&
|
||||
m_levelMat[i].mat[1] == mat[1] &&
|
||||
m_levelMat[i].mat[2] == mat[2] &&
|
||||
m_levelMat[i].mat[3] == mat[3] ) return i;
|
||||
if ( m_levelMats[i].mat[0] == mat[0] &&
|
||||
m_levelMats[i].mat[1] == mat[1] &&
|
||||
m_levelMats[i].mat[2] == mat[2] &&
|
||||
m_levelMats[i].mat[3] == mat[3] ) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -804,27 +804,27 @@ void Gfx::CTerrain::LevelSetDot(int x, int y, int id, char *mat)
|
|||
{
|
||||
int ii = LevelTestMat(mat);
|
||||
if (ii == -1) return;
|
||||
id = m_levelMat[ii].id; // looking for a id compatible with mat
|
||||
id = m_levelMats[ii].id; // looking for a id compatible with mat
|
||||
}
|
||||
|
||||
// Changes the point
|
||||
m_levelDot[x+y*m_levelDotSize].id = id;
|
||||
m_levelDot[x+y*m_levelDotSize].mat[0] = mat[0];
|
||||
m_levelDot[x+y*m_levelDotSize].mat[1] = mat[1];
|
||||
m_levelDot[x+y*m_levelDotSize].mat[2] = mat[2];
|
||||
m_levelDot[x+y*m_levelDotSize].mat[3] = mat[3];
|
||||
m_levelDots[x+y*m_levelDotSize].id = id;
|
||||
m_levelDots[x+y*m_levelDotSize].mat[0] = mat[0];
|
||||
m_levelDots[x+y*m_levelDotSize].mat[1] = mat[1];
|
||||
m_levelDots[x+y*m_levelDotSize].mat[2] = mat[2];
|
||||
m_levelDots[x+y*m_levelDotSize].mat[3] = mat[3];
|
||||
|
||||
// Changes the lower neighbor
|
||||
if ( (x+0) >= 0 && (x+0) < m_levelDotSize &&
|
||||
(y-1) >= 0 && (y-1) < m_levelDotSize )
|
||||
{
|
||||
int i = (x+0)+(y-1)*m_levelDotSize;
|
||||
if (m_levelDot[i].mat[0] != mat[2])
|
||||
if (m_levelDots[i].mat[0] != mat[2])
|
||||
{
|
||||
m_levelDot[i].mat[0] = mat[2];
|
||||
int ii = LevelTestMat(m_levelDot[i].mat);
|
||||
m_levelDots[i].mat[0] = mat[2];
|
||||
int ii = LevelTestMat(m_levelDots[i].mat);
|
||||
if (ii != -1)
|
||||
m_levelDot[i].id = m_levelMat[ii].id;
|
||||
m_levelDots[i].id = m_levelMats[ii].id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -833,12 +833,12 @@ void Gfx::CTerrain::LevelSetDot(int x, int y, int id, char *mat)
|
|||
(y+0) >= 0 && (y+0) < m_levelDotSize )
|
||||
{
|
||||
int i = (x-1)+(y+0)*m_levelDotSize;
|
||||
if (m_levelDot[i].mat[1] != mat[3])
|
||||
if (m_levelDots[i].mat[1] != mat[3])
|
||||
{
|
||||
m_levelDot[i].mat[1] = mat[3];
|
||||
int ii = LevelTestMat(m_levelDot[i].mat);
|
||||
m_levelDots[i].mat[1] = mat[3];
|
||||
int ii = LevelTestMat(m_levelDots[i].mat);
|
||||
if (ii != -1)
|
||||
m_levelDot[i].id = m_levelMat[ii].id;
|
||||
m_levelDots[i].id = m_levelMats[ii].id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -847,12 +847,12 @@ void Gfx::CTerrain::LevelSetDot(int x, int y, int id, char *mat)
|
|||
(y+1) >= 0 && (y+1) < m_levelDotSize )
|
||||
{
|
||||
int i = (x+0)+(y+1)*m_levelDotSize;
|
||||
if (m_levelDot[i].mat[2] != mat[0])
|
||||
if (m_levelDots[i].mat[2] != mat[0])
|
||||
{
|
||||
m_levelDot[i].mat[2] = mat[0];
|
||||
int ii = LevelTestMat(m_levelDot[i].mat);
|
||||
m_levelDots[i].mat[2] = mat[0];
|
||||
int ii = LevelTestMat(m_levelDots[i].mat);
|
||||
if (ii != -1)
|
||||
m_levelDot[i].id = m_levelMat[ii].id;
|
||||
m_levelDots[i].id = m_levelMats[ii].id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -861,12 +861,12 @@ void Gfx::CTerrain::LevelSetDot(int x, int y, int id, char *mat)
|
|||
(y+0) >= 0 && (y+0) < m_levelDotSize )
|
||||
{
|
||||
int i = (x+1)+(y+0)*m_levelDotSize;
|
||||
if ( m_levelDot[i].mat[3] != mat[1] )
|
||||
if ( m_levelDots[i].mat[3] != mat[1] )
|
||||
{
|
||||
m_levelDot[i].mat[3] = mat[1];
|
||||
int ii = LevelTestMat(m_levelDot[i].mat);
|
||||
m_levelDots[i].mat[3] = mat[1];
|
||||
int ii = LevelTestMat(m_levelDots[i].mat);
|
||||
if (ii != -1)
|
||||
m_levelDot[i].id = m_levelMat[ii].id;
|
||||
m_levelDots[i].id = m_levelMats[ii].id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -880,9 +880,9 @@ bool Gfx::CTerrain::LevelIfDot(int x, int y, int id, char *mat)
|
|||
y-1 >= 0 && y-1 < m_levelDotSize )
|
||||
{
|
||||
test[0] = mat[2];
|
||||
test[1] = m_levelDot[(x+0)+(y-1)*m_levelDotSize].mat[1];
|
||||
test[2] = m_levelDot[(x+0)+(y-1)*m_levelDotSize].mat[2];
|
||||
test[3] = m_levelDot[(x+0)+(y-1)*m_levelDotSize].mat[3];
|
||||
test[1] = m_levelDots[(x+0)+(y-1)*m_levelDotSize].mat[1];
|
||||
test[2] = m_levelDots[(x+0)+(y-1)*m_levelDotSize].mat[2];
|
||||
test[3] = m_levelDots[(x+0)+(y-1)*m_levelDotSize].mat[3];
|
||||
|
||||
if ( LevelTestMat(test) == -1 ) return false;
|
||||
}
|
||||
|
@ -891,10 +891,10 @@ bool Gfx::CTerrain::LevelIfDot(int x, int y, int id, char *mat)
|
|||
if ( x-1 >= 0 && x-1 < m_levelDotSize &&
|
||||
y+0 >= 0 && y+0 < m_levelDotSize )
|
||||
{
|
||||
test[0] = m_levelDot[(x-1)+(y+0)*m_levelDotSize].mat[0];
|
||||
test[0] = m_levelDots[(x-1)+(y+0)*m_levelDotSize].mat[0];
|
||||
test[1] = mat[3];
|
||||
test[2] = m_levelDot[(x-1)+(y+0)*m_levelDotSize].mat[2];
|
||||
test[3] = m_levelDot[(x-1)+(y+0)*m_levelDotSize].mat[3];
|
||||
test[2] = m_levelDots[(x-1)+(y+0)*m_levelDotSize].mat[2];
|
||||
test[3] = m_levelDots[(x-1)+(y+0)*m_levelDotSize].mat[3];
|
||||
|
||||
if ( LevelTestMat(test) == -1 ) return false;
|
||||
}
|
||||
|
@ -903,10 +903,10 @@ bool Gfx::CTerrain::LevelIfDot(int x, int y, int id, char *mat)
|
|||
if ( x+0 >= 0 && x+0 < m_levelDotSize &&
|
||||
y+1 >= 0 && y+1 < m_levelDotSize )
|
||||
{
|
||||
test[0] = m_levelDot[(x+0)+(y+1)*m_levelDotSize].mat[0];
|
||||
test[1] = m_levelDot[(x+0)+(y+1)*m_levelDotSize].mat[1];
|
||||
test[0] = m_levelDots[(x+0)+(y+1)*m_levelDotSize].mat[0];
|
||||
test[1] = m_levelDots[(x+0)+(y+1)*m_levelDotSize].mat[1];
|
||||
test[2] = mat[0];
|
||||
test[3] = m_levelDot[(x+0)+(y+1)*m_levelDotSize].mat[3];
|
||||
test[3] = m_levelDots[(x+0)+(y+1)*m_levelDotSize].mat[3];
|
||||
|
||||
if ( LevelTestMat(test) == -1 ) return false;
|
||||
}
|
||||
|
@ -915,9 +915,9 @@ bool Gfx::CTerrain::LevelIfDot(int x, int y, int id, char *mat)
|
|||
if ( x+1 >= 0 && x+1 < m_levelDotSize &&
|
||||
y+0 >= 0 && y+0 < m_levelDotSize )
|
||||
{
|
||||
test[0] = m_levelDot[(x+1)+(y+0)*m_levelDotSize].mat[0];
|
||||
test[1] = m_levelDot[(x+1)+(y+0)*m_levelDotSize].mat[1];
|
||||
test[2] = m_levelDot[(x+1)+(y+0)*m_levelDotSize].mat[2];
|
||||
test[0] = m_levelDots[(x+1)+(y+0)*m_levelDotSize].mat[0];
|
||||
test[1] = m_levelDots[(x+1)+(y+0)*m_levelDotSize].mat[1];
|
||||
test[2] = m_levelDots[(x+1)+(y+0)*m_levelDotSize].mat[2];
|
||||
test[3] = mat[1];
|
||||
|
||||
if ( LevelTestMat(test) == -1 ) return false;
|
||||
|
@ -1094,10 +1094,10 @@ bool Gfx::CTerrain::LevelInit(int id)
|
|||
|
||||
for (int i = 0; i < m_levelDotSize*m_levelDotSize; i++)
|
||||
{
|
||||
m_levelDot[i].id = id;
|
||||
m_levelDots[i].id = id;
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
m_levelDot[i].mat[j] = tm->mat[j];
|
||||
m_levelDots[i].mat[j] = tm->mat[j];
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1186,21 +1186,21 @@ bool Gfx::CTerrain::LevelGenerate(int *id, float min, float max,
|
|||
void Gfx::CTerrain::LevelOpenTable()
|
||||
{
|
||||
if (! m_levelText) return;
|
||||
if (! m_levelDot.empty()) return; // already allocated
|
||||
if (! m_levelDots.empty()) return; // already allocated
|
||||
|
||||
m_levelDotSize = (m_mosaic*m_brick)/(m_brick/m_subdivMapping)+1;
|
||||
std::vector<Gfx::DotLevel>(m_levelDotSize*m_levelDotSize).swap(m_levelDot);
|
||||
std::vector<Gfx::DotLevel>(m_levelDotSize*m_levelDotSize).swap(m_levelDots);
|
||||
|
||||
for (int i = 0; i < m_levelDotSize * m_levelDotSize; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
m_levelDot[i].mat[j] = 0;
|
||||
m_levelDots[i].mat[j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Gfx::CTerrain::LevelCloseTable()
|
||||
{
|
||||
m_levelDot.clear();
|
||||
m_levelDots.clear();
|
||||
}
|
||||
|
||||
bool Gfx::CTerrain::CreateSquare(bool multiRes, int x, int y)
|
||||
|
@ -1673,7 +1673,7 @@ float Gfx::CTerrain::GetHardness(const Math::Vector &p)
|
|||
float factor = GetBuildingFactor(p);
|
||||
if (factor != 1.0f) return 1.0f; // on building
|
||||
|
||||
if (m_levelDot.empty()) return m_defHardness;
|
||||
if (m_levelDots.empty()) return m_defHardness;
|
||||
|
||||
float dim = (m_mosaic*m_brick*m_size)/2.0f;
|
||||
|
||||
|
@ -1691,7 +1691,7 @@ float Gfx::CTerrain::GetHardness(const Math::Vector &p)
|
|||
if ( x < 0 || x >= m_levelDotSize ||
|
||||
y < 0 || y >= m_levelDotSize ) return m_defHardness;
|
||||
|
||||
int id = m_levelDot[x+y*m_levelDotSize].id;
|
||||
int id = m_levelDots[x+y*m_levelDotSize].id;
|
||||
TerrainMaterial* tm = LevelSearchMat(id);
|
||||
if (tm == nullptr) return m_defHardness;
|
||||
|
||||
|
@ -1729,7 +1729,7 @@ void Gfx::CTerrain::GroundFlat(Math::Vector pos)
|
|||
}
|
||||
}
|
||||
|
||||
m_engine->GroundMarkCreate(pos, 40.0f, 0.001f, 15.0f, 0.001f, 41, 41, table);
|
||||
m_engine->CreateGroundMark(pos, 40.0f, 0.001f, 15.0f, 0.001f, 41, 41, table);
|
||||
}
|
||||
|
||||
float Gfx::CTerrain::GetFlatZoneRadius(Math::Vector center, float max)
|
||||
|
|
|
@ -273,8 +273,8 @@ protected:
|
|||
std::string m_texBaseExt;
|
||||
float m_defHardness;
|
||||
|
||||
std::vector<TerrainMaterial> m_levelMat;
|
||||
std::vector<Gfx::DotLevel> m_levelDot;
|
||||
std::vector<TerrainMaterial> m_levelMats;
|
||||
std::vector<Gfx::DotLevel> m_levelDots;
|
||||
int m_levelMatMax;
|
||||
int m_levelID;
|
||||
|
||||
|
|
|
@ -788,7 +788,7 @@ Gfx::CharTexture Gfx::CText::CreateCharTexture(Gfx::UTF8Char ch, Gfx::CachedFont
|
|||
SDL_FreeSurface(textSurface);
|
||||
SDL_FreeSurface(textureSurface);
|
||||
|
||||
if (! tex.valid)
|
||||
if (! tex.Valid())
|
||||
{
|
||||
m_error = "Texture create error";
|
||||
return texture;
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
#include "graphics/engine/water.h"
|
||||
|
||||
#include "common/iman.h"
|
||||
#include "common/logger.h"
|
||||
#include "graphics/engine/engine.h"
|
||||
#include "graphics/engine/terrain.h"
|
||||
#include "object/object.h"
|
||||
#include "sound/sound.h"
|
||||
|
||||
|
||||
|
@ -49,9 +51,9 @@ Gfx::CWater::CWater(CInstanceManager* iMan, Gfx::CEngine* engine)
|
|||
m_color = 0xffffffff;
|
||||
m_subdiv = 4;
|
||||
|
||||
m_line.reserve(WATERLINE_PREALLOCATE_COUNT);
|
||||
m_lines.reserve(WATERLINE_PREALLOCATE_COUNT);
|
||||
|
||||
std::vector<Gfx::WaterVapor>(VAPOR_SIZE).swap(m_vapor);
|
||||
std::vector<Gfx::WaterVapor>(VAPOR_SIZE).swap(m_vapors);
|
||||
}
|
||||
|
||||
Gfx::CWater::~CWater()
|
||||
|
@ -91,7 +93,7 @@ void Gfx::CWater::LavaFrame(float rTime)
|
|||
if (m_particule == nullptr)
|
||||
m_particule = static_cast<Gfx::CParticle*>( m_iMan->SearchInstance(CLASS_PARTICULE) );
|
||||
|
||||
for (int i = 0; i < static_cast<int>( m_vapor.size() ); i++)
|
||||
for (int i = 0; i < static_cast<int>( m_vapors.size() ); i++)
|
||||
VaporFrame(i, rTime);
|
||||
|
||||
if (m_time - m_lastLava >= 0.1f)
|
||||
|
@ -138,26 +140,26 @@ void Gfx::CWater::LavaFrame(float rTime)
|
|||
|
||||
void Gfx::CWater::VaporFlush()
|
||||
{
|
||||
m_vapor.clear();
|
||||
m_vapors.clear();
|
||||
}
|
||||
|
||||
bool Gfx::CWater::VaporCreate(Gfx::ParticleType type, Math::Vector pos, float delay)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>( m_vapor.size() ); i++)
|
||||
for (int i = 0; i < static_cast<int>( m_vapors.size() ); i++)
|
||||
{
|
||||
if (! m_vapor[i].used)
|
||||
if (! m_vapors[i].used)
|
||||
{
|
||||
m_vapor[i].used = true;
|
||||
m_vapor[i].type = type;
|
||||
m_vapor[i].pos = pos;
|
||||
m_vapor[i].delay = delay;
|
||||
m_vapor[i].time = 0.0f;
|
||||
m_vapor[i].last = 0.0f;
|
||||
m_vapors[i].used = true;
|
||||
m_vapors[i].type = type;
|
||||
m_vapors[i].pos = pos;
|
||||
m_vapors[i].delay = delay;
|
||||
m_vapors[i].time = 0.0f;
|
||||
m_vapors[i].last = 0.0f;
|
||||
|
||||
if (m_vapor[i].type == PARTIFIRE)
|
||||
if (m_vapors[i].type == PARTIFIRE)
|
||||
m_sound->Play(SOUND_BLUP, pos, 1.0f, 1.0f-Math::Rand()*0.5f);
|
||||
|
||||
if (m_vapor[i].type == PARTIVAPOR)
|
||||
if (m_vapors[i].type == PARTIVAPOR)
|
||||
m_sound->Play(SOUND_PSHHH, pos, 0.3f, 2.0f);
|
||||
|
||||
return true;
|
||||
|
@ -169,22 +171,22 @@ bool Gfx::CWater::VaporCreate(Gfx::ParticleType type, Math::Vector pos, float de
|
|||
|
||||
void Gfx::CWater::VaporFrame(int i, float rTime)
|
||||
{
|
||||
m_vapor[i].time += rTime;
|
||||
m_vapors[i].time += rTime;
|
||||
|
||||
if (m_sound == nullptr)
|
||||
m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
|
||||
|
||||
if (m_vapor[i].time <= m_vapor[i].delay)
|
||||
if (m_vapors[i].time <= m_vapors[i].delay)
|
||||
{
|
||||
if (m_time-m_vapor[i].last >= m_engine->ParticleAdapt(0.02f))
|
||||
if (m_time-m_vapors[i].last >= m_engine->ParticleAdapt(0.02f))
|
||||
{
|
||||
m_vapor[i].last = m_time;
|
||||
m_vapors[i].last = m_time;
|
||||
|
||||
if (m_vapor[i].type == PARTIFIRE)
|
||||
if (m_vapors[i].type == PARTIFIRE)
|
||||
{
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
Math::Vector pos = m_vapor[i].pos;
|
||||
Math::Vector pos = m_vapors[i].pos;
|
||||
pos.x += (Math::Rand()-0.5f)*2.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*2.0f;
|
||||
pos.y -= 1.0f;
|
||||
|
@ -198,9 +200,9 @@ void Gfx::CWater::VaporFrame(int i, float rTime)
|
|||
m_particule->CreateParticle(pos, speed, dim, PARTIERROR, 2.0f, 10.0f);
|
||||
}
|
||||
}
|
||||
else if (m_vapor[i].type == PARTIFLAME)
|
||||
else if (m_vapors[i].type == PARTIFLAME)
|
||||
{
|
||||
Math::Vector pos = m_vapor[i].pos;
|
||||
Math::Vector pos = m_vapors[i].pos;
|
||||
pos.x += (Math::Rand()-0.5f)*8.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*8.0f;
|
||||
pos.y -= 2.0f;
|
||||
|
@ -215,7 +217,7 @@ void Gfx::CWater::VaporFrame(int i, float rTime)
|
|||
}
|
||||
else
|
||||
{
|
||||
Math::Vector pos = m_vapor[i].pos;
|
||||
Math::Vector pos = m_vapors[i].pos;
|
||||
pos.x += (Math::Rand()-0.5f)*4.0f;
|
||||
pos.z += (Math::Rand()-0.5f)*4.0f;
|
||||
pos.y -= 2.0f;
|
||||
|
@ -232,7 +234,7 @@ void Gfx::CWater::VaporFrame(int i, float rTime)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_vapor[i].used = false;
|
||||
m_vapors[i].used = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,6 +258,7 @@ void Gfx::CWater::AdjustLevel(Math::Vector &pos, Math::Vector &norm,
|
|||
/** This surface prevents to see the sky (background) underwater! */
|
||||
void Gfx::CWater::DrawBack()
|
||||
{
|
||||
GetLogger()->Trace("CWater::DrawBack(): stub!\n");
|
||||
/* TODO!
|
||||
LPDIRECT3DDEVICE7 device;
|
||||
D3DVERTEX2 vertex[4]; // 2 triangles
|
||||
|
@ -336,6 +339,7 @@ void Gfx::CWater::DrawBack()
|
|||
|
||||
void Gfx::CWater::DrawSurf()
|
||||
{
|
||||
GetLogger()->Trace("CWater::DrawSurf(): stub!\n");
|
||||
/* TODO!
|
||||
LPDIRECT3DDEVICE7 device;
|
||||
D3DVERTEX2* vertex; // triangles
|
||||
|
@ -498,7 +502,7 @@ void Gfx::CWater::CreateLine(int x, int y, int len)
|
|||
line.px2 = m_size*(line.x+line.len) - offset;
|
||||
line.pz = m_size* line.y - offset;
|
||||
|
||||
m_line.push_back(line);
|
||||
m_lines.push_back(line);
|
||||
}
|
||||
|
||||
void Gfx::CWater::Create(Gfx::WaterType type1, Gfx::WaterType type2, const std::string& fileName,
|
||||
|
@ -533,7 +537,7 @@ void Gfx::CWater::Create(Gfx::WaterType type1, Gfx::WaterType type2, const std::
|
|||
if (m_type[0] == WATER_NULL)
|
||||
return;
|
||||
|
||||
m_line.clear();
|
||||
m_lines.clear();
|
||||
|
||||
for (int y = 0; y < m_brick; y++)
|
||||
{
|
||||
|
@ -586,7 +590,6 @@ float Gfx::CWater::GetLevel()
|
|||
|
||||
float Gfx::CWater::GetLevel(CObject* object)
|
||||
{
|
||||
/* TODO!
|
||||
ObjectType type = object->GetType();
|
||||
|
||||
if ( type == OBJECT_HUMAN ||
|
||||
|
@ -625,7 +628,7 @@ float Gfx::CWater::GetLevel(CObject* object)
|
|||
{
|
||||
return m_level-2.0f;
|
||||
}
|
||||
*/
|
||||
|
||||
return m_level;
|
||||
}
|
||||
|
||||
|
|
|
@ -165,8 +165,8 @@ protected:
|
|||
//! Size of a item in an brick
|
||||
float m_size;
|
||||
|
||||
std::vector<WaterLine> m_line;
|
||||
std::vector<WaterVapor> m_vapor;
|
||||
std::vector<WaterLine> m_lines;
|
||||
std::vector<WaterVapor> m_vapors;
|
||||
|
||||
bool m_draw;
|
||||
bool m_lava;
|
||||
|
|
|
@ -396,7 +396,6 @@ Gfx::Texture Gfx::CGLDevice::CreateTexture(ImageData *data, const Gfx::TextureCr
|
|||
{
|
||||
Gfx::Texture result;
|
||||
|
||||
result.valid = true;
|
||||
result.size.x = data->surface->w;
|
||||
result.size.y = data->surface->h;
|
||||
|
||||
|
@ -463,7 +462,7 @@ Gfx::Texture Gfx::CGLDevice::CreateTexture(ImageData *data, const Gfx::TextureCr
|
|||
|
||||
|
||||
// Restore the previous state of 1st stage
|
||||
if (m_currentTextures[0].valid)
|
||||
if (m_currentTextures[0].Valid())
|
||||
glBindTexture(GL_TEXTURE_2D, m_currentTextures[0].id);
|
||||
else
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -518,7 +517,7 @@ void Gfx::CGLDevice::SetTexture(int index, const Gfx::Texture &texture)
|
|||
|
||||
m_currentTextures[index] = texture; // remember the change
|
||||
|
||||
if (! texture.valid)
|
||||
if (! texture.Valid())
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, 0); // unbind texture
|
||||
}
|
||||
|
@ -596,7 +595,7 @@ void Gfx::CGLDevice::SetTextureStageParams(int index, const Gfx::TextureStagePar
|
|||
m_textureStageParams[index] = params;
|
||||
|
||||
// Don't actually do anything if texture not set
|
||||
if (! m_currentTextures[index].valid)
|
||||
if (! m_currentTextures[index].Valid())
|
||||
return;
|
||||
|
||||
// Enable the given stage
|
||||
|
|
Loading…
Reference in New Issue