[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15507] branches/apricot/source: Apricot Branch: GLSL
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed Jul 9 21:15:20 CEST 2008
Revision: 15507
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15507
Author: blendix
Date: 2008-07-09 21:15:15 +0200 (Wed, 09 Jul 2008)
Log Message:
-----------
Apricot Branch: GLSL
====================
ATI fixes:
* Fix crash in glBitmap when rendering shadow buffers, it doesn't
seem to like using that function with only a depth buffer.
* Workaround either a bug in the driver or Blender, but I couldn't
find anything wrong, glVertexAttribPointerARB doesn't seem to
work inside display lists, so now it uses immediate mode to
create the list.
* Making deformable object for the game engine didn't check properly
if there was actually a vertex group, causing some static objects
to not use display lists.
* Also some cleanup in the game engine drawing code, replacing magic
numbers with an enum.
The apricot demo seems to runs slightly faster on a ATI HD3750 than
NVidia 8800 GTS.
Modified Paths:
--------------
branches/apricot/source/blender/gpu/intern/gpu_extensions.c
branches/apricot/source/blender/src/drawarmature.c
branches/apricot/source/blender/src/drawobject.c
branches/apricot/source/blender/src/editdeform.c
branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_BucketManager.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_IRasterizer.h
branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.h
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
Modified: branches/apricot/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- branches/apricot/source/blender/gpu/intern/gpu_extensions.c 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/blender/gpu/intern/gpu_extensions.c 2008-07-09 19:15:15 UTC (rev 15507)
@@ -65,19 +65,8 @@
- arb draw buffers? 2.0 core
*/
-/* TODO: we also use GL_ARB_texture_border_clamp or GL_SGIS_texture_border_clamp,
- but seems to be widely supported on anything running fragment programs */
-
-/* TODO: GeforceFX float support, the issue is:
- ARB/ATI_texture_float is not supported on nv30 (GeforceFX)
- NV_float_buffer is, but only works with GL_TEXTURE_RECTANGLE
- but ATI doesn't support sampler2DRect in glsl! */
-
-#define MAX_ATTACHMENTS 16
-
struct GPUGlobal {
GLint maxtextures;
- GLint maxfbcolor;
GLuint currentfb;
GLenum halfformat;
struct GPUGlobalLimits {
@@ -101,11 +90,6 @@
if (GLEW_ARB_multitexture)
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &GG.maxtextures);
- if (GLEW_EXT_framebuffer_object) {
- glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &GG.maxfbcolor);
- if (GG.maxfbcolor > MAX_ATTACHMENTS)
- GG.maxfbcolor = MAX_ATTACHMENTS;
- }
if (GLEW_ATI_texture_float || GLEW_ARB_texture_float) {
GG.halfformat = (GLEW_ATI_texture_float)? GL_RGBA_FLOAT16_ATI: GL_RGBA16F_ARB;
}
Modified: branches/apricot/source/blender/src/drawarmature.c
===================================================================
--- branches/apricot/source/blender/src/drawarmature.c 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/blender/src/drawarmature.c 2008-07-09 19:15:15 UTC (rev 15507)
@@ -2505,6 +2505,9 @@
Object *ob= base->object;
bArmature *arm= ob->data;
int retval= 0;
+
+ if(G.f & G_SIMULATION)
+ return;
if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
/* we use color for solid lighting */
Modified: branches/apricot/source/blender/src/drawobject.c
===================================================================
--- branches/apricot/source/blender/src/drawobject.c 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/blender/src/drawobject.c 2008-07-09 19:15:15 UTC (rev 15507)
@@ -419,6 +419,9 @@
float v1[3]= {0.0, 0.0, 0.0};
float v2[3]= {0.0, 0.0, 0.0};
float v3[3]= {0.0, 0.0, 0.0};
+
+ if(G.f & G_SIMULATION)
+ return;
switch(drawtype) {
@@ -801,6 +804,9 @@
float pixsize, lampsize;
float imat[4][4], curcol[4];
char col[4];
+
+ if(G.f & G_SIMULATION)
+ return;
la= ob->data;
@@ -1091,6 +1097,9 @@
float vec[8][4], tmat[4][4], fac, facx, facy, depth;
int i;
+ if(G.f & G_SIMULATION)
+ return;
+
cam= ob->data;
glDisable(GL_LIGHTING);
@@ -1894,6 +1903,9 @@
struct EditFace *efa=NULL;
float v1[3], v2[3], v3[3], v4[3], fvec[3], col[3];
char val[32];
+
+ if(G.f & G_SIMULATION)
+ return;
if(G.vd->zbuf && (G.vd->flag & V3D_ZBUF_SELECT)==0)
glDisable(GL_DEPTH_TEST);
@@ -1958,6 +1970,9 @@
char conv_float[5]; /* Use a float conversion matching the grid size */
float area, col[3]; /* area of the face, color of the text to draw */
+ if(G.f & G_SIMULATION)
+ return;
+
/* make the precission of the pronted value proportionate to the gridsize */
if ((G.vd->grid) < 0.01)
strcpy(conv_float, "%.6f");
@@ -2459,6 +2474,8 @@
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
+
+ set_gl_material(-1);
}
else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mcol) {
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
@@ -4735,9 +4752,8 @@
drawDispListwire(&ob->disp);
}
else if(ob->type==OB_ARMATURE) {
- if(!(ob->flag & OB_POSEMODE)) {
+ if(!(ob->flag & OB_POSEMODE))
draw_armature(base, OB_WIRE, 0);
- }
}
glLineWidth(1.0);
@@ -5252,9 +5268,8 @@
}
/* draw extra: after normal draw because of makeDispList */
- if(dtx) {
- if(G.f & G_SIMULATION);
- else if(dtx & OB_AXIS) {
+ if(dtx && !(G.f & G_SIMULATION)) {
+ if(dtx & OB_AXIS) {
drawaxes(1.0f, flag, OB_ARROWS);
}
if(dtx & OB_BOUNDBOX) draw_bounding_volume(ob);
Modified: branches/apricot/source/blender/src/editdeform.c
===================================================================
--- branches/apricot/source/blender/src/editdeform.c 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/blender/src/editdeform.c 2008-07-09 19:15:15 UTC (rev 15507)
@@ -270,7 +270,7 @@
int a;
/* these cases don't use names to refer to vertex groups, so when
- * they get deleted the numbers get out of synce, this corrects that */
+ * they get deleted the numbers get out of sync, this corrects that */
if(ob->soft) {
if(ob->soft->vertgroup == id)
Modified: branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2008-07-09 19:15:15 UTC (rev 15507)
@@ -1656,7 +1656,7 @@
// two options exists for deform: shape keys and armature
// only support relative shape key
bool bHasShapeKey = mesh->key != NULL && mesh->key->type==KEY_RELATIVE;
- bool bHasDvert = mesh->dvert != NULL;
+ bool bHasDvert = mesh->dvert != NULL && ob->defbase.first;
bool bHasArmature = (ob->parent && ob->parent->type == OB_ARMATURE && ob->partype==PARSKEL && bHasDvert);
if (bHasShapeKey) {
@@ -2073,7 +2073,8 @@
if (blenderscene->camera) {
KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera);
- kxscene->SetActiveCamera(gamecamera);
+ if(gamecamera)
+ kxscene->SetActiveCamera(gamecamera);
}
// Set up armatures
Modified: branches/apricot/source/gameengine/Rasterizer/RAS_BucketManager.cpp
===================================================================
--- branches/apricot/source/gameengine/Rasterizer/RAS_BucketManager.cpp 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/gameengine/Rasterizer/RAS_BucketManager.cpp 2008-07-09 19:15:15 UTC (rev 15507)
@@ -109,7 +109,7 @@
// it is needed for compatibility.
rasty->SetDepthMask(RAS_IRasterizer::KX_DEPTHMASK_DISABLED);
- int drawingmode;
+ RAS_IRasterizer::DrawMode drawingmode;
std::multiset< alphamesh, backtofront>::iterator msit = alphameshset.begin();
for (; msit != alphameshset.end(); ++msit)
{
Modified: branches/apricot/source/gameengine/Rasterizer/RAS_IRasterizer.h
===================================================================
--- branches/apricot/source/gameengine/Rasterizer/RAS_IRasterizer.h 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/gameengine/Rasterizer/RAS_IRasterizer.h 2008-07-09 19:15:15 UTC (rev 15507)
@@ -33,13 +33,24 @@
#pragma warning (disable:4786)
#endif
+#include "STR_HashedString.h"
+
#include "MT_CmMatrix4x4.h"
#include "MT_Matrix4x4.h"
+#include "RAS_TexVert.h"
+
+#include <vector>
+using namespace std;
+
class RAS_ICanvas;
class RAS_IPolyMaterial;
-#include "RAS_MaterialBucket.h"
+typedef vector<unsigned short> KX_IndexArray;
+typedef vector<RAS_TexVert> KX_VertexArray;
+typedef vector< KX_VertexArray* > vecVertexArray;
+typedef vector< KX_IndexArray* > vecIndexArrays;
+
/**
* 3D rendering device context interface.
*/
@@ -67,6 +78,16 @@
};
/**
+ * Drawing modes
+ */
+
+ enum DrawMode {
+ KX_MODE_LINES = 1,
+ KX_MODE_TRIANGLES,
+ KX_MODE_QUADS
+ };
+
+ /**
* Valid SetDepthMask parameters
*/
enum DepthMask {
@@ -199,45 +220,37 @@
* 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 mode determines the type of primitive stored in the vertex/index arrays
* @param useObjectColor will render the object using @param rgbacolor instead of
* vertex colors.
*/
- virtual void IndexPrimitives( const vecVertexArray& vertexarrays,
+ virtual void IndexPrimitives( const vecVertexArray& vertexarrays,
const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
+ DrawMode mode,
bool useObjectColor,
const MT_Vector4& rgbacolor,
class KX_ListSlot** slot)=0;
+ virtual void IndexPrimitivesMulti(
+ const vecVertexArray& vertexarrays,
+ const vecIndexArrays & indexarrays,
+ DrawMode mode,
+ bool useObjectColor,
+ const MT_Vector4& rgbacolor,
+ class KX_ListSlot** slot)=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,
+ DrawMode mode,
class RAS_IPolyMaterial* polymat,
class RAS_IRenderTools* rendertools,
bool useObjectColor,
const MT_Vector4& rgbacolor)=0;
- virtual void IndexPrimitivesMulti(
- const vecVertexArray& vertexarrays,
- const vecIndexArrays & indexarrays,
- int mode,
- class RAS_IPolyMaterial* polymat,
- class RAS_IRenderTools* rendertools,
- bool useObjectColor,
- const MT_Vector4& rgbacolor,
- class KX_ListSlot** slot)=0;
-
virtual void SetProjectionMatrix(MT_CmMatrix4x4 & mat)=0;
/* This one should become our final version, methinks. */
/**
Modified: branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
===================================================================
--- branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp 2008-07-09 18:36:35 UTC (rev 15506)
+++ branches/apricot/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp 2008-07-09 19:15:15 UTC (rev 15507)
@@ -167,7 +167,7 @@
}
bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_IRasterizer* rasty,
- RAS_IRenderTools *rendertools, int &drawmode)
+ RAS_IRenderTools *rendertools, RAS_IRasterizer::DrawMode &drawmode)
{
rendertools->SetViewMat(cameratrans);
@@ -179,14 +179,18 @@
else
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list