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:
authorErwin Coumans <blender@erwincoumans.com>2006-01-15 14:34:55 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-01-15 14:34:55 +0300
commit6f3e5931052727358201e6648bd6011d99085414 (patch)
treeb3893dc8bacb90a02dc9c9ed251b590a429496fe
parente35f73cd00f878706cd953fc3514e0b68b1b6f65 (diff)
more graphics patches from Snailrose,
remove constraint fixed, Bullet timestep now subdivides Blender game engine timestep, so it runs 60 hertz, SphereShape reverted to old style, so no support for non-uniform scaled spheres for now,
-rw-r--r--extern/bullet/Bullet/Bullet3_vc8.vcproj53
-rw-r--r--extern/bullet/Bullet/CollisionShapes/SphereShape.cpp36
-rw-r--r--extern/bullet/Bullet/CollisionShapes/SphereShape.h16
-rw-r--r--extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp2
-rw-r--r--extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp6
-rw-r--r--extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h6
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp13
-rw-r--r--source/gameengine/Ketsji/BL_Material.h3
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp44
-rw-r--r--source/gameengine/Ketsji/BL_Shader.h17
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp179
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h5
-rw-r--r--source/gameengine/Ketsji/KX_PyConstraintBinding.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_PythonInit.cpp100
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp52
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h4
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp2
-rw-r--r--source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h2
-rw-r--r--source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp8
-rw-r--r--source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp2
-rw-r--r--source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h2
-rw-r--r--source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h2
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp4
23 files changed, 354 insertions, 206 deletions
diff --git a/extern/bullet/Bullet/Bullet3_vc8.vcproj b/extern/bullet/Bullet/Bullet3_vc8.vcproj
index b9046f451e5..4c8bc67557b 100644
--- a/extern/bullet/Bullet/Bullet3_vc8.vcproj
+++ b/extern/bullet/Bullet/Bullet3_vc8.vcproj
@@ -42,6 +42,7 @@
Optimization="0"
AdditionalIncludeDirectories=".;..\LinearMath"
PreprocessorDefinitions="_DEBUG;_LIB;WIN32;BUM_INLINED;USE_ALGEBRAIC"
+ ExceptionHandling="0"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -273,6 +274,14 @@
>
</File>
<File
+ RelativePath=".\NarrowPhaseCollision\ManifoldContactAddResult.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\NarrowPhaseCollision\ManifoldContactAddResult.h"
+ >
+ </File>
+ <File
RelativePath=".\NarrowPhaseCollision\ManifoldPoint.h"
>
</File>
@@ -369,6 +378,14 @@
>
</File>
<File
+ RelativePath=".\CollisionShapes\ConvexTriangleCallback.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\ConvexTriangleCallback.h"
+ >
+ </File>
+ <File
RelativePath=".\CollisionShapes\CylinderShape.cpp"
>
</File>
@@ -377,6 +394,14 @@
>
</File>
<File
+ RelativePath=".\CollisionShapes\EmptyShape.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\EmptyShape.h"
+ >
+ </File>
+ <File
RelativePath=".\CollisionShapes\MinkowskiSumShape.cpp"
>
</File>
@@ -425,6 +450,10 @@
>
</File>
<File
+ RelativePath=".\CollisionShapes\TriangleCallback.cpp"
+ >
+ </File>
+ <File
RelativePath=".\CollisionShapes\TriangleCallback.h"
>
</File>
@@ -549,6 +578,30 @@
>
</File>
</Filter>
+ <File
+ RelativePath=".\CollisionShapes\BvhTriangleMeshShape.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\BvhTriangleMeshShape.h"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\OptimizedBvh.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\OptimizedBvh.h"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\TriangleIndexVertexArray.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\CollisionShapes\TriangleIndexVertexArray.h"
+ >
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp b/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp
index bbffb8137de..37d34a65948 100644
--- a/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp
+++ b/extern/bullet/Bullet/CollisionShapes/SphereShape.cpp
@@ -22,14 +22,7 @@ SphereShape ::SphereShape (SimdScalar radius)
SimdVector3 SphereShape::LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const
{
- float radius = m_radius - GetMargin();
-
- SimdScalar len = vec.length2();
- if (SimdFabs(len) < 0.0001f)
- {
- return SimdVector3(m_localScaling[0] * radius,m_localScaling[1]*radius,m_localScaling[2]*radius);
- }
- return vec * (m_localScaling*(radius / SimdSqrt(len)));
+ return SimdVector3(0.f,0.f,0.f);
}
SimdVector3 SphereShape::LocalGetSupportingVertex(const SimdVector3& vec)const
@@ -37,38 +30,31 @@ SimdVector3 SphereShape::LocalGetSupportingVertex(const SimdVector3& vec)const
SimdVector3 supVertex;
supVertex = LocalGetSupportingVertexWithoutMargin(vec);
- if ( GetMargin()!=0.f )
+ SimdVector3 vecnorm = vec;
+ if (SimdFuzzyZero(vecnorm .length2()))
{
- SimdVector3 vecnorm = vec;
- if (vecnorm .length2() == 0.f)
- {
- vecnorm.setValue(-1.f,-1.f,-1.f);
- }
- vecnorm.normalize();
- supVertex+= GetMargin() * vecnorm;
- }
+ vecnorm.setValue(-1.f,-1.f,-1.f);
+ }
+ vecnorm.normalize();
+ supVertex+= GetMargin() * vecnorm;
return supVertex;
}
-/*
+
//broken due to scaling
void SphereShape::GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const
{
const SimdVector3& center = t.getOrigin();
- SimdScalar radius = m_radius;
-
- SimdVector3 extent = m_localScaling*radius;
- extent+= SimdVector3(GetMargin(),GetMargin(),GetMargin());
-
+ SimdVector3 extent(GetMargin(),GetMargin(),GetMargin());
aabbMin = center - extent;
aabbMax = center + extent;
}
-*/
+
void SphereShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
{
- SimdScalar elem = 0.4f * mass * m_radius*m_radius;
+ SimdScalar elem = 0.4f * mass * GetMargin()*GetMargin();
inertia[0] = inertia[1] = inertia[2] = elem;
} \ No newline at end of file
diff --git a/extern/bullet/Bullet/CollisionShapes/SphereShape.h b/extern/bullet/Bullet/CollisionShapes/SphereShape.h
index 82c00ea43eb..235af6c4db2 100644
--- a/extern/bullet/Bullet/CollisionShapes/SphereShape.h
+++ b/extern/bullet/Bullet/CollisionShapes/SphereShape.h
@@ -20,7 +20,7 @@ class SphereShape : public ConvexShape
{
SimdScalar m_radius;
-
+
public:
SphereShape (SimdScalar radius);
@@ -31,7 +31,7 @@ public:
virtual void CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
- //virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
+ virtual void GetAabb(const SimdTransform& t,SimdVector3& aabbMin,SimdVector3& aabbMax) const;
virtual int GetShapeType() const { return SPHERE_SHAPE_PROXYTYPE; }
@@ -40,6 +40,18 @@ public:
//debugging
virtual char* GetName()const {return "SPHERE";}
+ virtual void SetMargin(float margin)
+ {
+ ConvexShape::SetMargin(margin);
+ }
+ virtual float GetMargin() const
+ {
+ //to improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case
+ //this means, non-uniform scaling is not supported anymore
+ return m_localScaling[0] * m_radius + ConvexShape::GetMargin();
+ }
+
+
};
diff --git a/extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp b/extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp
index f7e41e61824..a7375e78d38 100644
--- a/extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp
+++ b/extern/bullet/BulletDynamics/CollisionDispatch/ConvexConcaveCollisionAlgorithm.cpp
@@ -153,7 +153,7 @@ void ConvexConcaveCollisionAlgorithm::ProcessCollision (BroadphaseProxy* ,Broadp
if (m_convex.IsConvexShape())
{
- float collisionMarginTriangle = 0.02f;//triangleMesh->GetMargin();
+ float collisionMarginTriangle = triangleMesh->GetMargin();
m_boxTriangleCallback.SetTimeStepAndCounters(timeStep,stepCount, collisionMarginTriangle,useContinuous);
#ifdef USE_BOX_TRIANGLE
diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp b/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp
index 9471c1faf7c..81b75e6e1b8 100644
--- a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp
+++ b/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.cpp
@@ -14,17 +14,20 @@
static RigidBody s_fixed(MassProps(0,SimdVector3(0.f,0.f,0.f)),0.f,0.f,1.f,1.f);
+static int gConstraintId = 1;
Point2PointConstraint::Point2PointConstraint():
m_rbA(s_fixed),m_rbB(s_fixed)
{
+ m_constraintId = gConstraintId++;//just create some unique ID for now
+
s_fixed.setMassProps(0.f,SimdVector3(0.f,0.f,0.f));
}
Point2PointConstraint::Point2PointConstraint(RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB)
:m_rbA(rbA),m_rbB(rbB),m_pivotInA(pivotInA),m_pivotInB(pivotInB)
{
-
+ m_constraintId = gConstraintId++;//just create some unique ID for now
}
@@ -32,6 +35,7 @@ Point2PointConstraint::Point2PointConstraint(RigidBody& rbA,const SimdVector3& p
:m_rbA(rbA),m_rbB(s_fixed),m_pivotInA(pivotInA),m_pivotInB(rbA.getCenterOfMassTransform()(pivotInA))
{
s_fixed.setMassProps(0.f,SimdVector3(1e10f,1e10f,1e10f));
+ m_constraintId = gConstraintId++;//just create some unique ID for now
}
void Point2PointConstraint::BuildJacobian()
diff --git a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h b/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h
index 82b4dcc83db..59b7a5576c4 100644
--- a/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h
+++ b/extern/bullet/BulletDynamics/ConstraintSolver/Point2PointConstraint.h
@@ -27,6 +27,7 @@ class Point2PointConstraint
SimdVector3 m_pivotInA;
SimdVector3 m_pivotInB;
+ int m_constraintId;
public:
Point2PointConstraint(RigidBody& rbA,RigidBody& rbB, const SimdVector3& pivotInA,const SimdVector3& pivotInB);
@@ -50,6 +51,11 @@ public:
return m_rbB;
}
+ int GetConstraintId()
+ {
+ return m_constraintId;
+ }
+
};
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index a2801db7069..10d5e65ed9f 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -352,7 +352,7 @@ BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, TFace* tface, MFace*
material->flag[i] |= ( tface->transp &TF_ADD )?CALCALPHA:0;
material->ras_mode|= ( tface->transp &(TF_ADD | TF_ALPHA))?TRANSP:0;
material->mapping[i].mapping |= ( (material->img[i]->flag & IMA_REFLECT)!=0 )?USEREFL:0;
- material->blend_mode[i] = BLEND_MUL;
+ //material->blend_mode[i] = BLEND_MUL;
i++;// skip to the next image
valid_index++;
}
@@ -371,12 +371,13 @@ BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, TFace* tface, MFace*
// -----------------------
if( mttmp->tex->imaflag &TEX_USEALPHA ) {
material->flag[i] |= USEALPHA;
- material->ras_mode |= TRANSP;
}
// -----------------------
else if( mttmp->tex->imaflag &TEX_CALCALPHA ) {
material->flag[i] |= CALCALPHA;
- material->ras_mode |= TRANSP;
+ }
+ else if(mttmp->tex->flag &TEX_NEGALPHA) {
+ material->flag[i] |= USENEGALPHA;
}
material->color_blend[i] = mttmp->colfac;
@@ -845,8 +846,10 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools*
// -----------------------------------
// pre calculate texture generation
- for(int matid=0; matid<meshobj->NumMaterials(); matid++)
- meshobj->GetMaterialBucket(matid)->GetPolyMaterial()->OnConstruction();
+ for(RAS_MaterialBucket::Set::iterator mit = meshobj->GetFirstMaterial();
+ mit != meshobj->GetLastMaterial(); ++ mit) {
+ (*mit)->GetPolyMaterial()->OnConstruction();
+ }
// -----------------------------------
diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h
index 0b8856690d4..cf753414245 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -112,7 +112,8 @@ enum BL_flag
USEALPHA=4, // use actual alpha channel
TEXALPHA=8, // use alpha combiner functions
TEXNEG=16, // negate blending
- HASIPO=32
+ HASIPO=32,
+ USENEGALPHA=64
};
// BL_Material::ras_mode
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index 369fc58fc50..4cc01f820cf 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -31,7 +31,7 @@ const bool BL_Shader::Ok()const
return (mShader !=0 && mOk && mUse);
}
-BL_Shader::BL_Shader(int n, PyTypeObject *T)
+BL_Shader::BL_Shader(PyTypeObject *T)
: PyObjectPlus(T),
mShader(0),
mVert(0),
@@ -44,15 +44,7 @@ BL_Shader::BL_Shader(int n, PyTypeObject *T)
{
// if !RAS_EXT_support._ARB_shader_objects this class will not be used
- mBlending.src = -1;
- mBlending.dest = -1;
- mBlending.const_color[0] = 0.0;
- mBlending.const_color[1] = 0.0;
- mBlending.const_color[2] = 0.0;
- mBlending.const_color[3] = 1.0;
-
- for (int i=0; i<MAXTEX; i++)
- {
+ for (int i=0; i<MAXTEX; i++) {
mSampler[i].type = 0;
mSampler[i].pass = 0;
mSampler[i].unit = -1;
@@ -234,13 +226,6 @@ const uSampler* BL_Shader::getSampler(int i)
return &mSampler[i];
}
-const uBlending *BL_Shader::getBlending( int pass )
-{
- return &mBlending;
-}
-
-
-
void BL_Shader::InitializeSampler(
int type,
int unit,
@@ -287,7 +272,6 @@ PyMethodDef BL_Shader::Methods[] =
KX_PYMETHODTABLE( BL_Shader, setSampler ),
KX_PYMETHODTABLE( BL_Shader, setUniformMatrix4 ),
KX_PYMETHODTABLE( BL_Shader, setUniformMatrix3 ),
- // KX_PYMETHODTABLE( BL_Shader, setBlending ),
{NULL,NULL} //Sentinel
};
@@ -368,7 +352,6 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
}
-
KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
{
return PyInt_FromLong( ( mShader !=0 && mOk ) );
@@ -384,21 +367,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" )
return PyString_FromString(fragProg?fragProg:"");
}
-
KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
{
#ifdef GL_ARB_shader_objects
- if(mShader==0)
- {
+ if(mShader==0) {
PyErr_Format(PyExc_TypeError, "invalid shader object");
return NULL;
}
-
int stat = 0;
bgl::blValidateProgramARB(mShader);
bgl::blGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB, &stat);
-
- return PyInt_FromLong((stat!=0));
+ return PyInt_FromLong(!PrintInfo(stat, mShader, "Validation"));
#else
Py_Return;
#endif//GL_ARB_shader_objects
@@ -446,7 +425,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )
if(!PyArg_ParseTuple(args, "i", &pass))
return NULL;
- mPass = pass;
+ mPass = 1;
Py_Return;
}
@@ -927,16 +906,3 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
Py_Return;
#endif//GL_ARB_shader_objects
}
-
-
-KX_PYMETHODDEF_DOC( BL_Shader, setBlending, "setBlending(src, dest)" )
-{
- int src, dest;
- if(PyArg_ParseTuple(args, "ii", &src, &dest))
- {
- mBlending.src = src;
- mBlending.dest = dest;
- Py_Return;
- }
- return NULL;
-}
diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h
index 2e08eeb0d70..004fd33b651 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -18,17 +18,6 @@ typedef struct uSampler
#define SAMP_2D 1
#define SAMP_CUBE 2
-
-// -----------------------------------
-typedef struct uBlending
-{
- unsigned int pass;
- int src; // GL_ blend func values
- int dest;
- float const_color[4];
-}uBlending;
-// -----------------------------------
-
// ----------------
class BL_Shader : public PyObjectPlus
{
@@ -41,14 +30,13 @@ private:
bool mOk;
bool mUse;
uSampler mSampler[MAXTEX];
- uBlending mBlending;
char* vertProg;
char* fragProg;
bool LinkProgram();
bool PrintInfo(int len, unsigned int handle, const char *type);
public:
- BL_Shader(int n, PyTypeObject *T=&Type);
+ BL_Shader(PyTypeObject *T=&Type);
virtual ~BL_Shader();
char* GetVertPtr();
@@ -63,7 +51,6 @@ public:
// ---
// access
const uSampler* getSampler(int i);
- const uBlending* getBlending( int pass );
const bool Ok()const;
unsigned int GetProg();
@@ -108,8 +95,6 @@ public:
// these come from within the material buttons
// sampler2d/samplerCube work
KX_PYMETHOD_DOC( BL_Shader, setSampler);
- // user blending funcs
- KX_PYMETHOD_DOC( BL_Shader, setBlending );
};
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 5a41328f489..cbb52133813 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -22,6 +22,7 @@
#include "KX_Scene.h"
#include "KX_Light.h"
#include "KX_GameObject.h"
+#include "KX_MeshProxy.h"
#include "MT_Vector3.h"
#include "MT_Vector4.h"
@@ -75,7 +76,9 @@ KX_BlenderMaterial::KX_BlenderMaterial(
mMaterial(data),
mShader(0),
mScene(scene),
+ mUserDefBlend(0),
mPass(0)
+
{
///RAS_EXT_support._ARB_multitexture == true if were here
@@ -101,8 +104,8 @@ KX_BlenderMaterial::KX_BlenderMaterial(
// prevent material bleeding
for(int i=0; i<mMaterial->num_enabled; i++) {
m_multimode +=
- (mMaterial->flag[i] +
- mMaterial->blend_mode[i]
+ ( mMaterial->flag[i] +
+ mMaterial->blend_mode[i]
);
}
m_multimode += mMaterial->IdMode+mMaterial->ras_mode;
@@ -132,11 +135,6 @@ void KX_BlenderMaterial::OnConstruction()
if(!gTextureDict)
gTextureDict = PyDict_New();
*/
- #ifdef GL_ARB_shader_objects
- if( RAS_EXT_support._ARB_shader_objects )
- mShader = new BL_Shader( mMaterial->num_enabled );
- #endif
-
int i;
for(i=0; i<mMaterial->num_enabled; i++) {
bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i);
@@ -149,9 +147,6 @@ void KX_BlenderMaterial::OnConstruction()
if(!mTextures[i].InitCubeMap( mMaterial->cubemap[i] ) )
spit("unable to initialize image("<<i<<") in "<<
mMaterial->matname<< ", image will not be available");
-
- if( RAS_EXT_support._ARB_shader_objects )
- mShader->InitializeSampler(SAMP_CUBE, i, 0, mTextures[i]);
}
else {
@@ -160,9 +155,6 @@ void KX_BlenderMaterial::OnConstruction()
if( ! mTextures[i].InitFromImage(mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 ))
spit("unable to initialize image("<<i<<") in "<<
mMaterial->matname<< ", image will not be available");
-
- if( RAS_EXT_support._ARB_shader_objects )
- mShader->InitializeSampler(SAMP_2D, i, 0, mTextures[i]);
}
#ifdef GL_ARB_texture_cube_map
}
@@ -170,6 +162,9 @@ void KX_BlenderMaterial::OnConstruction()
/*PyDict_SetItemString(gTextureDict, mTextures[i].GetName().Ptr(), PyInt_FromLong(mTextures[i]));*/
}
#endif//GL_ARB_multitexture
+
+ mBlendFunc[0] =0;
+ mBlendFunc[1] =0;
}
void KX_BlenderMaterial::OnExit()
@@ -299,7 +294,15 @@ void KX_BlenderMaterial::setShaderData( bool enable )
// use a sampler
bgl::blUniform1iARB(samp->loc, i );
}
- glDisable(GL_BLEND);
+
+ if(!mUserDefBlend) {
+ setDefaultBlending();
+ }else
+ {
+ glEnable(GL_BLEND);
+ // tested to be valid enums
+ glBlendFunc(mBlendFunc[0], mBlendFunc[1]);
+ }
#endif//GL_ARB_shader_objects
#endif//GL_ARB_multitexture
@@ -388,15 +391,16 @@ void KX_BlenderMaterial::setTexData( bool enable )
#ifdef GL_ARB_texture_cube_map
}
#endif//GL_ARB_texture_cube_map
-
- // if either unit has set blending
- // and its the last pass
- lastblend += setBlending( i ); // dry run
- if(lastblend >0 && i==mMaterial->num_enabled-1)
- setBlending( i, true );
- else if(lastblend == 0 && i==mMaterial->num_enabled-1)
- glDisable(GL_BLEND);
}
+ if(!mUserDefBlend) {
+ setDefaultBlending();
+ }else
+ {
+ glEnable(GL_BLEND);
+ // tested to be valid enums
+ glBlendFunc(mBlendFunc[0], mBlendFunc[1]);
+ }
+
#endif//GL_ARB_multitexture
}
@@ -587,9 +591,8 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );
GLfloat blend_operand = GL_SRC_COLOR;
- GLfloat blend_operand_prev = GL_SRC_COLOR;
+ GLfloat blend_operand_prev = GL_SRC_COLOR;
- // all sources here are RGB by default
GLenum combiner = GL_COMBINE_RGB_ARB;
GLenum source0 = GL_SOURCE0_RGB_ARB;
GLenum source1 = GL_SOURCE1_RGB_ARB;
@@ -597,6 +600,7 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
GLenum op0 = GL_OPERAND0_RGB_ARB;
GLenum op1 = GL_OPERAND1_RGB_ARB;
GLenum op2 = GL_OPERAND2_RGB_ARB;
+ GLfloat alphaOp = GL_SRC_ALPHA;
// switch to alpha combiners
if( (mMaterial->flag[textureIndex] &TEXALPHA) ) {
@@ -608,7 +612,6 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
op1 = GL_OPERAND1_ALPHA_ARB;
op2 = GL_OPERAND2_ALPHA_ARB;
blend_operand = GL_SRC_ALPHA;
- blend_operand_prev = GL_SRC_ALPHA;
// invert
if(mMaterial->flag[textureIndex] &TEXNEG) {
@@ -618,27 +621,42 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
}
else {
if(mMaterial->flag[textureIndex] &TEXNEG) {
- blend_operand_prev = GL_ONE_MINUS_SRC_COLOR;
+ blend_operand_prev=GL_ONE_MINUS_SRC_COLOR;
blend_operand = GL_ONE_MINUS_SRC_COLOR;
}
}
- // on Texture0 GL_PREVIOUS_ARB is the primary color
- // on Texture1 GL_PREVIOUS_ARB is Texture0 env
+ bool using_alpha = false;
+
+ if(mMaterial->flag[textureIndex] &USEALPHA){
+ alphaOp = GL_ONE_MINUS_SRC_ALPHA;
+ using_alpha=true;
+ }
+ else if(mMaterial->flag[textureIndex] &USENEGALPHA){
+ alphaOp = GL_SRC_ALPHA;
+ using_alpha = true;
+ }
+
switch( mMaterial->blend_mode[textureIndex] ) {
case BLEND_MIX:
{
// ------------------------------
- GLfloat base_col[4];
- base_col[0] = base_col[1] = base_col[2] = 0.f;
- base_col[3] = 1.f-mMaterial->color_blend[textureIndex];
- glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR,base_col );
+ if(!using_alpha) {
+ GLfloat base_col[4];
+ base_col[0] = base_col[1] = base_col[2] = 0.f;
+ base_col[3] = 1.f-mMaterial->color_blend[textureIndex];
+ glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR,base_col );
+ }
glTexEnvf( GL_TEXTURE_ENV, combiner, GL_INTERPOLATE_ARB);
glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB);
glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev );
glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE );
glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
- glTexEnvf( GL_TEXTURE_ENV, source2, GL_CONSTANT_ARB );
- glTexEnvf( GL_TEXTURE_ENV, op2, GL_SRC_ALPHA);
+ if(!using_alpha)
+ glTexEnvf( GL_TEXTURE_ENV, source2, GL_CONSTANT_ARB );
+ else
+ glTexEnvf( GL_TEXTURE_ENV, source2, GL_TEXTURE );
+
+ glTexEnvf( GL_TEXTURE_ENV, op2, alphaOp);
}break;
case BLEND_MUL:
{
@@ -647,7 +665,10 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB);
glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev);
glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE );
- glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
+ if(using_alpha)
+ glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp);
+ else
+ glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
}break;
case BLEND_ADD:
{
@@ -656,7 +677,10 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB );
glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev );
glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE );
- glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand );
+ if(using_alpha)
+ glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp);
+ else
+ glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
}break;
case BLEND_SUB:
{
@@ -674,37 +698,16 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
glTexEnvf( GL_TEXTURE_ENV, source0, GL_PREVIOUS_ARB );
glTexEnvf( GL_TEXTURE_ENV, op0, blend_operand_prev );
glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE );
- glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
+ if(using_alpha)
+ glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp);
+ else
+ glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
} break;
}
+ glTexEnvf( GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0);
#endif //!GL_ARB_texture_env_combine
}
-bool KX_BlenderMaterial::setBlending( int ind, bool enable)
-{
- if(!enable) {
- if(mMaterial->flag[ind] &CALCALPHA ) return true;
- else if(mMaterial->flag[ind] &USEALPHA ) return true;
- return false;
- }
- else {
- // additive
- if(mMaterial->flag[ind] &CALCALPHA ) {
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
- return true;
- }
-
- // use alpha channel
- else if(mMaterial->flag[ind] &USEALPHA ) {
- glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- return true;
- }
- }
- return false;
-}
-
bool KX_BlenderMaterial::setDefaultBlending()
{
if( mMaterial->transp &TF_ADD) {
@@ -873,6 +876,7 @@ PyMethodDef KX_BlenderMaterial::Methods[] =
{
KX_PYMETHODTABLE( KX_BlenderMaterial, getShader ),
KX_PYMETHODTABLE( KX_BlenderMaterial, getMaterialIndex ),
+ KX_PYMETHODTABLE( KX_BlenderMaterial, setBlending ),
// KX_PYMETHODTABLE( KX_BlenderMaterial, getTexture ),
// KX_PYMETHODTABLE( KX_BlenderMaterial, setTexture ),
@@ -922,6 +926,15 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
return NULL;
}
else {
+ if(!mShader) {
+ mShader = new BL_Shader();
+ for(int i= 0; i<mMaterial->num_enabled; i++) {
+ if(mMaterial->mapping[i].mapping & USEENV )
+ mShader->InitializeSampler(SAMP_CUBE, i, 0, mTextures[i]);
+ else
+ mShader->InitializeSampler(SAMP_2D, i, 0, mTextures[i]);
+ }
+ }
Py_INCREF(mShader);
return mShader;
}
@@ -947,3 +960,45 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setTexture , "setTexture( index, tex)")
return NULL;
}
+static unsigned int GL_array[11] = {
+ GL_ZERO,
+ GL_ONE,
+ GL_SRC_COLOR,
+ GL_ONE_MINUS_SRC_COLOR,
+ GL_DST_COLOR,
+ GL_ONE_MINUS_DST_COLOR,
+ GL_SRC_ALPHA,
+ GL_ONE_MINUS_SRC_ALPHA,
+ GL_DST_ALPHA,
+ GL_ONE_MINUS_DST_ALPHA,
+ GL_SRC_ALPHA_SATURATE
+};
+
+KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)")
+{
+ unsigned int b[2];
+ if(PyArg_ParseTuple(args, "ii", &b[0], &b[1]))
+ {
+ bool value_found[2] = {false, false};
+ for(int i=0; i<11; i++)
+ {
+ if(b[0] == GL_array[i]) {
+ value_found[0] = true;
+ mBlendFunc[0] = b[0];
+ }
+ if(b[1] == GL_array[i]) {
+ value_found[1] = true;
+ mBlendFunc[1] = b[1];
+ }
+ if(value_found[0] && value_found[1]) break;
+ }
+ if(!value_found[0] || !value_found[1]) {
+ PyErr_Format(PyExc_ValueError, "invalid enum.");
+ return NULL;
+ }
+ mUserDefBlend = true;
+ Py_Return;
+ }
+ return NULL;
+}
+
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 57348144890..1af4b2550a9 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -72,6 +72,7 @@ public:
KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture );
KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture );
+ KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending );
// --------------------------------
// pre calculate to avoid pops/lag at startup
virtual void OnConstruction( );
@@ -82,6 +83,9 @@ private:
KX_Scene* mScene;
BL_Texture mTextures[MAXTEX]; // texture array
+ bool mUserDefBlend;
+ unsigned int mBlendFunc[2];
+
// message centers
void setTexData( bool enable );
void setShaderData( bool enable );
@@ -90,7 +94,6 @@ private:
void setEnvMap( bool val, bool cube=false);
void setTexMatrixData(int i);
bool setDefaultBlending();
- bool setBlending( int ind, bool enable=false );
void setObjectMatrixData(int i);
// cleanup stuff
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index 2317f9c3a9c..0e7ebc6442e 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -362,7 +362,7 @@ static PyObject* gPyRemoveConstraint(PyObject* self,
{
if (PHY_GetActiveEnvironment())
{
- PHY_GetActiveEnvironment()->removeConstraint((void *)constraintid);
+ PHY_GetActiveEnvironment()->removeConstraint(constraintid);
}
}
Py_INCREF(Py_None); return Py_None;
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index e2a11c0035e..ba4f0e55615 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -277,39 +277,74 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
#define pprint(x) std::cout << x << std::endl;
bgl::BL_EXTInfo ext = bgl::RAS_EXT_support;
bool count=0;
+ bool support=0;
pprint("Supported Extensions...");
- #ifdef GL_ARB_shader_objects
- pprint(" GL_ARB_shader_objects supported? "<< (ext._ARB_shader_objects? "yes.":"no."));
+#ifdef GL_ARB_shader_objects
+ pprint(" GL_ARB_shader_objects supported? "<< (ext._ARB_shader_objects?"yes.":"no."));
count = 1;
- #endif
- #ifdef GL_ARB_vertex_shader
- pprint(" GL_ARB_vertex_shader supported? "<< (ext._ARB_vertex_shader? "yes.":"no."));
- count = 1;
- #endif
- #ifdef GL_ARB_fragment_shader
- pprint(" GL_ARB_fragment_shader supported? "<< (ext._ARB_fragment_shader? "yes.":"no."));
- count = 1;
- #endif
- #ifdef GL_ARB_texture_cube_map
- pprint(" GL_ARB_texture_cube_map supported? "<< (ext._ARB_texture_cube_map? "yes.":"no."));
+#endif
+
+#ifdef GL_ARB_vertex_shader
+ support= ext._ARB_vertex_shader;
+ pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no."));
count = 1;
- #endif
- #ifdef GL_EXT_texture3D
- pprint(" GL_EXT_texture3D supported? "<< (ext._EXT_texture3D? "yes.":"no."));
+ if(support){
+ pprint(" ----------Details----------");
+ int max=0;
+ glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, (GLint*)&max);
+ pprint(" Max uniform components." << max);
+
+ glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, (GLint*)&max);
+ pprint(" Max varying floats." << max);
+
+ glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max);
+ pprint(" Max vertex texture units." << max);
+
+ glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max);
+ pprint(" Max combined texture units." << max);
+ pprint("");
+ }
+#endif
+#ifdef GL_ARB_fragment_shader
+ support=ext._ARB_fragment_shader;
+ pprint(" GL_ARB_fragment_shader supported? "<< (support?"yes.":"no."));
count = 1;
- #endif
- #ifdef GL_EXT_blend_color
- pprint(" GL_EXT_blend_color supported? "<< (ext._EXT_blend_color? "yes.":"no."));
+ if(support){
+ pprint(" ----------Details----------");
+ int max=0;
+ glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, (GLint*)&max);
+ pprint(" Max uniform components." << max);
+ pprint("");
+ }
+#endif
+#ifdef GL_ARB_texture_cube_map
+ support = ext._ARB_texture_cube_map;
+ pprint(" GL_ARB_texture_cube_map supported? "<< (support?"yes.":"no."));
count = 1;
- #endif
- #ifdef GL_ARB_multitexture
- pprint(" GL_ARB_multitexture supported? "<< (ext._ARB_multitexture? "yes.":"no."));
+ if(support){
+ pprint(" ----------Details----------");
+ int size=0;
+ glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&size);
+ pprint(" Max cubemap size." << size);
+ pprint("");
+ }
+#endif
+#ifdef GL_ARB_multitexture
+ support = ext._ARB_multitexture;
count = 1;
- #endif
- #ifdef GL_ARB_texture_env_combine
- pprint(" GL_ARB_texture_env_combine supported? "<< (ext._ARB_texture_env_combine? "yes.":"no."));
+ pprint(" GL_ARB_multitexture supported? "<< (support?"yes.":"no."));
+ if(support){
+ pprint(" ----------Details----------");
+ int units=0;
+ glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&units);
+ pprint(" Max texture units available. " << units);
+ pprint("");
+ }
+#endif
+#ifdef GL_ARB_texture_env_combine
+ pprint(" GL_ARB_texture_env_combine supported? "<< (ext._ARB_texture_env_combine?"yes.":"no."));
count = 1;
- #endif
+#endif
if(!count)
pprint("No extenstions are used in this build");
@@ -707,6 +742,19 @@ PyObject* initGameLogic(KX_Scene* scene) // quick hack to get gravity hook
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_LOOPEND, BL_ActionActuator::KX_ACT_ACTION_LOOPEND);
KX_MACRO_addTypesToDict(d, KX_ACTIONACT_PROPERTY, BL_ActionActuator::KX_ACT_ACTION_PROPERTY);
+ /*8. GL_BlendFunc */
+ KX_MACRO_addTypesToDict(d, BL_ZERO, GL_ZERO);
+ KX_MACRO_addTypesToDict(d, BL_ONE, GL_ONE);
+ KX_MACRO_addTypesToDict(d, BL_SRC_COLOR, GL_SRC_COLOR);
+ KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
+ KX_MACRO_addTypesToDict(d, BL_DST_COLOR, GL_DST_COLOR);
+ KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_DST_COLOR);
+ KX_MACRO_addTypesToDict(d, BL_SRC_ALPHA, GL_SRC_ALPHA);
+ KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ KX_MACRO_addTypesToDict(d, BL_DST_ALPHA, GL_DST_ALPHA);
+ KX_MACRO_addTypesToDict(d, BL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA);
+ KX_MACRO_addTypesToDict(d, BL_SRC_ALPHA_SATURATE, GL_SRC_ALPHA_SATURATE);
+
// Check for errors
if (PyErr_Occurred())
{
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 46406d5b8e3..cdf617f1722 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -192,7 +192,7 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
if ((&p2p->GetRigidBodyA() == ctrl->GetRigidBody() ||
(&p2p->GetRigidBodyB() == ctrl->GetRigidBody())))
{
- removeConstraint(p2p);
+ removeConstraint(p2p->GetConstraintId());
//only 1 constraint per constroller
break;
}
@@ -209,7 +209,7 @@ void CcdPhysicsEnvironment::removeCcdPhysicsController(CcdPhysicsController* ctr
if ((&p2p->GetRigidBodyA() == ctrl->GetRigidBody() ||
(&p2p->GetRigidBodyB() == ctrl->GetRigidBody())))
{
- removeConstraint(p2p);
+ removeConstraint(p2p->GetConstraintId());
//only 1 constraint per constroller
break;
}
@@ -301,9 +301,23 @@ void CcdPhysicsEnvironment::beginFrame()
}
-/// Perform an integration step of duration 'timeStep'.
bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
{
+
+ if (!SimdFuzzyZero(timeStep))
+ {
+ //Blender runs 30hertz, so subdivide so we get 60 hertz
+ proceedDeltaTimeOneStep(0.5f*timeStep);
+ proceedDeltaTimeOneStep(0.5f*timeStep);
+ } else
+ {
+ //todo: interpolate
+ }
+ return true;
+}
+/// Perform an integration step of duration 'timeStep'.
+bool CcdPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
+{
// printf("CcdPhysicsEnvironment::proceedDeltaTime\n");
@@ -318,9 +332,6 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep)
- //clamp hardcoded for now
- if (timeStep > 0.02)
- timeStep = 0.02;
//this is needed because scaling is not known in advance, and scaling has to propagate to the shape
if (!m_scalingPropagated)
@@ -758,7 +769,9 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
}
m_p2pConstraints.push_back(p2p);
- return 0;
+
+ //64 bit systems can't cast pointer to int. could use size_t instead.
+ return p2p->GetConstraintId();
break;
}
@@ -773,17 +786,24 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
}
-void CcdPhysicsEnvironment::removeConstraint(void* p2p)
+void CcdPhysicsEnvironment::removeConstraint(int constraintId)
{
- std::vector<Point2PointConstraint*>::iterator i =
- std::find(m_p2pConstraints.begin(), m_p2pConstraints.end(),
- (Point2PointConstraint *)p2p);
+ std::vector<Point2PointConstraint*>::iterator i;
+
+ //std::find(m_p2pConstraints.begin(), m_p2pConstraints.end(),
+ // (Point2PointConstraint *)p2p);
- if (!(i == m_p2pConstraints.end()) )
- {
- std::swap(*i, m_p2pConstraints.back());
- m_p2pConstraints.pop_back();
- }
+ for (i=m_p2pConstraints.begin();
+ !(i==m_p2pConstraints.end()); i++)
+ {
+ Point2PointConstraint* p2p = (*i);
+ if (p2p->GetConstraintId() == constraintId)
+ {
+ std::swap(*i, m_p2pConstraints.back());
+ m_p2pConstraints.pop_back();
+ break;
+ }
+ }
}
PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ,
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index 6050af2f3c8..1b2527aa5bb 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -63,6 +63,8 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
virtual void endFrame() {};
/// Perform an integration step of duration 'timeStep'.
virtual bool proceedDeltaTime(double curTime,float timeStep);
+ bool proceedDeltaTimeOneStep(float timeStep);
+
virtual void setFixedTimeStep(bool useFixedTimeStep,float fixedTimeStep){};
//returns 0.f if no fixed timestep is used
@@ -75,7 +77,7 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ);
- virtual void removeConstraint(void* constraintid);
+ virtual void removeConstraint(int constraintid);
virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ,
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
index 0b6f8a4ded4..0532a9a8cf7 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
@@ -101,7 +101,7 @@ int DummyPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ct
}
-void DummyPhysicsEnvironment::removeConstraint(void * constraintid)
+void DummyPhysicsEnvironment::removeConstraint(int constraintid)
{
if (constraintid)
{
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
index 0a359feea6d..a400459afe6 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
@@ -61,7 +61,7 @@ public:
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ);
- virtual void removeConstraint(void * constraintid);
+ virtual void removeConstraint(int constraintid);
virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ,
float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
diff --git a/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp b/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp
index 081a2fb9794..656051be4f5 100644
--- a/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp
+++ b/source/gameengine/Physics/Sumo/Fuzzics/src/SM_Scene.cpp
@@ -183,7 +183,7 @@ bool SM_Scene::proceed(MT_Scalar curtime, MT_Scalar ticrate)
if (!m_frames)
{
if (ticrate > 0.)
- m_frames = (unsigned int)(curtime*ticrate + 1.0);
+ m_frames = (unsigned int)(curtime*ticrate) + 1.0;
else
m_frames = (unsigned int)(curtime*65536.0);
}
@@ -275,7 +275,11 @@ bool SM_Scene::proceed(MT_Scalar curtime, MT_Scalar ticrate)
for (i = m_objectList.begin(); i != m_objectList.end(); ++i)
(*i)->interpolate(curtime);
- m_frames = (unsigned int)(curtime*ticrate + 1.0);
+ //only update the m_frames after an actual physics timestep
+ if (num_samples)
+ {
+ m_frames = (unsigned int)(curtime*ticrate) + 1.0;
+ }
}
else
{
diff --git a/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp b/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
index 8d03fd4b0f4..ead6dcc0106 100644
--- a/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
@@ -117,7 +117,7 @@ int SumoPhysicsEnvironment::createConstraint(
return constraintid;
}
-void SumoPhysicsEnvironment::removeConstraint(void * constraintid)
+void SumoPhysicsEnvironment::removeConstraint(int constraintid)
{
if (constraintid)
{
diff --git a/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h b/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
index c93e34825b9..e1641407166 100644
--- a/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
@@ -66,7 +66,7 @@ public:
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ);
- virtual void removeConstraint(void * constraintid);
+ virtual void removeConstraint(int constraintid);
virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient,float fromX,float fromY,float fromZ, float toX,float toY,float toZ,
float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ);
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index 1158563527a..078f84d4de2 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -83,7 +83,7 @@ class PHY_IPhysicsEnvironment
virtual int createConstraint(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsController* ctrl2,PHY_ConstraintType type,
float pivotX,float pivotY,float pivotZ,
float axisX,float axisY,float axisZ)=0;
- virtual void removeConstraint(void * constraintid)=0;
+ virtual void removeConstraint(int constraintid)=0;
virtual PHY_IPhysicsController* rayTest(PHY_IPhysicsController* ignoreClient, float fromX,float fromY,float fromZ, float toX,float toY,float toZ,
float& hitX,float& hitY,float& hitZ,float& normalX,float& normalY,float& normalZ)=0;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
index 82a3f23dcf2..2b47acb2e32 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
@@ -509,7 +509,7 @@ static void LinkExtensions()
}
#endif
-#ifdef GL_ARB_shader_objects
+#if GL_ARB_shader_objects
if (QueryExtension("GL_ARB_shader_objects"))
{
bgl::blDeleteObjectARB = reinterpret_cast<PFNGLDELETEOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glDeleteObjectARB"));
@@ -562,7 +562,7 @@ static void LinkExtensions()
}
#endif
-#ifdef GL_ARB_vertex_shader
+#if GL_ARB_vertex_shader
if (QueryExtension("GL_ARB_vertex_shader"))
{
bgl::blBindAttribLocationARB = reinterpret_cast<PFNGLBINDATTRIBLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glBindAttribLocationARB"));