Merge of first part of changes from the apricot branch, especially

the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:

* GLSL support in the viewport and game engine, enable in the game
  menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
  gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
  storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.

* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
  An extra texture slot shows up once the last slot is used.

* Memory limit for undo, not enabled by default yet because it
  needs the .B.blend to be changed.
* Multiple undo for image painting.

* An offset for dupligroups, so not all objects in a group have to
  be at the origin.
This commit is contained in:
Brecht Van Lommel
2008-09-04 20:51:28 +00:00
parent 2167e5c341
commit cb89decfdc
258 changed files with 13813 additions and 5271 deletions

View File

@@ -26,99 +26,82 @@
* ***** END GPL LICENSE BLOCK *****
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef WIN32
#pragma warning (disable:4786)
#endif
#include "RAS_Polygon.h"
RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket,
bool visible,
int numverts,
int vtxarrayindex)
:m_bucket(bucket),
m_vertexindexbase(numverts),
m_numverts(numverts),
m_edgecode(65535)
RAS_Polygon::RAS_Polygon(RAS_MaterialBucket* bucket, RAS_DisplayArray *darray, int numvert)
{
m_vertexindexbase.m_vtxarray = vtxarrayindex ;//m_bucket->FindVertexArray(numverts);
m_polyFlags.Visible = visible;
m_bucket = bucket;
m_darray = darray;
m_offset[0]= m_offset[1]= m_offset[2]= m_offset[3]= 0;
m_numvert = numvert;
m_edgecode = 255;
m_polyflags = 0;
}
int RAS_Polygon::VertexCount()
{
return m_numverts;
return m_numvert;
}
void RAS_Polygon::SetVertex(int i,
unsigned int vertexindex ) //const MT_Point3& xyz,const MT_Point2& uv,const unsigned int rgbacolor,const MT_Vector3& normal)
void RAS_Polygon::SetVertexOffset(int i, unsigned short offset)
{
m_vertexindexbase.SetIndex(i,vertexindex); //m_bucket->FindOrAddVertex(m_vertexindexbase.m_vtxarray,
//xyz,uv,rgbacolor,normal));
m_offset[i] = offset;
}
const KX_VertexIndex& RAS_Polygon::GetIndexBase()
RAS_TexVert *RAS_Polygon::GetVertex(int i)
{
return m_vertexindexbase;
return &m_darray->m_vertex[m_offset[i]];
}
void RAS_Polygon::SetVisibleWireframeEdges(int edgecode)
int RAS_Polygon::GetVertexOffset(int i)
{
m_edgecode = edgecode;
return m_offset[i];
}
// each bit is for a visible edge, starting with bit 1 for the first edge, bit 2 for second etc.
int RAS_Polygon::GetEdgeCode()
{
return m_edgecode;
}
void RAS_Polygon::SetEdgeCode(int edgecode)
{
m_edgecode = edgecode;
}
bool RAS_Polygon::IsVisible()
{
return m_polyFlags.Visible;
return (m_polyflags & VISIBLE) != 0;
}
void RAS_Polygon::SetVisible(bool visible)
{
if(visible) m_polyflags |= VISIBLE;
else m_polyflags &= ~VISIBLE;
}
bool RAS_Polygon::IsCollider()
{
return m_polyFlags.Collider;
return (m_polyflags & COLLIDER) != 0;
}
void RAS_Polygon::SetCollider(bool col)
void RAS_Polygon::SetCollider(bool visible)
{
m_polyFlags.Collider = col;
if(visible) m_polyflags |= COLLIDER;
else m_polyflags &= ~COLLIDER;
}
KX_VertexIndex& RAS_Polygon::GetVertexIndexBase()
{
return m_vertexindexbase;
}
RAS_MaterialBucket* RAS_Polygon::GetMaterial()
RAS_MaterialBucket* RAS_Polygon::GetMaterial()
{
return m_bucket;
}
RAS_DisplayArray* RAS_Polygon::GetDisplayArray()
{
return m_darray;
}