diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-04-11 06:50:02 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-04-11 06:50:02 +0400 |
commit | ae9233a5b05ebfc925fd542afbdb3bb9220ed65c (patch) | |
tree | 46ed278ee54325ca98540163edf9ea5dd4a88c7f /source/gameengine/Rasterizer | |
parent | d3e88eae711e2fd5d678ed555268647e28a9fc18 (diff) |
1. Check material names passed to the physics engine (for collision sensors.)
Consider:
gameobj->getClientInfo()->m_auxilary_info = (matname ? (void*)(matname+2) : NULL);
It works if matname is "MAblah", but not if matname is "".
2. Added constructor for struct RAS_CameraData.
3. Added initializers to the struct KX_ClientObjectInfo constructor
4. Collision sensors won't detect near sensors.
5. A stack of minor tweaks, adjusting whitespace, using ++it for stl stuff.
Diffstat (limited to 'source/gameengine/Rasterizer')
5 files changed, 63 insertions, 11 deletions
diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h index b136aedf405..a4245025f2a 100644 --- a/source/gameengine/Rasterizer/RAS_CameraData.h +++ b/source/gameengine/Rasterizer/RAS_CameraData.h @@ -37,6 +37,15 @@ struct RAS_CameraData float m_lens; float m_clipstart; float m_clipend; + bool m_perspective; + + RAS_CameraData(float lens = 35., float clipstart = 0.1, float clipend = 100., bool perspective = true) : + m_lens(lens), + m_clipstart(clipstart), + m_clipend(clipend), + m_perspective(perspective) + { + } }; #endif //__RAS_CAMERADATA_H diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 144342e86cf..9871c0b67d6 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -94,8 +94,12 @@ public: virtual void ClearDepthBuffer()=0; virtual void ClearCachingInfo(void)=0; virtual void EndFrame()=0; + /** + * SetRenderArea sets the render area in the 2d canvas + */ virtual void SetRenderArea()=0; + // Stereo Functions virtual void SetStereoMode(const int stereomode)=0; virtual bool Stereo()=0; virtual void SetEye(const int eye)=0; @@ -103,6 +107,20 @@ public: virtual void SetFocalLength(const float focallength)=0; virtual void SwapBuffers()=0; + + // Drawing Functions + /** + * IndexPrimitives: Renders primitives. + * @param vertexarrays is an array of vertex arrays + * @param indexarrays is an array of index arrays + * @param mode determines the type of primitive stored in the vertex/index arrays: + * 0 triangles + * 1 lines (default) + * 2 quads + * @param polymat (reserved) + * @param useObjectColor will render the object using @param rgbacolor instead of + * vertex colours. + */ virtual void IndexPrimitives( const vecVertexArray& vertexarrays, const vecIndexArrays & indexarrays, int mode, @@ -110,6 +128,10 @@ public: class RAS_IRenderTools* rendertools, bool useObjectColor, const MT_Vector4& rgbacolor)=0; + /** + * IndexPrimitivesEx: See IndexPrimitives. + * IndexPrimitivesEx will renormalize faces if @param vertexarrays[i].getFlag() & TV_CALCFACENORMAL + */ virtual void IndexPrimitives_Ex( const vecVertexArray& vertexarrays, const vecIndexArrays & indexarrays, int mode, @@ -117,6 +139,10 @@ public: class RAS_IRenderTools* rendertools, bool useObjectColor, const MT_Vector4& rgbacolor)=0; + /** + * IndexPrimitives_3DText will render text into the polygons. + * The text to be rendered is from @param rendertools client object's text property. + */ virtual void IndexPrimitives_3DText( const vecVertexArray& vertexarrays, const vecIndexArrays & indexarrays, int mode, @@ -161,12 +187,18 @@ public: float blue, float alpha)=0; + /** + * @param drawingmode = KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED. + */ virtual void SetDrawingMode(int drawingmode)=0; virtual int GetDrawingMode()=0; virtual void EnableTextures(bool enable)=0; virtual void SetCullFace(bool enable)=0; + /** + * Sets wireframe mode. + */ virtual void SetLines(bool enable)=0; virtual double GetTime()=0; @@ -177,7 +209,8 @@ public: float bottom, float top, float frustnear, - float frustfar + float frustfar, + bool perspective = true )=0; virtual void SetSpecularity(float specX, diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index b7f375e770c..647fb21988a 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -68,7 +68,7 @@ RAS_OpenGLRasterizer::~RAS_OpenGLRasterizer() -void Myinit_gl_stuff(void) +static void Myinit_gl_stuff(void) { float mat_specular[] = { 0.5, 0.5, 0.5, 1.0 }; float mat_shininess[] = { 35.0 }; @@ -259,7 +259,7 @@ void RAS_OpenGLRasterizer::Exit() glClearDepth(1.0); glClearColor(m_redback, m_greenback, m_blueback, m_alphaback); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glDepthMask (GL_TRUE); + glDepthMask (GL_TRUE); glDepthFunc(GL_LEQUAL); glBlendFunc(GL_ONE, GL_ZERO); @@ -292,7 +292,7 @@ bool RAS_OpenGLRasterizer::BeginFrame(int drawingmode, double time) glShadeModel(GL_SMOOTH); - m_2DCanvas->BeginFrame(); + m_2DCanvas->BeginFrame(); return true; } @@ -1083,7 +1083,8 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( float bottom, float top, float frustnear, - float frustfar + float frustfar, + bool perspective ){ MT_Matrix4x4 result; double mat[16]; @@ -1110,10 +1111,11 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix( } // leave bottom, top, bottom and top untouched } - + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(left, right, bottom, top, frustnear, frustfar); + glGetDoublev(GL_PROJECTION_MATRIX, mat); result.setValue(mat); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 24f0e42c91d..d7488b9901a 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -203,7 +203,8 @@ public: float bottom, float top, float frustnear, - float frustfar + float frustfar, + bool perspective ); virtual void SetSpecularity( diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp index 4ce030ed484..8a51a25e6aa 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp @@ -73,10 +73,6 @@ bool RAS_VAOpenGLRasterizer::Init(void) if (result) { - // if possible, add extensions to other platforms too, if this - // rasterizer becomes messy just derive one for each platform - // (ie. KX_Win32Rasterizer, KX_LinuxRasterizer etc.) - glEnableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); @@ -187,6 +183,17 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives( const vecVertexArray& vertexarrays glColor3d(0,0,0); } // use glDrawElements to draw each vertexarray + static bool doWarning = true; + if (vertexarrays.size() > 1 && doWarning) + { + /* TODO: if vertexarrays.size() == 1 then if we are multitexturing + we can glLockArraysEXT the vertex arrays - GL will be able to cache + the vertex transforms. */ + std::cout << "# vertex arrays: " << vertexarrays.size() << std::endl; + std::cout << "I wondered if this could happen: please inform the proper authorities." << std::endl; + doWarning = false; + } + for (vt=0;vt<vertexarrays.size();vt++) { vertexarray = &((*vertexarrays[vt]) [0]); |