Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/Rasterizer')
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp49
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.h4
-rw-r--r--source/gameengine/Rasterizer/RAS_IRasterizer.h12
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.cpp4
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp4
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp4
6 files changed, 26 insertions, 51 deletions
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index b5b47598b1b..babecdd585a 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -57,7 +57,8 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname,
m_transparant(transparant),
m_zsort(zsort),
m_lightlayer(lightlayer),
- m_bIsTriangle(bIsTriangle)
+ m_bIsTriangle(bIsTriangle),
+ m_polymatid(m_newpolymatid++)
{
m_shininess = 35.0;
m_specular = MT_Vector3(0.5,0.5,0.5);
@@ -84,48 +85,10 @@ bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const
bool RAS_IPolyMaterial::Less(const RAS_IPolyMaterial& rhs) const
{
- /**
- * @warning STL requires lhs.Less(rhs) == rhs.Less(lhs) implies lhs.Equals(rhs).
- * This function *must* return different values for lhs.Less(rhs) and rhs.Less(lhs) if
- * !lhs.Equals(rhs) !!
- */
- if (m_materialname.hash() < rhs.m_materialname.hash())
- return true;
-
- if (m_materialname.hash() > rhs.m_materialname.hash() ||
- m_texturename.hash() > rhs.m_texturename.hash())
+ if (Equals(rhs))
return false;
-
- if (m_texturename.hash() < rhs.m_texturename.hash() ||
- m_lightlayer < rhs.m_lightlayer)
- return true;
-
- if (m_lightlayer > rhs.m_lightlayer ||
- m_bIsTriangle > rhs.m_bIsTriangle)
- return false;
-
- if (m_bIsTriangle < rhs.m_bIsTriangle ||
- m_drawingmode < rhs.m_drawingmode)
- return true;
-
- if (m_drawingmode > rhs.m_drawingmode ||
- m_transparant > !rhs.m_transparant)
- return false;
-
- if (m_transparant < rhs.m_transparant ||
- m_tileyrep < rhs.m_tileyrep)
- return true;
-
- if (m_tileyrep > rhs.m_tileyrep ||
- m_tilexrep > rhs.m_tilexrep)
- return false;
-
- if (m_tilexrep < rhs.m_tilexrep ||
- m_tile < rhs.m_tile)
- return true;
-
- return !(m_tile > rhs.m_tile ||
- m_zsort > rhs.m_zsort);
+
+ return m_polymatid < rhs.m_polymatid;
}
int RAS_IPolyMaterial::GetLightLayer() const
@@ -167,3 +130,5 @@ const STR_String& RAS_IPolyMaterial::GetTextureName() const
{
return m_texturename;
}
+
+unsigned int RAS_IPolyMaterial::m_newpolymatid = 0;
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index 93c6d829e85..648a8b63464 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -60,6 +60,10 @@ protected:
int m_lightlayer;
bool m_bIsTriangle;
+ unsigned int m_polymatid;
+
+ static unsigned int m_newpolymatid;
+
public:
MT_Vector3 m_diffuse;
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 815c095e583..21e47e12050 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -299,13 +299,21 @@ public:
float frustfar,
bool perspective = true
)=0;
-
+ /**
+ * Sets the specular colour component of the lighting equation.
+ */
virtual void SetSpecularity(float specX,
float specY,
float specZ,
float specval)=0;
-
+
+ /**
+ * Sets the specular exponent component of the lighting equation.
+ */
virtual void SetShinyness(float shiny)=0;
+ /**
+ * Sets the diffuse colour component of the lighting equation.
+ */
virtual void SetDiffuse(float difX,
float difY,
float difZ,
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index faaeafb0d05..83e981b840a 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -257,9 +257,9 @@ void RAS_MaterialBucket::Render(const MT_Transform& cameratrans,
if (m_meshSlots.begin()== m_meshSlots.end())
return;
- rendertools->SetViewMat(cameratrans);
+ //rendertools->SetViewMat(cameratrans);
- rasty->SetMaterial(*m_material);
+ //rasty->SetMaterial(*m_material);
if (m_meshSlots.size() >0)
{
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 5df296970a3..3e93a7a74b9 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -686,7 +686,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
numindices = indexarray.size();
if (!numindices)
- break;
+ continue;
int vindex=0;
switch (mode)
@@ -777,7 +777,7 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
mv1 = MT_Point3(vertexarray[(indexarray[vindex])].getLocalXYZ());
mv2 = MT_Point3(vertexarray[(indexarray[vindex+1])].getLocalXYZ());
mv3 = MT_Point3(vertexarray[(indexarray[vindex+2])].getLocalXYZ());
- mv4 = MT_Point3(vertexarray[(indexarray[vindex+2])].getLocalXYZ());
+ mv4 = MT_Point3(vertexarray[(indexarray[vindex+3])].getLocalXYZ());
fnor = (((mv2-mv1).cross(mv3-mv2))+((mv4-mv3).cross(mv1-mv4))).safe_normalized();
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
index c0d90bb3c09..50b786bb120 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
@@ -183,8 +183,6 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
glColor3d(0,0,0);
}
// use glDrawElements to draw each vertexarray
- static bool doWarning = true;
-
for (vt=0;vt<vertexarrays.size();vt++)
{
vertexarray = &((*vertexarrays[vt]) [0]);
@@ -193,7 +191,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
int numverts = vertexarrays[vt]->size();
if (!numindices)
- break;
+ continue;
glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ());
glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1());