applied Charlies patch, reverted some GLSL shader stuff, improved penetration depth estimate.
This commit is contained in:
@@ -97,25 +97,27 @@ bool MinkowskiPenetrationDepthSolver::CalcPenDepth(SimplexSolverInterface& simpl
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
//just take fixed number of orientation, and sample the penetration depth in that direction
|
||||
float minProj = 1e30f;
|
||||
SimdVector3 minNorm;
|
||||
SimdVector3 minVertex;
|
||||
SimdVector3 minA,minB;
|
||||
SimdVector3 seperatingAxisInA,seperatingAxisInB;
|
||||
SimdVector3 pInA,qInB,pWorld,qWorld,w;
|
||||
|
||||
for (int i=0;i<NUM_UNITSPHERE_POINTS;i++)
|
||||
{
|
||||
const SimdVector3& norm = sPenetrationDirections[i];
|
||||
|
||||
SimdVector3 seperatingAxisInA = (-norm)* transA.getBasis();
|
||||
SimdVector3 seperatingAxisInB = norm* transB.getBasis();
|
||||
seperatingAxisInA = (-norm)* transA.getBasis();
|
||||
seperatingAxisInB = norm* transB.getBasis();
|
||||
|
||||
SimdVector3 pInA = convexA->LocalGetSupportingVertex(seperatingAxisInA);
|
||||
SimdVector3 qInB = convexB->LocalGetSupportingVertex(seperatingAxisInB);
|
||||
SimdPoint3 pWorld = transA(pInA);
|
||||
SimdPoint3 qWorld = transB(qInB);
|
||||
pInA = convexA->LocalGetSupportingVertexWithoutMargin(seperatingAxisInA);
|
||||
qInB = convexB->LocalGetSupportingVertexWithoutMargin(seperatingAxisInB);
|
||||
pWorld = transA(pInA);
|
||||
qWorld = transB(qInB);
|
||||
|
||||
SimdVector3 w = qWorld - pWorld;
|
||||
w = qWorld - pWorld;
|
||||
float delta = norm.dot(w);
|
||||
//find smallest delta
|
||||
|
||||
@@ -128,6 +130,16 @@ bool MinkowskiPenetrationDepthSolver::CalcPenDepth(SimplexSolverInterface& simpl
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//add the margins
|
||||
|
||||
minA += minNorm*convexA->GetMargin();
|
||||
minB -= minNorm*convexB->GetMargin();
|
||||
minProj += (convexA->GetMargin() + convexB->GetMargin());
|
||||
|
||||
|
||||
|
||||
|
||||
//#define DEBUG_DRAW 1
|
||||
#ifdef DEBUG_DRAW
|
||||
if (debugDraw)
|
||||
|
||||
@@ -494,7 +494,17 @@ BL_Material* ConvertMaterial( Mesh* mesh, Material *mat, TFace* tface, MFace*
|
||||
material->spec_f = mat->spec;
|
||||
material->ref = mat->ref;
|
||||
material->amb = mat->amb;
|
||||
material->ras_mode |= ((mat->mode & MA_ZTRA) != 0)?ZSORT:0;
|
||||
|
||||
// set alpha testing without z-sorting
|
||||
if( ((mesh->tface && tface ) && (!tface->transp)) && mat->mode & MA_ZTRA) {
|
||||
// sets the RAS_IPolyMaterial::m_flag |RAS_FORCEALPHA
|
||||
// this is so we don't have the overhead of the z-sorting code
|
||||
material->ras_mode|=ALPHA_TEST;
|
||||
}
|
||||
else{
|
||||
// use regular z-sorting
|
||||
material->ras_mode |= ((mat->mode & MA_ZTRA) != 0)?ZSORT:0;
|
||||
}
|
||||
material->ras_mode |= ((mat->mode & MA_WIRE) != 0)?WIRE:0;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -120,7 +120,8 @@ enum BL_flag
|
||||
TEXALPHA=8, // use alpha combiner functions
|
||||
TEXNEG=16, // negate blending
|
||||
HASIPO=32,
|
||||
USENEGALPHA=64
|
||||
USENEGALPHA=64,
|
||||
ALPHA_TEST=128
|
||||
};
|
||||
|
||||
// BL_Material::ras_mode
|
||||
|
||||
@@ -28,19 +28,7 @@
|
||||
//using namespace bgl;
|
||||
#define spit(x) std::cout << x << std::endl;
|
||||
|
||||
/* ----
|
||||
testing for a faster solution!
|
||||
... just compile out
|
||||
The idea is to install a shader in other
|
||||
areas if code, find the shader via the scene and,
|
||||
install it with ...
|
||||
|
||||
shader->ApplyShader()
|
||||
...
|
||||
shader->UnloadShader()
|
||||
*/
|
||||
#define SORT_UNIFORMS 1
|
||||
|
||||
#define UNIFORM_MAX_LEN sizeof(float)*16
|
||||
|
||||
BL_Uniform::BL_Uniform(int data_size)
|
||||
@@ -143,15 +131,16 @@ BL_Shader::BL_Shader(PyTypeObject *T)
|
||||
mPass(1),
|
||||
mOk(0),
|
||||
mUse(0),
|
||||
mAttr(0),
|
||||
vertProg(""),
|
||||
fragProg(""),
|
||||
mError(0),
|
||||
mDirty(true)
|
||||
{
|
||||
// if !RAS_EXT_support._ARB_shader_objects this class will not be used
|
||||
for (int i=0; i<MAXTEX; i++) {
|
||||
mSampler[i] = BL_Sampler();
|
||||
}
|
||||
//for (int i=0; i<MAXTEX; i++) {
|
||||
// mSampler[i] = BL_Sampler();
|
||||
//}
|
||||
}
|
||||
|
||||
using namespace bgl;
|
||||
@@ -159,12 +148,12 @@ using namespace bgl;
|
||||
BL_Shader::~BL_Shader()
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
for (int i=0; i<MAXTEX; i++){
|
||||
if(mSampler[i].mOwn) {
|
||||
if(mSampler[i].mTexture)
|
||||
mSampler[i].mTexture->DeleteTex();
|
||||
}
|
||||
}
|
||||
//for (int i=0; i<MAXTEX; i++){
|
||||
// if(mSampler[i].mOwn) {
|
||||
// if(mSampler[i].mTexture)
|
||||
// mSampler[i].mTexture->DeleteTex();
|
||||
// }
|
||||
//}
|
||||
ClearUniforms();
|
||||
|
||||
if( mShader ) {
|
||||
@@ -214,15 +203,6 @@ BL_Uniform *BL_Shader::FindUniform(const int location)
|
||||
void BL_Shader::SetUniformfv(int location, int type, float *param,int size, bool transpose)
|
||||
{
|
||||
#ifdef SORT_UNIFORMS
|
||||
#ifdef WIN32
|
||||
#ifndef NDEBUG
|
||||
MT_assert(type > BL_Uniform::UNI_NONE && type < BL_Uniform::UNI_MAX);
|
||||
MT_assert(location);
|
||||
MT_assert(param);
|
||||
//MT_assert(size > 0 && size <= UNIFORM_MAX_LEN);
|
||||
#endif
|
||||
#endif //WIN32
|
||||
|
||||
BL_Uniform *uni= FindUniform(location);
|
||||
if(uni) {
|
||||
memcpy(uni->getData(), param, size);
|
||||
@@ -242,16 +222,6 @@ void BL_Shader::SetUniformfv(int location, int type, float *param,int size, bool
|
||||
void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool transpose)
|
||||
{
|
||||
#ifdef SORT_UNIFORMS
|
||||
#ifdef WIN32
|
||||
#ifndef NDEBUG
|
||||
//MT_assert(type > BL_Uniform::UNI_NONE && type < BL_Uniform::UNI_MAX);
|
||||
MT_assert(location);
|
||||
MT_assert(param);
|
||||
//MT_assert(size > 0 && size <= UNIFORM_MAX_LEN);
|
||||
#endif
|
||||
#endif //WIN32
|
||||
|
||||
|
||||
BL_Uniform *uni= FindUniform(location);
|
||||
if(uni) {
|
||||
memcpy(uni->getData(), param, size);
|
||||
@@ -438,12 +408,12 @@ unsigned int BL_Shader::GetProg()
|
||||
{
|
||||
return mShader;
|
||||
}
|
||||
|
||||
const BL_Sampler* BL_Shader::GetSampler(int i)
|
||||
{
|
||||
MT_assert(i<=MAXTEX);
|
||||
return &mSampler[i];
|
||||
}
|
||||
//
|
||||
//const BL_Sampler* BL_Shader::GetSampler(int i)
|
||||
//{
|
||||
// MT_assert(i<=MAXTEX);
|
||||
// return &mSampler[i];
|
||||
//}
|
||||
|
||||
void BL_Shader::SetSampler(int loc, int unit)
|
||||
{
|
||||
@@ -457,14 +427,14 @@ void BL_Shader::SetSampler(int loc, int unit)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BL_Shader::InitializeSampler(int unit, BL_Texture* texture)
|
||||
{
|
||||
MT_assert(unit<=MAXTEX);
|
||||
mSampler[unit].mTexture = texture;
|
||||
mSampler[unit].mLoc =-1;
|
||||
mSampler[unit].mOwn = 0;
|
||||
}
|
||||
//
|
||||
//void BL_Shader::InitializeSampler(int unit, BL_Texture* texture)
|
||||
//{
|
||||
// MT_assert(unit<=MAXTEX);
|
||||
// mSampler[unit].mTexture = texture;
|
||||
// mSampler[unit].mLoc =-1;
|
||||
// mSampler[unit].mOwn = 0;
|
||||
//}
|
||||
|
||||
void BL_Shader::SetProg(bool enable)
|
||||
{
|
||||
@@ -504,7 +474,7 @@ void BL_Shader::Update( const KX_MeshSlot & ms, RAS_IRasterizer* rasty )
|
||||
for(it = mPreDef.begin(); it!= mPreDef.end(); it++)
|
||||
{
|
||||
BL_DefUniform *uni = (*it);
|
||||
if(!uni->mLoc) continue;
|
||||
if(uni->mLoc == -1) continue;
|
||||
|
||||
switch (uni->mType)
|
||||
{
|
||||
@@ -826,8 +796,7 @@ PyMethodDef BL_Shader::Methods[] =
|
||||
KX_PYMETHODTABLE( BL_Shader, setUniform2i ),
|
||||
KX_PYMETHODTABLE( BL_Shader, setUniform3i ),
|
||||
KX_PYMETHODTABLE( BL_Shader, setUniform4i ),
|
||||
// TODO: GL_ARB_vertex/fragment_program support
|
||||
// KX_PYMETHODTABLE( BL_Shader, setAttrib ),
|
||||
KX_PYMETHODTABLE( BL_Shader, setAttrib ),
|
||||
|
||||
KX_PYMETHODTABLE( BL_Shader, setUniformfv ),
|
||||
KX_PYMETHODTABLE( BL_Shader, setUniformiv ),
|
||||
@@ -967,10 +936,18 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
|
||||
{
|
||||
int loc = GetUniformLocation(uniform);
|
||||
if(loc != -1) {
|
||||
if(index <= MAXTEX)
|
||||
mSampler[index].mLoc = loc;
|
||||
else
|
||||
if(index >= MAXTEX && index < 0)
|
||||
spit("Invalid texture sample index: " << index);
|
||||
|
||||
#ifdef SORT_UNIFORMS
|
||||
SetUniformiv(loc, BL_Uniform::UNI_INT, &index, (sizeof(int)) );
|
||||
#else
|
||||
SetUniform(loc, index);
|
||||
#endif
|
||||
//if(index <= MAXTEX)
|
||||
// mSampler[index].mLoc = loc;
|
||||
//else
|
||||
// spit("Invalid texture sample index: " << index);
|
||||
}
|
||||
Py_Return;
|
||||
}
|
||||
@@ -1418,7 +1395,24 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
|
||||
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" )
|
||||
{
|
||||
Py_Return;
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
int attr=0;
|
||||
if(PyArg_ParseTuple(args, "i", &attr )) {
|
||||
if(mShader==0) {
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
mAttr=SHD_TANGENT;
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blBindAttribLocationARB(mShader, mAttr, "Tangent");
|
||||
Py_Return;
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,14 +21,10 @@ class BL_Sampler
|
||||
{
|
||||
public:
|
||||
BL_Sampler():
|
||||
mLoc(-1),
|
||||
mTexture(0),
|
||||
mOwn(0)
|
||||
mLoc(-1)
|
||||
{
|
||||
}
|
||||
int mLoc; // Sampler location
|
||||
BL_Texture* mTexture; // Texture data
|
||||
bool mOwn; // True if we own it
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -104,7 +100,8 @@ private:
|
||||
int mPass; // 1.. unused
|
||||
bool mOk; // Valid and ok
|
||||
bool mUse; // ...
|
||||
BL_Sampler mSampler[MAXTEX]; // Number of samplers
|
||||
//BL_Sampler mSampler[MAXTEX]; // Number of samplers
|
||||
int mAttr; // Tangent attribute
|
||||
char* vertProg; // Vertex program string
|
||||
char* fragProg; // Fragment program string
|
||||
bool mError; // ...
|
||||
@@ -166,12 +163,13 @@ public:
|
||||
int getNumPass() {return mPass;}
|
||||
bool GetError() {return mError;}
|
||||
// ---
|
||||
const BL_Sampler* GetSampler(int i);
|
||||
//const BL_Sampler* GetSampler(int i);
|
||||
void SetSampler(int loc, int unit);
|
||||
|
||||
const bool Ok()const;
|
||||
unsigned int GetProg();
|
||||
void SetProg(bool enable);
|
||||
int GetAttribute(){return mAttr;};
|
||||
|
||||
// --
|
||||
// Apply methods : sets colected uniforms
|
||||
@@ -181,8 +179,8 @@ public:
|
||||
// Update predefined uniforms each render call
|
||||
void Update(const class KX_MeshSlot & ms, class RAS_IRasterizer* rasty);
|
||||
|
||||
// Set sampler units (copied)
|
||||
void InitializeSampler(int unit, BL_Texture* texture );
|
||||
//// Set sampler units (copied)
|
||||
//void InitializeSampler(int unit, BL_Texture* texture );
|
||||
|
||||
|
||||
void SetUniformfv(int location,int type, float *param, int size,bool transpose=false);
|
||||
@@ -206,15 +204,16 @@ public:
|
||||
// Python interface
|
||||
virtual PyObject* _getattr(const STR_String& attr);
|
||||
|
||||
// -----------------------------------
|
||||
KX_PYMETHOD_DOC( BL_Shader, setSource );
|
||||
KX_PYMETHOD_DOC( BL_Shader, delSource );
|
||||
KX_PYMETHOD_DOC( BL_Shader, getVertexProg );
|
||||
KX_PYMETHOD_DOC( BL_Shader, getFragmentProg );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setNumberOfPasses );
|
||||
|
||||
// -----------------------------------
|
||||
KX_PYMETHOD_DOC( BL_Shader, isValid);
|
||||
KX_PYMETHOD_DOC( BL_Shader, validate);
|
||||
|
||||
// -----------------------------------
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniform4f );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniform3f );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniform2f );
|
||||
@@ -223,19 +222,12 @@ public:
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniform3i );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniform2i );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniform1i );
|
||||
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniformfv );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniformiv );
|
||||
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniformMatrix4 );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniformMatrix3 );
|
||||
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniformDef );
|
||||
|
||||
KX_PYMETHOD_DOC( BL_Shader, setAttrib );
|
||||
|
||||
// These come from within the material buttons
|
||||
// sampler2d/samplerCube work
|
||||
KX_PYMETHOD_DOC( BL_Shader, setSampler);
|
||||
};
|
||||
|
||||
|
||||
@@ -82,14 +82,13 @@ KX_BlenderMaterial::KX_BlenderMaterial(
|
||||
mPass(0)
|
||||
|
||||
{
|
||||
///RAS_EXT_support._ARB_multitexture == true if were here
|
||||
|
||||
// --------------------------------
|
||||
// RAS_IPolyMaterial variables...
|
||||
m_flag |=RAS_BLENDERMAT;
|
||||
m_flag |=(mMaterial->IdMode>=ONETEX)?RAS_MULTITEX:0;
|
||||
m_flag |=(mMaterial->ras_mode & USE_LIGHT)!=0?RAS_MULTILIGHT:0;
|
||||
|
||||
m_flag |=(mMaterial->ras_mode &ALPHA_TEST)!=0?RAS_FORCEALPHA:0;
|
||||
|
||||
// figure max
|
||||
int enabled = mMaterial->num_enabled;
|
||||
int max = BL_Texture::GetMaxUnits();
|
||||
@@ -197,17 +196,15 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras)
|
||||
|
||||
// for each enabled unit
|
||||
for(i=0; i<mMaterial->num_enabled; i++) {
|
||||
const BL_Sampler *samp = mShader->GetSampler(i);
|
||||
BL_Texture *tex = samp->mTexture;
|
||||
if( samp->mLoc == -1 || !tex || !tex->Ok() )
|
||||
continue;
|
||||
tex->ActivateTexture();
|
||||
mShader->SetSampler(samp->mLoc, i);
|
||||
if(!mTextures[i].Ok()) continue;
|
||||
mTextures[i].ActivateTexture();
|
||||
mTextures[0].SetMapping(mMaterial->mapping[i].mapping);
|
||||
}
|
||||
|
||||
if(!mUserDefBlend) {
|
||||
setDefaultBlending();
|
||||
}else
|
||||
{
|
||||
}
|
||||
else {
|
||||
// tested to be valid enums
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(mBlendFunc[0], mBlendFunc[1]);
|
||||
@@ -418,18 +415,19 @@ void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const
|
||||
mMaterial->matcolor[0]*mMaterial->emit,
|
||||
mMaterial->matcolor[1]*mMaterial->emit,
|
||||
mMaterial->matcolor[2]*mMaterial->emit,
|
||||
1.0
|
||||
);
|
||||
1.0 );
|
||||
|
||||
rasty->SetAmbient(mMaterial->amb);
|
||||
if (mMaterial->material)
|
||||
rasty->SetPolygonOffset(-mMaterial->material->zoffs, 0.0);
|
||||
}
|
||||
|
||||
|
||||
void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const
|
||||
{
|
||||
//if(mShader && RAS_EXT_support._ARB_shader_objects)
|
||||
// if(mShader->GetAttribute() == BL_Shader::SHD_TANGENT)
|
||||
// ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT);
|
||||
if(mShader && RAS_EXT_support._ARB_shader_objects)
|
||||
if(mShader->GetAttribute() == BL_Shader::SHD_TANGENT)
|
||||
ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT);
|
||||
|
||||
for(int i=0; i<mMaterial->num_enabled; i++) {
|
||||
int mode = mMaterial->mapping[i].mapping;
|
||||
@@ -651,12 +649,6 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
|
||||
|
||||
if(!mShader && !mModified) {
|
||||
mShader = new BL_Shader();
|
||||
for(int i= 0; i<mMaterial->num_enabled; i++) {
|
||||
if(mMaterial->mapping[i].mapping & USEENV )
|
||||
mShader->InitializeSampler(i, &mTextures[i]);
|
||||
else
|
||||
mShader->InitializeSampler(i, &mTextures[i]);
|
||||
}
|
||||
mModified = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,8 @@ void RAS_BucketManager::Renderbuckets(
|
||||
|
||||
for (bucket = m_MaterialBuckets.begin(); bucket != m_MaterialBuckets.end(); ++bucket)
|
||||
{
|
||||
if((*bucket)->GetPolyMaterial()->IsZSort())
|
||||
RAS_IPolyMaterial *tmp = (*bucket)->GetPolyMaterial();
|
||||
if(tmp->IsZSort() || tmp->GetFlag() &RAS_FORCEALPHA )
|
||||
rasty->SetAlphaTest(true);
|
||||
else
|
||||
rasty->SetAlphaTest(false);
|
||||
|
||||
@@ -54,7 +54,8 @@ enum MaterialProps
|
||||
RAS_GLSHADER =64,
|
||||
RAS_AUTOGEN =128,
|
||||
RAS_NORMAL =256,
|
||||
RAS_DEFMULTI =512
|
||||
RAS_DEFMULTI =512,
|
||||
RAS_FORCEALPHA =1024
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -392,6 +392,7 @@ public:
|
||||
virtual void DrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)=0;
|
||||
|
||||
virtual void SetTexCoords(TexCoGen coords, int unit) = 0;
|
||||
virtual void SetAttrib(int type) = 0;
|
||||
virtual void GetViewMatrix(MT_Matrix4x4 &mat) const = 0;
|
||||
|
||||
virtual bool QueryLists(){return false;}
|
||||
|
||||
@@ -406,7 +406,6 @@ PFNGLGETACTIVEATTRIBARBPROC blGetActiveAttribARB;
|
||||
PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB;
|
||||
#endif
|
||||
|
||||
#if 0 // TODO: GL_ARB_vertex/fragment_program support
|
||||
#ifdef GL_ARB_vertex_program
|
||||
PFNGLVERTEXATTRIB1FARBPROC blVertexAttrib1fARB;
|
||||
PFNGLVERTEXATTRIB1FVARBPROC blVertexAttrib1fvARB;
|
||||
@@ -421,7 +420,6 @@ PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB;
|
||||
PFNGLGETVERTEXATTRIBFVARBPROC blGetVertexAttribfvARB;
|
||||
PFNGLGETVERTEXATTRIBIVARBPROC blGetVertexAttribivARB;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GL_EXT_compiled_vertex_array
|
||||
PFNGLLOCKARRAYSEXTPROC blLockArraysEXT;
|
||||
@@ -612,7 +610,6 @@ static void LinkExtensions()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 // TODO: GL_ARB_vertex/fragment_program support
|
||||
#if defined(GL_ARB_vertex_program)
|
||||
if (QueryExtension("GL_ARB_vertex_program"))
|
||||
{
|
||||
@@ -637,7 +634,6 @@ static void LinkExtensions()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GL_ARB_depth_texture
|
||||
|
||||
@@ -510,7 +510,6 @@ extern PFNGLGETACTIVEATTRIBARBPROC blGetActiveAttribARB;
|
||||
extern PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB;
|
||||
#endif
|
||||
|
||||
#if 0 // TODO: GL_ARB_vertex/fragment_program support
|
||||
#ifdef GL_ARB_vertex_program
|
||||
extern PFNGLVERTEXATTRIB1FARBPROC blVertexAttrib1fARB;
|
||||
extern PFNGLVERTEXATTRIB1FVARBPROC blVertexAttrib1fvARB;
|
||||
@@ -525,7 +524,6 @@ extern PFNGLGETVERTEXATTRIBDVARBPROC blGetVertexAttribdvARB;
|
||||
extern PFNGLGETVERTEXATTRIBFVARBPROC blGetVertexAttribfvARB;
|
||||
extern PFNGLGETVERTEXATTRIBIVARBPROC blGetVertexAttribivARB;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GL_EXT_compiled_vertex_array
|
||||
extern PFNGLLOCKARRAYSEXTPROC blLockArraysEXT;
|
||||
|
||||
@@ -81,6 +81,7 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas)
|
||||
m_focallength(0.0),
|
||||
m_setfocallength(false),
|
||||
m_noOfScanlines(32),
|
||||
m_useTang(false),
|
||||
m_materialCachingInfo(0)
|
||||
{
|
||||
m_viewmatrix.Identity();
|
||||
@@ -1208,6 +1209,10 @@ void RAS_OpenGLRasterizer::SetTexCoords(TexCoGen coords,int unit)
|
||||
m_texco[unit] = coords;
|
||||
}
|
||||
|
||||
void RAS_OpenGLRasterizer::SetAttrib(int type)
|
||||
{
|
||||
if(type == RAS_TEXTANGENT) m_useTang=true;
|
||||
}
|
||||
|
||||
void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv, int enabled)
|
||||
{
|
||||
@@ -1242,6 +1247,12 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv, int enabled)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_vertex_program
|
||||
if(m_useTang && bgl::RAS_EXT_support._ARB_vertex_program)
|
||||
bgl::blVertexAttrib4fvARB(1/*tangent*/, tv.getTangent());
|
||||
#endif
|
||||
|
||||
}
|
||||
void RAS_OpenGLRasterizer::Tangent( const RAS_TexVert& v1,
|
||||
const RAS_TexVert& v2,
|
||||
|
||||
@@ -94,6 +94,7 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer
|
||||
protected:
|
||||
int m_drawingmode;
|
||||
TexCoGen m_texco[RAS_MAX];
|
||||
bool m_useTang;
|
||||
|
||||
/** Stores the caching information for the last material activated. */
|
||||
RAS_IPolyMaterial::TCachingInfo m_materialCachingInfo;
|
||||
@@ -284,6 +285,7 @@ public:
|
||||
std::vector <OglDebugLine> m_debugLines;
|
||||
|
||||
virtual void SetTexCoords(TexCoGen coords,int enabled);
|
||||
virtual void SetAttrib(int type);
|
||||
void TexCoord(const RAS_TexVert &tv, int unit);
|
||||
virtual void GetViewMatrix(MT_Matrix4x4 &mat) const;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('*.cpp') #'RAS_GLExtensionManager.cpp RAS_OpenGLRasterizer.cpp RAS_VAOpenGLRasterizer.cpp'
|
||||
sources = env.Glob('*.cpp') #'RAS_GLExtensionManager.cpp RAS_ListRasterizer.cpp RAS_OpenGLRasterizer.cpp RAS_VAOpenGLRasterizer.cpp'
|
||||
|
||||
incs = '. #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/Rasterizer'
|
||||
incs += ' ' + env['BF_OPENGL_INC']
|
||||
|
||||
Reference in New Issue
Block a user