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
path: root/source
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-07-17 09:23:17 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-07-17 09:23:17 +0400
commit90fb63152628927d5d13b0101f4f2dcec025d2f7 (patch)
tree2f5f652729252632e3dc5c74e5c433ca2d297db1 /source
parent5ff83fa2b8c63a9267722f01b5626ee0da41adda (diff)
Port a few rasterizer changes from tuhopuu2:
Up the max batch size. Clean up some of the code - move code in headers to source files etc.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.cpp25
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.h26
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.h31
-rw-r--r--source/gameengine/Rasterizer/RAS_MeshObject.cpp68
-rw-r--r--source/gameengine/Rasterizer/RAS_MeshObject.h47
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp36
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_Polygon.cpp2
-rw-r--r--source/gameengine/Rasterizer/RAS_Polygon.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.cpp11
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.h23
12 files changed, 142 insertions, 133 deletions
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index e6bdf9143c9..fd2f3a55f1d 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -60,7 +60,30 @@ RAS_BucketManager::~RAS_BucketManager()
RAS_BucketManagerClearAll();
}
-
+/**
+ * struct alphamesh holds a mesh, (m_ms) it's depth, (m_z) and the bucket it came from (m_bucket.)
+ */
+struct RAS_BucketManager::alphamesh
+{
+public:
+ MT_Scalar m_z;
+ RAS_MaterialBucket::T_MeshSlotList::iterator m_ms;
+ RAS_MaterialBucket *m_bucket;
+ alphamesh(MT_Scalar z, RAS_MaterialBucket::T_MeshSlotList::iterator &ms, RAS_MaterialBucket *bucket) :
+ m_z(z),
+ m_ms(ms),
+ m_bucket(bucket)
+ {}
+};
+
+struct RAS_BucketManager::backtofront
+{
+ bool operator()(const alphamesh &a, const alphamesh &b)
+ {
+ return a.m_z < b.m_z;
+ }
+};
+
void RAS_BucketManager::RenderAlphaBuckets(
const MT_Transform& cameratrans, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools)
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h
index 9d7c5a4b05a..59144f1e175 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.h
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.h
@@ -47,31 +47,9 @@ class RAS_BucketManager
typedef std::vector<class RAS_MaterialBucket*> BucketList;
BucketList m_MaterialBuckets;
BucketList m_AlphaBuckets;
-
- /**
- * struct alphamesh holds a mesh, (m_ms) it's depth, (m_z) and the bucket it came from (m_bucket.)
- */
- struct alphamesh
- {
- public:
- MT_Scalar m_z;
- RAS_MaterialBucket::T_MeshSlotList::iterator m_ms;
- RAS_MaterialBucket *m_bucket;
- alphamesh(MT_Scalar z, RAS_MaterialBucket::T_MeshSlotList::iterator &ms, RAS_MaterialBucket *bucket) :
- m_z(z),
- m_ms(ms),
- m_bucket(bucket)
- {}
- };
-
- struct backtofront
- {
- bool operator()(const alphamesh &a, const alphamesh &b)
- {
- return a.m_z < b.m_z;
- }
- };
+ struct alphamesh;
+ struct backtofront;
public:
RAS_BucketManager();
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 83e981b840a..efd3a491784 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -56,7 +56,7 @@ KX_VertexIndex::KX_VertexIndex(int size)
-void KX_VertexIndex::SetIndex(short loc,short index)
+void KX_VertexIndex::SetIndex(short loc,unsigned int index)
{
m_indexarray[loc]=index;
}
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 182ef1920ce..83cb06b3c2b 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -45,10 +45,9 @@
using namespace std;
typedef vector<unsigned short> KX_IndexArray;
-typedef vector< KX_IndexArray* > vecIndexArrays;
typedef vector<RAS_TexVert> KX_VertexArray;
typedef vector< KX_VertexArray* > vecVertexArray;
-
+typedef vector< KX_IndexArray* > vecIndexArrays;
/**
* KX_VertexIndex
@@ -56,9 +55,9 @@ typedef vector< KX_VertexArray* > vecVertexArray;
struct KX_VertexIndex {
public:
KX_VertexIndex(int size);
- void SetIndex(short loc,short index);
+ void SetIndex(short loc,unsigned int index);
short m_vtxarray;
- short m_indexarray[4];
+ unsigned short m_indexarray[4];
short m_size;
};
@@ -69,18 +68,20 @@ public:
class KX_MeshSlot
{
public:
- void* m_clientObj;
- RAS_Deformer* m_pDeformer; // __NLA
- double* m_OpenGLMatrix;
- class RAS_MeshObject* m_mesh;
-
- mutable bool m_bVisible; // for visibility
- mutable bool m_bObjectColor;
- mutable MT_Vector4 m_RGBAcolor;
-
- KX_MeshSlot() :m_pDeformer(NULL), m_bVisible(true) {}
- // KX_MeshSlot() :m_bVisible(true) {}
+ void* m_clientObj;
+ RAS_Deformer* m_pDeformer; // __NLA
+ double* m_OpenGLMatrix;
+ class RAS_MeshObject* m_mesh;
+ mutable bool m_bVisible; // for visibility
+ mutable bool m_bObjectColor;
+ mutable MT_Vector4 m_RGBAcolor;
+ KX_MeshSlot() :
+ m_pDeformer(NULL),
+ m_bVisible(true)
+ {
+ }
+ ~KX_MeshSlot() {};
bool Less(const KX_MeshSlot& lhs) const;
};
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
index 50bd2339f6e..4c24a58237c 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
@@ -452,7 +452,7 @@ void RAS_MeshObject::RemoveFromBuckets(double* oglmatrix,
* it is the clients responsibility to make sure the array and index are valid
*/
RAS_TexVert* RAS_MeshObject::GetVertex(short array,
- short index,
+ unsigned int index,
RAS_IPolyMaterial* polymat)
{
KX_ArrayOptimizer* ao = GetArrayOptimizer(polymat);//*(m_matVertexArrays[*polymat]);
@@ -488,12 +488,12 @@ int RAS_MeshObject::FindVertexArray(int numverts,
{
if ( (ao->m_TriangleArrayCount[i] + (numverts-2)) < BUCKET_MAX_TRIANGLES)
{
- if((ao->m_VertexArrayCache1[i]->size()+numverts < BUCKET_MAX_INDICES))
- {
- array = i;
- ao->m_TriangleArrayCount[array]+=numverts-2;
- break;
- }
+ if((ao->m_VertexArrayCache1[i]->size()+numverts < BUCKET_MAX_INDICES))
+ {
+ array = i;
+ ao->m_TriangleArrayCount[array]+=numverts-2;
+ break;
+ }
}
}
@@ -547,21 +547,52 @@ void RAS_MeshObject::UpdateMaterialList()
}
}
-RAS_MeshObject::polygonSlot::polygonSlot(const MT_Vector3 &pnorm, const MT_Scalar &pval, RAS_MeshObject *mesh, RAS_Polygon* poly) :
- m_poly(poly)
+struct RAS_MeshObject::polygonSlot
{
- const KX_VertexIndex &base = m_poly->GetIndexBase();
- RAS_TexVert *vert = mesh->GetVertex(base.m_vtxarray, base.m_indexarray[0], poly->GetMaterial()->GetPolyMaterial());
- m_z = MT_dot(pnorm, vert->getLocalXYZ()) + pval;
+ float m_z;
+ RAS_Polygon *m_poly;
+
+ polygonSlot(float z, RAS_Polygon* poly) :
+ m_z(z),
+ m_poly(poly)
+ {}
+ /**
+ * pnorm and pval form the plane equation that the distance from is used to
+ * sort against.
+ */
+ polygonSlot(const MT_Vector3 &pnorm, const MT_Scalar &pval, RAS_MeshObject *mesh, RAS_Polygon* poly) :
+ m_poly(poly)
+ {
+ const KX_VertexIndex &base = m_poly->GetIndexBase();
+ RAS_TexVert *vert = mesh->GetVertex(base.m_vtxarray, base.m_indexarray[0], poly->GetMaterial()->GetPolyMaterial());
+ m_z = MT_dot(pnorm, vert->getLocalXYZ()) + pval;
+
+ for( unsigned int i = 1; i < m_poly->VertexCount(); i++)
+ {
+ vert = mesh->GetVertex(base.m_vtxarray, base.m_indexarray[i], poly->GetMaterial()->GetPolyMaterial());
+ float z = MT_dot(pnorm, vert->getLocalXYZ()) + pval;
+ m_z += z;
+ }
+ m_z /= m_poly->VertexCount();
+ }
+};
- for( unsigned int i = 1; i < m_poly->VertexCount(); i++)
+struct RAS_MeshObject::backtofront
+{
+ bool operator()(const polygonSlot &a, const polygonSlot &b) const
{
- vert = mesh->GetVertex(base.m_vtxarray, base.m_indexarray[i], poly->GetMaterial()->GetPolyMaterial());
- float z = MT_dot(pnorm, vert->getLocalXYZ()) + pval;
- if (z < m_z)
- m_z = z;
+ return a.m_z < b.m_z;
}
-}
+};
+
+struct RAS_MeshObject::fronttoback
+{
+ bool operator()(const polygonSlot &a, const polygonSlot &b) const
+ {
+ return a.m_z > b.m_z;
+ }
+};
+
void RAS_MeshObject::SortPolygons(const MT_Transform &transform)
{
@@ -604,6 +635,7 @@ void RAS_MeshObject::SortPolygons(const MT_Transform &transform)
SchedulePoly((*ait).m_poly->GetVertexIndexBase(), (*ait).m_poly->VertexCount(), (*ait).m_poly->GetMaterial()->GetPolyMaterial());
}
+
void RAS_MeshObject::SchedulePolygons(const MT_Transform &transform, int drawingmode,RAS_IRasterizer* rasty)
{
// int nummaterials = m_materials.size();
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h
index 9058fe4d31f..f2be0355c6e 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.h
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.h
@@ -120,9 +120,6 @@ inline bool operator <( const RAS_MatArrayIndex& rhs,const RAS_MatArrayIndex& l
class RAS_MeshObject
{
- enum { BUCKET_MAX_INDICES = 16384 };//2048};//8192};
- enum { BUCKET_MAX_TRIANGLES = 4096 };
-
// GEN_Map<class RAS_IPolyMaterial,KX_ArrayOptimizer*> m_matVertexArrayS;
//vector<class RAS_IPolyMaterial*,KX_ArrayOptimizer> m_vertexArrays;
virtual KX_ArrayOptimizer* GetArrayOptimizer(RAS_IPolyMaterial* polymat);
@@ -137,40 +134,15 @@ class RAS_MeshObject
static STR_String s_emptyname;
bool m_zsort;
- struct polygonSlot
- {
- float m_z;
- RAS_Polygon *m_poly;
-
- polygonSlot(float z, RAS_Polygon* poly) :
- m_z(z),
- m_poly(poly)
- {}
- /**
- * pnorm and pval form the plane equation that the distance from is used to
- * sort against.
- */
- polygonSlot(const MT_Vector3 &pnorm, const MT_Scalar &pval, RAS_MeshObject* mesh, RAS_Polygon* poly);
- };
-
- struct backtofront
- {
- bool operator()(const polygonSlot &a, const polygonSlot &b) const
- {
- return a.m_z < b.m_z;
- }
- };
-
- struct fronttoback
- {
- bool operator()(const polygonSlot &a, const polygonSlot &b) const
- {
- return a.m_z > b.m_z;
- }
- };
+ struct polygonSlot;
+ struct backtofront;
+ struct fronttoback;
protected:
+ enum { BUCKET_MAX_INDICES = 65535 };//2048};//8192};
+ enum { BUCKET_MAX_TRIANGLES = 65535 };
+
GEN_Map<class RAS_IPolyMaterial,KX_ArrayOptimizer*> m_matVertexArrayS;
RAS_MaterialBucket::Set m_materials;
@@ -218,7 +190,10 @@ public:
void DebugColor(unsigned int abgr);
- void SortPolygons(const MT_Transform &transform);
+ /**
+ * Sorts the polygons by their transformed z values.
+ */
+ void SortPolygons(const MT_Transform &transform);
void SchedulePolygons(
const MT_Transform &transform,
@@ -233,7 +208,7 @@ public:
virtual RAS_TexVert* GetVertex(
short array,
- short index,
+ unsigned int index,
RAS_IPolyMaterial* polymat
);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index ce58c8470c4..5f09846aa72 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -560,25 +560,25 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
// However it depends on the way the colors are packed into
// the m_rgba field of RAS_TexVert
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
@@ -620,19 +620,19 @@ void RAS_OpenGLRasterizer::IndexPrimitives(const vecVertexArray & vertexarrays,
for (unsigned int i=0;i<numindices;i+=3)
{
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
@@ -786,28 +786,28 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
glNormal3f(fnor[0], fnor[1], fnor[2]);
}
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
@@ -886,21 +886,21 @@ void RAS_OpenGLRasterizer::IndexPrimitives_Ex(const vecVertexArray & vertexarray
glNormal3f(fnor[0], fnor[1], fnor[2]);
}
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
vindex++;
- glColor4ubv((const GLubyte *)&(vertexarray[(indexarray[vindex])].getRGBA()));
+ glColor4ubv((const GLubyte *)(vertexarray[(indexarray[vindex])].getRGBA()));
if (!recalc)
glNormal3fv(vertexarray[(indexarray[vindex])].getNormal());
glTexCoord2fv(vertexarray[(indexarray[vindex])].getUV1());
@@ -993,25 +993,21 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(const vecVertexArray & vertexa
{
float v1[3],v2[3],v3[3],v4[3];
- char *cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
v1[0] = vertexarray[(indexarray[vindex])].getLocalXYZ()[0];
v1[1] = vertexarray[(indexarray[vindex])].getLocalXYZ()[1];
v1[2] = vertexarray[(indexarray[vindex])].getLocalXYZ()[2];
vindex++;
- cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
v2[0] = vertexarray[(indexarray[vindex])].getLocalXYZ()[0];
v2[1] = vertexarray[(indexarray[vindex])].getLocalXYZ()[1];
v2[2] = vertexarray[(indexarray[vindex])].getLocalXYZ()[2];
vindex++;
- cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
v3[0] = vertexarray[(indexarray[vindex])].getLocalXYZ()[0];
v3[1] = vertexarray[(indexarray[vindex])].getLocalXYZ()[1];
v3[2] = vertexarray[(indexarray[vindex])].getLocalXYZ()[2];
vindex++;
- cp= (char *)&(vertexarray[(indexarray[vindex])].getRGBA());
v4[0] = vertexarray[(indexarray[vindex])].getLocalXYZ()[0];
v4[1] = vertexarray[(indexarray[vindex])].getLocalXYZ()[1];
v4[2] = vertexarray[(indexarray[vindex])].getLocalXYZ()[2];
@@ -1086,7 +1082,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
float top,
float frustnear,
float frustfar,
- bool perspective
+ bool
){
MT_Matrix4x4 result;
double mat[16];
@@ -1127,7 +1123,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
// next arguments probably contain redundant info, for later...
void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, const MT_Vector3& campos,
- const MT_Point3 &camLoc, const MT_Quaternion &camOrientQuat)
+ const MT_Point3 &, const MT_Quaternion &camOrientQuat)
{
MT_Matrix4x4 viewMat = mat;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
index a2687e6bb3d..f78448d2cc4 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
@@ -194,7 +194,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays
glVertexPointer(3,GL_FLOAT,vtxstride,vertexarray->getLocalXYZ());
glTexCoordPointer(2,GL_FLOAT,vtxstride,vertexarray->getUV1());
- glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,&vertexarray->getRGBA());
+ glColorPointer(4,GL_UNSIGNED_BYTE,vtxstride,vertexarray->getRGBA());
glNormalPointer(GL_FLOAT,vtxstride,vertexarray->getNormal());
//glLockArraysEXT(0,numverts);
// here the actual drawing takes places
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp
index 4ca1e37eb1f..10b5c9ff51c 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.cpp
+++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp
@@ -82,7 +82,7 @@ int RAS_Polygon::VertexCount()
void RAS_Polygon::SetVertex(int i,
- int vertexindex ) //const MT_Point3& xyz,const MT_Point2& uv,const unsigned int rgbacolor,const MT_Vector3& normal)
+ unsigned int vertexindex ) //const MT_Point3& xyz,const MT_Point2& uv,const unsigned int rgbacolor,const MT_Vector3& normal)
{
m_vertexindexbase.SetIndex(i,vertexindex); //m_bucket->FindOrAddVertex(m_vertexindexbase.m_vtxarray,
//xyz,uv,rgbacolor,normal));
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.h b/source/gameengine/Rasterizer/RAS_Polygon.h
index bbfa22a2589..253faec6e95 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.h
+++ b/source/gameengine/Rasterizer/RAS_Polygon.h
@@ -72,7 +72,7 @@ public:
// RAS_TexVert* GetVertex(int index);
int VertexCount();
- void SetVertex(int i,int vertexindex); //const MT_Point3& xyz,const MT_Point2& uv,const unsigned int rgbacolor,const MT_Vector3& normal)
+ void SetVertex(int i, unsigned int vertexindex); //const MT_Point3& xyz,const MT_Point2& uv,const unsigned int rgbacolor,const MT_Vector3& normal)
const KX_VertexIndex& GetIndexBase();
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index 08eb67d7dc5..5dae717cd8e 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -35,6 +35,8 @@
#include <config.h>
#endif
+#define SHORT(x) short(x*32767.0)
+
RAS_TexVert::RAS_TexVert(const MT_Point3& xyz,
const MT_Point2& uv,
const unsigned int rgba,
@@ -63,6 +65,7 @@ void RAS_TexVert::SetRGBA(const MT_Vector4& rgba)
colp[3] = rgba[3]*255.0;
}
+
void RAS_TexVert::SetXYZ(const MT_Point3& xyz)
{
xyz.getValue(m_localxyz);
@@ -106,18 +109,14 @@ const float* RAS_TexVert::getNormal() const
return m_normal;
}
-
-
const float* RAS_TexVert::getLocalXYZ() const
{
return m_localxyz;
}
-
-
-const unsigned int& RAS_TexVert::getRGBA() const
+const unsigned char* RAS_TexVert::getRGBA() const
{
- return m_rgba;
+ return (unsigned char*) &m_rgba;
}
#endif
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h
index b24a0ec2812..650618e1dc1 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.h
+++ b/source/gameengine/Rasterizer/RAS_TexVert.h
@@ -47,15 +47,21 @@ static MT_Point2 g_pt2;
class RAS_TexVert
{
- float m_localxyz[3]; // 3*4 = 12 = 24
- float m_uv1[2]; // 2*4 = 8 = 24 + 16 = 40
- unsigned int m_rgba; // 4 = 40 + 4 = 44
- float m_normal[3]; // 3*2 = 6 = 50
- short m_flag; // 32 bytes total size, fits nice = 52 = not fit nice
+ float m_localxyz[3]; // 3*4 = 12
+ float m_uv1[2]; // 2*4 = 8
+ unsigned int m_rgba; // 4
+ float m_tangent[4]; // 4*2 = 8
+ float m_normal[3]; // 3*2 = 6
+ short m_flag; // 2
+ //---------
+ // 40
+ //32 bytes total size, fits nice = 52 = not fit nice.
+ // We'll go for 64 bytes total size - 24 bytes left.
public:
short getFlag() const;
+
RAS_TexVert()// :m_xyz(0,0,0),m_uv(0,0),m_rgba(0)
{}
RAS_TexVert(const MT_Point3& xyz,
@@ -79,15 +85,14 @@ public:
return m_normal;
}
- const unsigned int& getRGBA() const {
- return m_rgba;
+ const unsigned char* getRGBA() const {
+ return (unsigned char *) &m_rgba;
}
#else
const float* getUV1 () const;
const float* getNormal() const;
const float* getLocalXYZ() const;
- const unsigned int& getRGBA() const;
-
+ const unsigned char* getRGBA() const;
#endif
void SetXYZ(const MT_Point3& xyz);
void SetUV(const MT_Point2& uv);