Final merge of HEAD (bf-blender) into the orange branch.
Here are my notes on things to look out for as potential problem spots: source/blender/blenkernel/intern/displist.c: + is initfastshade(void) supposed to be empty? I had to make it empty to get the merged tree to compile. source/blender/python/api2_2x/Armature.c: + went with the version that had Armature_getLayers() source/blender/python/api2_2x/Object.c + went with the version of Object_getPose() from bf-blender. (#ifdef 0-ed the other version) source/blender/python/api2_2x/Pose.[ch] + had problems linking due to no Pose_Init() ... copied these two files straight from bf-blender. source/blender/src/drawview.c: + view3d_panel_properties() had things shifted a few things shifted a few pixels, otherwise, things were painless source/blender/src/splash.jpg.c: + went with bf-blender version (orange is dead) source/gameengine: + went with bf-blender version -- does not compile due to IMB_rect* stuff, Ton should look into this.
This commit is contained in:
@@ -90,7 +90,6 @@ PYPLAYERLIB ?= $(PYLIB)
|
||||
GRPLIB += $(NAN_SUPERLU)/lib/$(DEBUG_DIR)libsuperlu.a
|
||||
GRPLIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
|
||||
|
||||
|
||||
# nlin: the reason that some libraries appear more than once below is
|
||||
# to handle circular dependencies in linking among libraries... some
|
||||
# linkers (e.g. under Linux) need libs to be specified multiple times
|
||||
@@ -279,7 +278,6 @@ ifeq ($(OS),$(findstring $(OS), "windows"))
|
||||
endif
|
||||
PLUGAPPLIB += $(OCGDIR)/gameengine/GamePlayer/common/$(DEBUG_DIR)libcommon.a
|
||||
|
||||
|
||||
ifeq ($(OS),$(findstring $(OS), "linux"))
|
||||
ifeq ($(CPU),i386)
|
||||
PLUGAPPLIB_XPLINK = $(OCGDIR)/gameengine/GamePlayer/netscape/src/$(DEBUG_DIR)_Blender3DPlugin_implementation_.o
|
||||
@@ -300,7 +298,6 @@ endif
|
||||
ifeq ($(OS),darwin)
|
||||
BINTARGETS = blenderdynamic.app
|
||||
BINTARGETS += blenderplayer.app
|
||||
|
||||
ifdef PY_FRAMEWORK
|
||||
PYLIB = -framework Python
|
||||
else
|
||||
@@ -366,14 +363,12 @@ ifeq ($(OS),solaris)
|
||||
PYLIB = $(NAN_PYTHON)/lib/python$(NAN_PYTHON_VERSION)/config/libpython$(NAN_PYTHON_VERSION).a
|
||||
PYLIB += $(NAN_MXTEXTTOOLS)
|
||||
PYLIB += $(NAN_ZLIB)/lib/libz.a
|
||||
|
||||
PULIB += $(NAN_ZLIB)/lib/libz.a
|
||||
SPLIB += $(NAN_ZLIB)/lib/libz.a
|
||||
endif
|
||||
|
||||
# OpenAL libs are already compiled as shared code! Check FMod if we switch to that. (nzc)
|
||||
|
||||
|
||||
# Some vars to keep the rest of this section mostly readable
|
||||
# in an 80 char term
|
||||
SOUNDSYSTEM = $(OCGDIR)/intern/SoundSystem/$(DEBUG_DIR)libSoundSystem.a
|
||||
@@ -692,3 +687,4 @@ $(DIR)/$(DEBUG_DIR)bin/npTestPlugin$(SOEXT): $(NSPLUGLIB)
|
||||
/bin/rm $(BUILDINFO_O)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ extern "C" {
|
||||
struct ListBase;
|
||||
struct MemFile;
|
||||
|
||||
#define BLENDER_VERSION 240
|
||||
#define BLENDER_VERSION 241
|
||||
|
||||
int BKE_read_file(char *dir, void *type_r);
|
||||
int BKE_read_file_from_memory(char* filebuf, int filelength, void *type_r);
|
||||
|
||||
@@ -809,7 +809,22 @@ void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[]
|
||||
pose_mat(b)= arm_mat(b) * chan_mat(b)
|
||||
|
||||
*************************************************************************** */
|
||||
/* Computes vector and roll based on a rotation. "mat" must
|
||||
contain only a rotation, and no scaling. */
|
||||
void mat3_to_vec_roll(float mat[][3], float *vec, float *roll) {
|
||||
if (vec)
|
||||
VecCopyf(vec, mat[1]);
|
||||
|
||||
if (roll) {
|
||||
float vecmat[3][3], vecmatinv[3][3], rollmat[3][3];
|
||||
|
||||
vec_roll_to_mat3(mat[1], 0.0f, vecmat);
|
||||
Mat3Inv(vecmatinv, vecmat);
|
||||
Mat3MulMat3(rollmat, vecmatinv, mat);
|
||||
|
||||
*roll= atan2(rollmat[2][0], rollmat[2][2]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculates the rest matrix of a bone based
|
||||
On its vector and a roll around that vector */
|
||||
|
||||
@@ -383,6 +383,9 @@ Object *get_constraint_target(bConstraint *con, char **subtarget)
|
||||
return (data->tar);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*subtarget= NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -283,6 +283,9 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, Mesh *me, DispLis
|
||||
|
||||
/* create vertices */
|
||||
for (i=0; i<totvert; i++) {
|
||||
if (!get_uv_map_vert(vmap, i))
|
||||
continue;
|
||||
|
||||
for (v=get_uv_map_vert(vmap, i)->next; v; v=v->next)
|
||||
if (v->separate)
|
||||
break;
|
||||
|
||||
@@ -1706,8 +1706,9 @@ static PyObject *reimportText( PyObject *module )
|
||||
|
||||
/* if previously compiled, free the object */
|
||||
/* (can't see how could be NULL, but check just in case) */
|
||||
if( text->compiled )
|
||||
if( text->compiled ){
|
||||
Py_DECREF( (PyObject *)text->compiled );
|
||||
}
|
||||
|
||||
/* compile the buffer */
|
||||
buf = txt_to_buf( text );
|
||||
|
||||
@@ -43,6 +43,7 @@ source_files = ['BPY_interface.c',
|
||||
'api2_2x/Types.c',
|
||||
'api2_2x/Window.c',
|
||||
'api2_2x/World.c',
|
||||
'api2_2x/Pose.c',
|
||||
'api2_2x/Image.c',
|
||||
'api2_2x/Text.c',
|
||||
'api2_2x/Text3d.c',
|
||||
|
||||
@@ -44,8 +44,7 @@
|
||||
#include "DNA_object_types.h" //This must come before BIF_editarmature.h...
|
||||
#include "BIF_editarmature.h"
|
||||
|
||||
//------------------UNDECLARED EXTERNAL PROTOTYPES--------------------
|
||||
//These are evil 'extern' declarations for functions with no anywhere
|
||||
//------------------EXTERNAL PROTOTYPES--------------------
|
||||
extern void free_editArmature(void);
|
||||
extern void make_boneList(ListBase* list, ListBase *bones, EditBone *parent);
|
||||
extern void editbones_to_armature (ListBase *list, Object *ob);
|
||||
@@ -112,7 +111,7 @@ static PyMethodDef BPy_BonesDict_methods[] = {
|
||||
"() - Returns the keys the dictionary"},
|
||||
{"values", (PyCFunction) BonesDict_values, METH_NOARGS,
|
||||
"() - Returns the values from the dictionary"},
|
||||
{NULL}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
//-----------------(internal)
|
||||
static int BoneMapping_Init(PyObject *dictionary, ListBase *bones){
|
||||
@@ -225,8 +224,18 @@ PyObject *BonesDict_GetItem(BPy_BonesDict *self, PyObject* key)
|
||||
}else{
|
||||
value = PyDict_GetItem(self->bonesMap, key);
|
||||
}
|
||||
if(value == NULL){
|
||||
return EXPP_incr_ret(Py_None);
|
||||
if(value == NULL){ /* item not found in dict. throw exception */
|
||||
char buffer[128];
|
||||
char* key_str;
|
||||
key_str = PyString_AsString( key );
|
||||
if( !key_str ){ /* key not a py string */
|
||||
key_str = ""; /* use empty string for printing */
|
||||
}
|
||||
|
||||
PyOS_snprintf( buffer, sizeof(buffer),
|
||||
"bone %s not found", key_str);
|
||||
|
||||
return EXPP_ReturnPyObjError(PyExc_KeyError, buffer );
|
||||
}
|
||||
return EXPP_incr_ret(value);
|
||||
}
|
||||
@@ -335,7 +344,7 @@ AttributeError3:
|
||||
return EXPP_intError(PyExc_AttributeError, "%s%s",
|
||||
sBoneDictBadArgs, "The 'connected' flag is set but the bone has no parent!");
|
||||
}
|
||||
//------------------TYPE_OBECT DEFINITION--------------------------
|
||||
//------------------TYPE_OBJECT DEFINITION--------------------------
|
||||
//Mapping Protocol
|
||||
static PyMappingMethods BonesDict_MapMethods = {
|
||||
(inquiry) BonesDict_len, //mp_length
|
||||
@@ -929,7 +938,7 @@ static PyMethodDef BPy_Armature_methods[] = {
|
||||
"() - Unlocks the ability to modify armature bones"},
|
||||
{"update", (PyCFunction) Armature_update, METH_NOARGS,
|
||||
"() - Rebuilds the armature based on changes to bones since the last call to makeEditable"},
|
||||
{NULL}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
//------------------------tp_getset
|
||||
//This contains methods for attributes that require checking
|
||||
@@ -1218,7 +1227,7 @@ static char M_Armature_Get_doc[] = "(name) - return the armature with the name '
|
||||
|
||||
struct PyMethodDef M_Armature_methods[] = {
|
||||
{"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc},
|
||||
{NULL}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
//------------------VISIBLE PROTOTYPE IMPLEMENTATION-----------------------
|
||||
//-----------------(internal)
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
//-------------------MODULE INIT---------------------------------
|
||||
PyObject *Armature_Init( void );
|
||||
//-------------------TYPEOBJECT----------------------------------
|
||||
PyTypeObject Armature_Type;
|
||||
PyTypeObject BonesDict_Type;
|
||||
extern PyTypeObject Armature_Type;
|
||||
extern PyTypeObject BonesDict_Type;
|
||||
//-------------------STRUCT DEFINITION---------------------------
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
||||
@@ -256,39 +256,20 @@ static PyObject *BezTriple_getTriple( BPy_BezTriple * self )
|
||||
|
||||
static PyObject *BezTriple_setPoints( BPy_BezTriple * self, PyObject * args )
|
||||
{
|
||||
|
||||
int i;
|
||||
struct BezTriple *bezt = self->beztriple;
|
||||
PyObject *popo = 0;
|
||||
|
||||
if( !PyArg_ParseTuple( args, "O", &popo ) )
|
||||
return ( EXPP_ReturnPyObjError
|
||||
( PyExc_TypeError, "expected sequence argument" ) );
|
||||
|
||||
if( PySequence_Check( popo ) == 0 ) {
|
||||
puts( "error in BezTriple_setPoints - expected sequence" );
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
{
|
||||
/*
|
||||
some debug stuff
|
||||
this will become an overloaded args check
|
||||
*/
|
||||
int size = PySequence_Size( popo );
|
||||
printf( "\n dbg: sequence size is %d\n", size );
|
||||
}
|
||||
if( !PyArg_ParseTuple( args, "O", &popo ) || !PySequence_Check( popo ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected sequence argument" );
|
||||
|
||||
for( i = 0; i < 2; i++ ) {
|
||||
PyObject *o = PySequence_GetItem( popo, i );
|
||||
if( !o )
|
||||
printf( "\n bad o. o no!\n" );
|
||||
|
||||
/* bezt->vec[1][i] = PyFloat_AsDouble (PyTuple_GetItem (popo, i)); */
|
||||
PyObject *o = PySequence_ITEM( popo, i );
|
||||
bezt->vec[1][i] = (float)PyFloat_AsDouble( o );
|
||||
bezt->vec[0][i] = bezt->vec[1][i] - 1;
|
||||
bezt->vec[2][i] = bezt->vec[1][i] + 1;
|
||||
Py_DECREF( o );
|
||||
}
|
||||
|
||||
/* experimental fussing with handles - ipo.c: calchandles_ipocurve */
|
||||
@@ -298,8 +279,7 @@ static PyObject *BezTriple_setPoints( BPy_BezTriple * self, PyObject * args )
|
||||
if( bezt->vec[2][0] < bezt->vec[1][0] )
|
||||
bezt->vec[2][0] = bezt->vec[1][0];
|
||||
|
||||
Py_INCREF( Py_None );
|
||||
return Py_None;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,14 +42,15 @@
|
||||
#include "DNA_object_types.h" //1
|
||||
#include "BIF_editarmature.h" //2
|
||||
|
||||
//------------------UNDECLARED EXTERNAL PROTOTYPES--------------------
|
||||
extern void mat3_to_vec_roll(float mat[][3], float *vec, float *roll);
|
||||
|
||||
//------------------------ERROR CODES---------------------------------
|
||||
//This is here just to make me happy and to have more consistant error strings :)
|
||||
static const char sEditBoneError[] = "EditBone (internal) - Error: ";
|
||||
static const char sEditBoneBadArgs[] = "EditBone (internal) - Bad Arguments: ";
|
||||
static const char sEditBoneError[] = "EditBone - Error: ";
|
||||
static const char sEditBoneBadArgs[] = "EditBone - Bad Arguments: ";
|
||||
static const char sBoneError[] = "Bone - Error: ";
|
||||
static const char sBoneBadArgs[] = "Bone - Bad Arguments: ";
|
||||
static const char sConstListError[] = "ConstantList - Error: ";
|
||||
static const char sConstListBadArgs[] = "ConstantList - Bad Arguments: ";
|
||||
|
||||
//----------------------(internal)
|
||||
//gets the bone->roll (which is a localspace roll) and puts it in parentspace
|
||||
@@ -541,7 +542,6 @@ static int EditBone_setParent(BPy_EditBone *self, PyObject *value, void *closure
|
||||
AttributeError:
|
||||
return EXPP_intError(PyExc_AttributeError, "%s%s%s",
|
||||
sEditBoneError, ".parent: ", "expects a EditBone Object");
|
||||
|
||||
AttributeError2:
|
||||
return EXPP_intError(PyExc_AttributeError, "%s%s%s",
|
||||
sEditBoneError, ".parent: ", "This object is not in the armature's bone list!");
|
||||
@@ -565,8 +565,53 @@ static PyObject *EditBone_getMatrix(BPy_EditBone *self, void *closure)
|
||||
//------------------------EditBone.matrix (set)
|
||||
static int EditBone_setMatrix(BPy_EditBone *self, PyObject *value, void *closure)
|
||||
{
|
||||
printf("Sorry this isn't implemented yet.... :/");
|
||||
return 1;
|
||||
PyObject *matrix;
|
||||
float roll, length, vec[3], axis[3], mat3[3][3];
|
||||
|
||||
if (!PyArg_Parse(value, "O!", &matrix_Type, &matrix))
|
||||
goto AttributeError;
|
||||
|
||||
//make sure we have the right sizes
|
||||
if (((MatrixObject*)matrix)->rowSize != 3 && ((MatrixObject*)matrix)->colSize != 3){
|
||||
if(((MatrixObject*)matrix)->rowSize != 4 && ((MatrixObject*)matrix)->colSize != 4){
|
||||
goto AttributeError;
|
||||
}
|
||||
}
|
||||
|
||||
/*vec will be a normalized directional vector
|
||||
* together with the length of the old bone vec*length = the new vector*/
|
||||
/*The default rotation is 0,1,0 on the Y axis (see mat3_to_vec_roll)*/
|
||||
if (((MatrixObject*)matrix)->rowSize == 4){
|
||||
Mat3CpyMat4(mat3, ((float (*)[4])*((MatrixObject*)matrix)->matrix));
|
||||
}else{
|
||||
Mat3CpyMat3(mat3, ((float (*)[3])*((MatrixObject*)matrix)->matrix));
|
||||
}
|
||||
mat3_to_vec_roll(mat3, vec, &roll);
|
||||
|
||||
//if a 4x4 matrix was passed we'll translate the vector otherwise not
|
||||
if (self->editbone){
|
||||
self->editbone->roll = roll;
|
||||
VecSubf(axis, self->editbone->tail, self->editbone->head);
|
||||
length = VecLength(axis);
|
||||
VecMulf(vec, length);
|
||||
if (((MatrixObject*)matrix)->rowSize == 4)
|
||||
VecCopyf(self->editbone->head, ((MatrixObject*)matrix)->matrix[3]);
|
||||
VecAddf(self->editbone->tail, self->editbone->head, vec);
|
||||
return 0;
|
||||
}else{
|
||||
self->roll = roll;
|
||||
VecSubf(axis, self->tail, self->head);
|
||||
length = VecLength(axis);
|
||||
VecMulf(vec, length);
|
||||
if (((MatrixObject*)matrix)->rowSize == 4)
|
||||
VecCopyf(self->head, ((MatrixObject*)matrix)->matrix[3]);
|
||||
VecAddf(self->tail, self->head, vec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AttributeError:
|
||||
return EXPP_intError(PyExc_AttributeError, "%s%s%s",
|
||||
sEditBoneError, ".matrix: ", "expects a 3x3 or 4x4 Matrix Object");
|
||||
}
|
||||
//------------------------Bone.length (get)
|
||||
static PyObject *EditBone_getLength(BPy_EditBone *self, void *closure)
|
||||
@@ -603,7 +648,7 @@ static PyMethodDef BPy_EditBone_methods[] = {
|
||||
"() - True/False - Bone has a parent"},
|
||||
{"clearParent", (PyCFunction) EditBone_clearParent, METH_NOARGS,
|
||||
"() - sets the parent to None"},
|
||||
{NULL}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
///------------------------tp_getset
|
||||
//This contains methods for attributes that require checking
|
||||
@@ -630,7 +675,7 @@ static PyGetSetDef BPy_EditBone_getset[] = {
|
||||
"The parent bone of this bone", NULL},
|
||||
{"length", (getter)EditBone_getLength, (setter)EditBone_setLength,
|
||||
"The length of this bone", NULL},
|
||||
{NULL}
|
||||
{NULL, NULL, NULL, NULL,NULL}
|
||||
};
|
||||
|
||||
//------------------------tp_repr
|
||||
@@ -751,6 +796,28 @@ PyTypeObject EditBone_Type = {
|
||||
};
|
||||
|
||||
//------------------METHOD IMPLEMENTATIONS--------------------------------
|
||||
//------------------------(internal) PyBone_ChildrenAsList
|
||||
static int PyBone_ChildrenAsList(PyObject *list, ListBase *bones){
|
||||
Bone *bone = NULL;
|
||||
PyObject *py_bone = NULL;
|
||||
|
||||
for (bone = bones->first; bone; bone = bone->next){
|
||||
py_bone = PyBone_FromBone(bone);
|
||||
if (py_bone == NULL)
|
||||
return 0;
|
||||
|
||||
if(PyList_Append(list, py_bone) == -1){
|
||||
goto RuntimeError;
|
||||
}
|
||||
if (bone->childbase.first)
|
||||
PyBone_ChildrenAsList(list, &bone->childbase);
|
||||
}
|
||||
return 1;
|
||||
|
||||
RuntimeError:
|
||||
return EXPP_intError(PyExc_RuntimeError, "%s%s",
|
||||
sBoneError, "Internal error trying to wrap blender bones!");
|
||||
}
|
||||
//-------------------------Bone.hasParent()
|
||||
PyObject *Bone_hasParent(BPy_Bone *self)
|
||||
{
|
||||
@@ -767,6 +834,20 @@ PyObject *Bone_hasChildren(BPy_Bone *self)
|
||||
else
|
||||
return EXPP_incr_ret(Py_False);
|
||||
}
|
||||
//-------------------------Bone.getAllChildren()
|
||||
PyObject *Bone_getAllChildren(BPy_Bone *self)
|
||||
{
|
||||
PyObject *list = NULL;
|
||||
|
||||
if (self->bone->childbase.first){
|
||||
list = PyList_New(0);
|
||||
if (!PyBone_ChildrenAsList(list, &self->bone->childbase))
|
||||
return NULL;
|
||||
return EXPP_incr_ret(list);
|
||||
}else{
|
||||
return EXPP_incr_ret(Py_None);
|
||||
}
|
||||
}
|
||||
//------------------ATTRIBUTE IMPLEMENTATIONS-----------------------------
|
||||
//------------------------Bone.name (get)
|
||||
static PyObject *Bone_getName(BPy_Bone *self, void *closure)
|
||||
@@ -920,42 +1001,31 @@ static int Bone_setParent(BPy_Bone *self, PyObject *value, void *closure)
|
||||
return EXPP_intError(PyExc_ValueError, "%s%s",
|
||||
sBoneError, "You must first call .makeEditable() to edit the armature");
|
||||
}
|
||||
//------------------------(internal) PyBone_ChildrenAsList
|
||||
static int PyBone_ChildrenAsList(PyObject *list, ListBase *bones){
|
||||
Bone *bone = NULL;
|
||||
PyObject *py_bone = NULL;
|
||||
|
||||
for (bone = bones->first; bone; bone = bone->next){
|
||||
py_bone = PyBone_FromBone(bone);
|
||||
if (py_bone == NULL)
|
||||
return 0;
|
||||
|
||||
if(PyList_Append(list, py_bone) == -1){
|
||||
goto RuntimeError;
|
||||
}
|
||||
if (bone->childbase.first)
|
||||
PyBone_ChildrenAsList(list, &bone->childbase);
|
||||
}
|
||||
return 1;
|
||||
|
||||
RuntimeError:
|
||||
return EXPP_intError(PyExc_RuntimeError, "%s%s",
|
||||
sBoneError, "Internal error trying to wrap blender bones!");
|
||||
}
|
||||
|
||||
//------------------------Bone.children (get)
|
||||
static PyObject *Bone_getChildren(BPy_Bone *self, void *closure)
|
||||
{
|
||||
PyObject *list = NULL;
|
||||
Bone *bone = NULL;
|
||||
PyObject *py_bone = NULL;
|
||||
|
||||
if (self->bone->childbase.first){
|
||||
list = PyList_New(0);
|
||||
if (!PyBone_ChildrenAsList(list, &self->bone->childbase))
|
||||
return NULL;
|
||||
for (bone = self->bone->childbase.first; bone; bone = bone->next){
|
||||
py_bone = PyBone_FromBone(bone);
|
||||
if (py_bone == NULL)
|
||||
return 0;
|
||||
if(PyList_Append(list, py_bone) == -1){
|
||||
goto RuntimeError;
|
||||
}
|
||||
}
|
||||
return EXPP_incr_ret(list);
|
||||
}else{
|
||||
return EXPP_incr_ret(Py_None);
|
||||
}
|
||||
|
||||
RuntimeError:
|
||||
return EXPP_objError(PyExc_RuntimeError, "%s%s",
|
||||
sBoneError, "Internal error trying to wrap blender bones!");
|
||||
}
|
||||
//------------------------Bone.children (set)
|
||||
static int Bone_setChildren(BPy_Bone *self, PyObject *value, void *closure)
|
||||
@@ -995,7 +1065,9 @@ static PyMethodDef BPy_Bone_methods[] = {
|
||||
"() - True/False - Bone has a parent"},
|
||||
{"hasChildren", (PyCFunction) Bone_hasChildren, METH_NOARGS,
|
||||
"() - True/False - Bone has 1 or more children"},
|
||||
{NULL}
|
||||
{"getAllChildren", (PyCFunction) Bone_getAllChildren, METH_NOARGS,
|
||||
"() - All the children for this bone - including children's children"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
//------------------------tp_getset
|
||||
//This contains methods for attributes that require checking
|
||||
@@ -1024,7 +1096,7 @@ static PyGetSetDef BPy_Bone_getset[] = {
|
||||
"The child bones of this bone", NULL},
|
||||
{"length", (getter)Bone_getLength, (setter)Bone_setLength,
|
||||
"The length of this bone", NULL},
|
||||
{NULL}
|
||||
{NULL, NULL, NULL, NULL,NULL}
|
||||
};
|
||||
//------------------------tp_repr
|
||||
//This is the string representation of the object
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
#define BoneObject_Check(v) ((v)->ob_type == &Bone_Type)
|
||||
#define EditBoneObject_Check(v) ((v)->ob_type == &EditBone_Type)
|
||||
//-------------------TYPEOBJECT----------------------------------
|
||||
PyTypeObject EditBone_Type;
|
||||
PyTypeObject Bone_Type;
|
||||
extern PyTypeObject EditBone_Type;
|
||||
extern PyTypeObject Bone_Type;
|
||||
//-------------------STRUCT DEFINITION----------------------------
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
*
|
||||
* This is a new part of Blender.
|
||||
*
|
||||
* Contributor(s): Pontus Lidman, Johnny Matthews, Ken Hughes
|
||||
* Contributor(s): Pontus Lidman, Johnny Matthews, Ken Hughes,
|
||||
* Michael Reimpell
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
@@ -36,6 +37,7 @@
|
||||
#include <BKE_global.h>
|
||||
#include <BKE_main.h>
|
||||
#include <BKE_curve.h>
|
||||
#include "BIF_space.h"
|
||||
|
||||
#include "Ipocurve.h"
|
||||
#include "Key.h"
|
||||
@@ -62,10 +64,12 @@ static void KeyBlock_dealloc( PyObject * self );
|
||||
static PyObject *Key_repr( BPy_Key * self );
|
||||
|
||||
static PyObject *Key_getBlocks( PyObject * self );
|
||||
static PyObject *Key_getType( PyObject * self );
|
||||
static PyObject *Key_getType( BPy_Key * self );
|
||||
static PyObject *Key_getRelative( BPy_Key * self );
|
||||
static PyObject *Key_getIpo( PyObject * self );
|
||||
static int Key_setIpo( PyObject * self, PyObject * args );
|
||||
static PyObject *Key_getValue( PyObject * self );
|
||||
static int Key_setRelative( BPy_Key * self, PyObject * value );
|
||||
|
||||
static struct PyMethodDef Key_methods[] = {
|
||||
{ "getBlocks", (PyCFunction) Key_getBlocks, METH_NOARGS, "Get key blocks" },
|
||||
@@ -79,16 +83,16 @@ static PyGetSetDef BPy_Key_getsetters[] = {
|
||||
{"value",(getter)Key_getValue, (setter)NULL,
|
||||
"Key value",NULL},
|
||||
{"ipo",(getter)Key_getIpo, (setter)Key_setIpo,
|
||||
"ipo linked to key",NULL},
|
||||
"Ipo linked to key",NULL},
|
||||
{"blocks",(getter)Key_getBlocks, (setter)NULL,
|
||||
"blocks linked to the key",NULL},
|
||||
"Blocks linked to the key",NULL},
|
||||
{"relative",(getter)Key_getRelative, (setter)Key_setRelative,
|
||||
"Non-zero is key is relative",NULL},
|
||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
|
||||
static PyObject *KeyBlock_getData( PyObject * self );
|
||||
|
||||
static PyObject *KeyBlock_getCurval( BPy_KeyBlock * self );
|
||||
static PyObject *KeyBlock_getName( BPy_KeyBlock * self );
|
||||
static PyObject *KeyBlock_getPos( BPy_KeyBlock * self );
|
||||
static PyObject *KeyBlock_getSlidermin( BPy_KeyBlock * self );
|
||||
@@ -107,6 +111,8 @@ static struct PyMethodDef KeyBlock_methods[] = {
|
||||
};
|
||||
|
||||
static PyGetSetDef BPy_KeyBlock_getsetters[] = {
|
||||
{"curval",(getter)KeyBlock_getCurval, (setter)NULL,
|
||||
"Current value of the corresponding IpoCurve",NULL},
|
||||
{"name",(getter)KeyBlock_getName, (setter)KeyBlock_setName,
|
||||
"Keyblock Name",NULL},
|
||||
{"pos",(getter)KeyBlock_getPos, (setter)NULL,
|
||||
@@ -362,13 +368,32 @@ static int Key_setIpo( PyObject * self, PyObject * value )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Key_getType( PyObject * self )
|
||||
static PyObject *Key_getRelative( BPy_Key * self )
|
||||
{
|
||||
if( self->key->type == KEY_RELATIVE )
|
||||
return EXPP_incr_ret(Py_True);
|
||||
else
|
||||
return EXPP_incr_ret(Py_False);
|
||||
}
|
||||
|
||||
static int Key_setRelative( BPy_Key * self, PyObject * value )
|
||||
{
|
||||
if( PyObject_IsTrue( value ) )
|
||||
self->key->type = KEY_RELATIVE;
|
||||
else
|
||||
self->key->type = KEY_NORMAL;
|
||||
allqueue(REDRAWIPO, 0);
|
||||
allspace(REMAKEIPO, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *Key_getType( BPy_Key * self )
|
||||
{
|
||||
BPy_Key *k = ( BPy_Key * ) self;
|
||||
int idcode;
|
||||
int type = -1;
|
||||
|
||||
idcode = GS( k->key->from->name );
|
||||
idcode = GS( self->key->from->name );
|
||||
|
||||
switch( idcode ) {
|
||||
case ID_ME:
|
||||
@@ -437,55 +462,51 @@ PyObject *KeyBlock_CreatePyObject( KeyBlock * kb, Key *parentKey )
|
||||
return ( PyObject * ) keyBlock;
|
||||
}
|
||||
|
||||
static PyObject *KeyBlock_getCurval( BPy_KeyBlock * self ) {
|
||||
return PyFloat_FromDouble( self->keyblock->curval );
|
||||
}
|
||||
|
||||
static PyObject *KeyBlock_getName( BPy_KeyBlock * self ) {
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
PyObject *name = Py_BuildValue( "s", kb->keyblock->name);
|
||||
PyObject *name = Py_BuildValue( "s", self->keyblock->name);
|
||||
return name;
|
||||
}
|
||||
|
||||
static PyObject *KeyBlock_getPos( BPy_KeyBlock * self ){
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
return PyFloat_FromDouble( kb->keyblock->pos );
|
||||
return PyFloat_FromDouble( self->keyblock->pos );
|
||||
}
|
||||
|
||||
static PyObject *KeyBlock_getSlidermin( BPy_KeyBlock * self ){
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
return PyFloat_FromDouble( kb->keyblock->slidermin );
|
||||
return PyFloat_FromDouble( self->keyblock->slidermin );
|
||||
}
|
||||
|
||||
static PyObject *KeyBlock_getSlidermax( BPy_KeyBlock * self ){
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
return PyFloat_FromDouble( kb->keyblock->slidermax );
|
||||
return PyFloat_FromDouble( self->keyblock->slidermax );
|
||||
}
|
||||
|
||||
static PyObject *KeyBlock_getVgroup( BPy_KeyBlock * self ){
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
PyObject *name = Py_BuildValue( "s", kb->keyblock->vgroup);
|
||||
return name;
|
||||
return Py_BuildValue( "s", self->keyblock->vgroup);
|
||||
}
|
||||
|
||||
static int KeyBlock_setName( BPy_KeyBlock * self, PyObject * args ){
|
||||
char* text = NULL;
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
|
||||
text = PyString_AsString ( args );
|
||||
if( !text )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected string argument" );
|
||||
strncpy( kb->keyblock->name, text , 32);
|
||||
strncpy( self->keyblock->name, text , 32);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int KeyBlock_setVgroup( BPy_KeyBlock * self, PyObject * args ){
|
||||
char* text = NULL;
|
||||
BPy_KeyBlock *kb = ( BPy_KeyBlock * ) self;
|
||||
|
||||
text = PyString_AsString ( args );
|
||||
if( !text )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected string argument" );
|
||||
strncpy( kb->keyblock->vgroup, text , 32);
|
||||
strncpy( self->keyblock->vgroup, text , 32);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -635,7 +656,8 @@ static PyObject *M_Key_Get( PyObject * self, PyObject * args )
|
||||
"expected string argument (or nothing)" ) );
|
||||
|
||||
if ( name ) {
|
||||
for (key_iter = G.main->key.first; key_iter; key_iter=key_iter->id.next) {
|
||||
for (key_iter = G.main->key.first; key_iter;
|
||||
key_iter=key_iter->id.next) {
|
||||
if (strcmp ( key_iter->id.name + 2, name ) == 0 ) {
|
||||
return Key_CreatePyObject( key_iter );
|
||||
}
|
||||
@@ -643,17 +665,16 @@ static PyObject *M_Key_Get( PyObject * self, PyObject * args )
|
||||
|
||||
PyOS_snprintf( error_msg, sizeof( error_msg ),
|
||||
"Key \"%s\" not found", name );
|
||||
return ( EXPP_ReturnPyObjError ( PyExc_NameError, error_msg ) );
|
||||
return EXPP_ReturnPyObjError ( PyExc_NameError, error_msg );
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
|
||||
PyObject *keylist;
|
||||
|
||||
keylist = PyList_New( BLI_countlist( &( G.main->key ) ) );
|
||||
|
||||
for ( i=0, key_iter = G.main->key.first; key_iter; key_iter=key_iter->id.next, i++ ) {
|
||||
for ( i=0, key_iter = G.main->key.first; key_iter;
|
||||
key_iter=key_iter->id.next, i++ ) {
|
||||
PyList_SetItem(keylist, i, Key_CreatePyObject(key_iter));
|
||||
}
|
||||
return keylist;
|
||||
@@ -665,32 +686,36 @@ struct PyMethodDef M_Key_methods[] = {
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
static PyObject *M_Key_TypesDict( void )
|
||||
{
|
||||
PyObject *T = PyConstant_New( );
|
||||
|
||||
if( T ) {
|
||||
BPy_constant *d = ( BPy_constant * ) T;
|
||||
|
||||
PyConstant_Insert( d, "MESH", PyInt_FromLong( KEY_TYPE_MESH ) );
|
||||
PyConstant_Insert( d, "CURVE", PyInt_FromLong( KEY_TYPE_CURVE ) );
|
||||
PyConstant_Insert( d, "LATTICE", PyInt_FromLong( KEY_TYPE_LATTICE ) );
|
||||
}
|
||||
|
||||
return T;
|
||||
}
|
||||
|
||||
PyObject *Key_Init( void )
|
||||
{
|
||||
PyObject *submodule, *KeyTypes;
|
||||
PyObject *submodule;
|
||||
PyObject *Types = NULL;
|
||||
|
||||
if( PyType_Ready( &Key_Type ) < 0)
|
||||
if( PyType_Ready( &Key_Type ) < 0 || PyType_Ready( &KeyBlock_Type ) < 0 )
|
||||
return NULL;
|
||||
|
||||
Key_Type.ob_type = &PyType_Type;
|
||||
PyType_Ready( &KeyBlock_Type );
|
||||
|
||||
submodule =
|
||||
Py_InitModule3( "Blender.Key", M_Key_methods, "Key module" );
|
||||
|
||||
KeyTypes = PyConstant_New( );
|
||||
Types = M_Key_TypesDict( );
|
||||
if( Types )
|
||||
PyModule_AddObject( submodule, "Types", Types );
|
||||
|
||||
PyConstant_Insert(( BPy_constant * ) KeyTypes, "MESH", PyInt_FromLong(KEY_TYPE_MESH));
|
||||
PyConstant_Insert(( BPy_constant * ) KeyTypes, "CURVE", PyInt_FromLong(KEY_TYPE_CURVE));
|
||||
PyConstant_Insert(( BPy_constant * ) KeyTypes, "LATTICE", PyInt_FromLong(KEY_TYPE_LATTICE));
|
||||
|
||||
PyModule_AddObject( submodule, "Types", KeyTypes);
|
||||
|
||||
/*
|
||||
PyModule_AddIntConstant( submodule, "TYPE_MESH", KEY_TYPE_MESH );
|
||||
PyModule_AddIntConstant( submodule, "TYPE_CURVE", KEY_TYPE_CURVE );
|
||||
PyModule_AddIntConstant( submodule, "TYPE_LATTICE", KEY_TYPE_LATTICE );
|
||||
*/
|
||||
return submodule;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,6 @@
|
||||
#include "constant.h"
|
||||
#include "gen_utils.h"
|
||||
|
||||
#define MESH_TOOLS /* add access to mesh tools */
|
||||
|
||||
/* EXPP Mesh defines */
|
||||
|
||||
#define MESH_SMOOTHRESH 30
|
||||
@@ -126,6 +124,7 @@ typedef struct SrchEdges {
|
||||
|
||||
typedef struct SrchFaces {
|
||||
unsigned int v[4]; /* indices for verts */
|
||||
unsigned int index; /* index in original param list of this edge */
|
||||
unsigned char order; /* order of original verts, bitpacked */
|
||||
} SrchFaces;
|
||||
|
||||
@@ -155,6 +154,22 @@ int medge_comp( const void *va, const void *vb )
|
||||
else return (a[1] > b[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* compare edges by insert list indices
|
||||
*/
|
||||
|
||||
int medge_index_comp( const void *va, const void *vb )
|
||||
{
|
||||
const SrchEdges *a = (SrchEdges *)va;
|
||||
const SrchEdges *b = (SrchEdges *)vb;
|
||||
|
||||
/* compare list indices for differences */
|
||||
|
||||
if (a->index < b->index) return -1;
|
||||
else return (a->index > b->index);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* compare faces by vertex indices
|
||||
*/
|
||||
@@ -190,6 +205,23 @@ int mface_comp( const void *va, const void *vb )
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* compare faces by insert list indices
|
||||
*/
|
||||
|
||||
int mface_index_comp( const void *va, const void *vb )
|
||||
{
|
||||
const SrchFaces *a = va;
|
||||
const SrchFaces *b = vb;
|
||||
|
||||
/* compare indices, first to last, for differences */
|
||||
if( a->index < b->index )
|
||||
return -1;
|
||||
if( a->index > b->index )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* compare edges by vertex indices
|
||||
*/
|
||||
@@ -1386,7 +1418,7 @@ static PyObject *MVertSeq_item( BPy_MVertSeq * self, int i )
|
||||
"array index out of range" );
|
||||
|
||||
return MVert_CreatePyObject( self->mesh, i );
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* retrieve a slice of the vertex list (as a Python list)
|
||||
@@ -1453,7 +1485,7 @@ static int MVertSeq_assign_item( BPy_MVertSeq * self, int i,
|
||||
memcpy( dst, src, sizeof(MVert) );
|
||||
// mesh_update( self->mesh );
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
static int MVertSeq_assign_slice( BPy_MVertSeq *self, int low, int high,
|
||||
PyObject *args )
|
||||
@@ -1572,33 +1604,36 @@ static PyObject *MVertSeq_extend( BPy_MVertSeq * self, PyObject *args )
|
||||
if( !VectorObject_Check ( tmp ) ) {
|
||||
if( !PySequence_Check ( tmp ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of tuple triplets" );
|
||||
"expected a sequence of sequence triplets" );
|
||||
args = tmp;
|
||||
}
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
break;
|
||||
case 3: /* take any three args and put into a tuple */
|
||||
case 3:
|
||||
tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PyTuple_Check( tmp ) ) {
|
||||
Py_INCREF( args );
|
||||
break;
|
||||
}
|
||||
/* if first item is not a number, it's wrong */
|
||||
if( !PyNumber_Check( tmp ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of sequence triplets" );
|
||||
|
||||
/* otherwise, put into a new tuple */
|
||||
args = Py_BuildValue( "((OOO))", tmp,
|
||||
PyTuple_GET_ITEM( args, 1 ), PyTuple_GET_ITEM( args, 2 ) );
|
||||
if( !args )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"Py_BuildValue() failed" );
|
||||
break;
|
||||
|
||||
default: /* anything else is definitely wrong */
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of tuple triplets" );
|
||||
"expected a sequence of sequence triplets" );
|
||||
}
|
||||
|
||||
/* if no verts given, return quietly */
|
||||
len = PySequence_Size( args );
|
||||
if( len == 0 ) {
|
||||
Py_DECREF ( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected at least one tuple" );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
newlen = mesh->totvert + len;
|
||||
@@ -1620,18 +1655,19 @@ static PyObject *MVertSeq_extend( BPy_MVertSeq * self, PyObject *args )
|
||||
}
|
||||
for( j = 0; j < 3; ++j )
|
||||
co[j] = ((VectorObject *)tmp)->vec[j];
|
||||
} else if( PyTuple_Check( tmp ) ) {
|
||||
} else if( PySequence_Check( tmp ) ) {
|
||||
int ok=1;
|
||||
PyObject *flt;
|
||||
if( PyTuple_Size( tmp ) != 3 )
|
||||
if( PySequence_Size( tmp ) != 3 )
|
||||
ok = 0;
|
||||
else
|
||||
for( j = 0; ok && j < 3; ++j ) {
|
||||
flt = PyTuple_GET_ITEM( tmp, j );
|
||||
flt = PySequence_ITEM( tmp, j );
|
||||
if( !PyNumber_Check ( flt ) )
|
||||
ok = 0;
|
||||
else
|
||||
co[j] = (float)PyFloat_AsDouble( flt );
|
||||
Py_DECREF( flt );
|
||||
}
|
||||
|
||||
if( !ok ) {
|
||||
@@ -1639,9 +1675,16 @@ static PyObject *MVertSeq_extend( BPy_MVertSeq * self, PyObject *args )
|
||||
Py_DECREF ( args );
|
||||
Py_DECREF ( tmp );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected tuple triplet of floats" );
|
||||
"expected sequence triplet of floats" );
|
||||
}
|
||||
} else {
|
||||
MEM_freeN( newvert );
|
||||
Py_DECREF ( args );
|
||||
Py_DECREF ( tmp );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected sequence triplet of floats" );
|
||||
}
|
||||
|
||||
Py_DECREF ( tmp );
|
||||
|
||||
/* add the coordinate to the new list */
|
||||
@@ -1714,7 +1757,7 @@ static PyObject *MVertSeq_extend( BPy_MVertSeq * self, PyObject *args )
|
||||
mesh_update( mesh );
|
||||
|
||||
Py_DECREF ( args );
|
||||
return EXPP_incr_ret( Py_None );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *MVertSeq_delete( BPy_MVertSeq * self, PyObject *args )
|
||||
@@ -1725,15 +1768,20 @@ static PyObject *MVertSeq_delete( BPy_MVertSeq * self, PyObject *args )
|
||||
Mesh *mesh = self->mesh;
|
||||
MFace *tmpface;
|
||||
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
|
||||
/* accept a sequence (lists or tuples) also */
|
||||
/*
|
||||
* if input tuple contains a single sequence, use it as input instead;
|
||||
* otherwise use the sequence as-is and check later that it contains
|
||||
* one or more integers or MVerts
|
||||
*/
|
||||
if( PySequence_Size( args ) == 1 ) {
|
||||
PyObject *tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PySequence_Check ( tmp ) ) {
|
||||
Py_DECREF( args ); /* release previous reference */
|
||||
args = tmp; /* PyTuple_GET_ITEM returns new ref */
|
||||
if( PySequence_Check( tmp ) )
|
||||
args = tmp;
|
||||
}
|
||||
|
||||
/* if sequence is empty, do nothing */
|
||||
if( PySequence_Size( args ) == 0 ) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* allocate vertex lookup table */
|
||||
@@ -1747,18 +1795,15 @@ static PyObject *MVertSeq_delete( BPy_MVertSeq * self, PyObject *args )
|
||||
if( BPy_MVert_Check( tmp ) ) {
|
||||
if( (void *)self->mesh != ((BPy_MVert*)tmp)->data ) {
|
||||
MEM_freeN( vert_table );
|
||||
Py_DECREF( args );
|
||||
Py_DECREF( tmp );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"MVert belongs to a different mesh" );
|
||||
}
|
||||
index = ((BPy_MVert*)tmp)->index;
|
||||
}
|
||||
else if( PyInt_CheckExact( tmp ) )
|
||||
} else if( PyInt_CheckExact( tmp ) ) {
|
||||
index = PyInt_AsLong ( tmp );
|
||||
else {
|
||||
} else {
|
||||
MEM_freeN( vert_table );
|
||||
Py_DECREF( args );
|
||||
Py_DECREF( tmp );
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of ints or MVerts" );
|
||||
@@ -1766,8 +1811,7 @@ static PyObject *MVertSeq_delete( BPy_MVertSeq * self, PyObject *args )
|
||||
Py_DECREF( tmp );
|
||||
if( index < 0 || index >= mesh->totvert ) {
|
||||
MEM_freeN( vert_table );
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
return EXPP_ReturnPyObjError( PyExc_IndexError,
|
||||
"array index out of range" );
|
||||
}
|
||||
vert_table[index] = UINT_MAX;
|
||||
@@ -1802,8 +1846,7 @@ static PyObject *MVertSeq_delete( BPy_MVertSeq * self, PyObject *args )
|
||||
/* clean up and exit */
|
||||
MEM_freeN( vert_table );
|
||||
mesh_update ( mesh );
|
||||
Py_DECREF( args );
|
||||
return EXPP_incr_ret( Py_None );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *MVertSeq_selected( BPy_MVertSeq * self )
|
||||
@@ -2413,40 +2456,52 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
MEdge *tmpedge;
|
||||
Mesh *mesh = self->mesh;
|
||||
|
||||
/* make sure we get a sequence of tuples of something */
|
||||
|
||||
/* make sure we get a tuple of sequences of something */
|
||||
switch( PySequence_Size( args ) ) {
|
||||
case 1: /* better be a list or a tuple */
|
||||
args = PyTuple_GET_ITEM( args, 0 );
|
||||
if( !PySequence_Check ( args ) )
|
||||
case 1:
|
||||
/* if a sequence... */
|
||||
tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PySequence_Check( tmp ) ) {
|
||||
/* if another sequence, use it */
|
||||
PyObject *tmp2 = PySequence_ITEM( tmp, 0 );
|
||||
if( PySequence_Check( tmp2 ) )
|
||||
args = tmp;
|
||||
Py_INCREF( args );
|
||||
Py_DECREF( tmp2 );
|
||||
} else
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of tuple pairs" );
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
"expected a sequence of sequence pairs" );
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4: /* two to four args may be individual verts */
|
||||
tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PyTuple_Check( tmp ) ) {/* maybe just tuples, so use args as-is */
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* if first item isn't a sequence, then assume it's a bunch of MVerts
|
||||
* and wrap inside a tuple
|
||||
*/
|
||||
if( !PySequence_Check( tmp ) ) {
|
||||
args = Py_BuildValue( "(O)", args );
|
||||
if( !args )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"Py_BuildValue() failed" );
|
||||
/*
|
||||
* otherwise, assume it already a bunch of sequences so use as-is
|
||||
*/
|
||||
} else {
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
}
|
||||
break;
|
||||
default: /* anything else is definitely wrong */
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of tuple pairs" );
|
||||
"expected a sequence of sequence pairs" );
|
||||
}
|
||||
|
||||
/* make sure there is something to add */
|
||||
len = PySequence_Size( args );
|
||||
if( len == 0 ) {
|
||||
Py_DECREF ( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected at least one tuple" );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* verify the param list and get a total count of number of edges */
|
||||
@@ -2455,21 +2510,21 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
tmp = PySequence_GetItem( args, i );
|
||||
|
||||
/* not a tuple of MVerts... error */
|
||||
if( !PyTuple_Check( tmp ) ||
|
||||
if( !PySequence_Check( tmp ) ||
|
||||
EXPP_check_sequence_consistency( tmp, &MVert_Type ) != 1 ) {
|
||||
Py_DECREF( tmp );
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected sequence of MVert tuples" );
|
||||
"expected sequence of MVert sequences" );
|
||||
}
|
||||
|
||||
/* not the right number of MVerts... error */
|
||||
nverts = PyTuple_Size( tmp );
|
||||
nverts = PySequence_Size( tmp );
|
||||
if( nverts < 2 || nverts > 4 ) {
|
||||
Py_DECREF( tmp );
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected 2 to 4 MVerts per tuple" );
|
||||
"expected 2 to 4 MVerts per sequence" );
|
||||
}
|
||||
Py_DECREF( tmp );
|
||||
|
||||
@@ -2486,14 +2541,15 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
/* scan the input list and build the new edge pair list */
|
||||
len = PySequence_Size( args );
|
||||
tmppair = newpair;
|
||||
new_edge_count = 0;
|
||||
for( i = 0; i < len; ++i ) {
|
||||
int edge_count;
|
||||
tmp = PySequence_GetItem( args, i );
|
||||
nverts = PyTuple_Size( tmp );
|
||||
nverts = PySequence_Size( tmp );
|
||||
|
||||
/* get copies of vertices */
|
||||
/* get new references for the vertices */
|
||||
for(j = 0; j < nverts; ++j )
|
||||
e[j] = (BPy_MVert *)PyTuple_GET_ITEM( tmp, j );
|
||||
e[j] = (BPy_MVert *)PySequence_GetItem( tmp, j );
|
||||
Py_DECREF( tmp );
|
||||
|
||||
if( nverts == 2 )
|
||||
@@ -2518,12 +2574,20 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
tmppair->swap = 1;
|
||||
} else {
|
||||
MEM_freeN( newpair );
|
||||
for(j = 0; j < nverts; ++j )
|
||||
Py_DECREF( e[j] );
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"tuple contains duplicate vertices" );
|
||||
}
|
||||
tmppair->index = new_edge_count;
|
||||
++new_edge_count;
|
||||
tmppair++;
|
||||
}
|
||||
|
||||
/* free the new references */
|
||||
for( j = 0; j < nverts; ++j )
|
||||
Py_DECREF( e[j] );
|
||||
}
|
||||
|
||||
/* sort the new edge pairs */
|
||||
@@ -2605,6 +2669,9 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
}
|
||||
mesh->medge = tmpedge; /* point to the new edge list */
|
||||
|
||||
/* resort edges into original order */
|
||||
qsort( newpair, new_edge_count, sizeof(SrchEdges), medge_index_comp );
|
||||
|
||||
/* point to the first edge we're going to add */
|
||||
tmpedge = &mesh->medge[mesh->totedge];
|
||||
tmppair = newpair;
|
||||
@@ -2632,7 +2699,7 @@ static PyObject *MEdgeSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
mesh_update( mesh );
|
||||
MEM_freeN( newpair );
|
||||
Py_DECREF ( args );
|
||||
return EXPP_incr_ret( Py_None );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *MEdgeSeq_delete( BPy_MEdgeSeq * self, PyObject *args )
|
||||
@@ -2644,19 +2711,23 @@ static PyObject *MEdgeSeq_delete( BPy_MEdgeSeq * self, PyObject *args )
|
||||
int i, len;
|
||||
int face_count, edge_count, vert_count;
|
||||
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
|
||||
/* accept a sequence (lists or tuples) also */
|
||||
/*
|
||||
* if input tuple contains a single sequence, use it as input instead;
|
||||
* otherwise use the sequence as-is and check later that it contains
|
||||
* one or more integers or MVerts
|
||||
*/
|
||||
if( PySequence_Size( args ) == 1 ) {
|
||||
PyObject *tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PySequence_Check ( tmp ) ) {
|
||||
Py_DECREF( args ); /* release previous reference */
|
||||
args = tmp; /* PyTuple_GET_ITEM returns new ref */
|
||||
}
|
||||
if( PySequence_Check( tmp ) )
|
||||
args = tmp;
|
||||
}
|
||||
|
||||
/* see how many args we need to parse */
|
||||
/* if sequence is empty, do nothing */
|
||||
len = PySequence_Size( args );
|
||||
if( len == 0 ) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
edge_table = (unsigned int *)MEM_callocN( len*sizeof( unsigned int ),
|
||||
"edge_table" );
|
||||
|
||||
@@ -2670,7 +2741,6 @@ static PyObject *MEdgeSeq_delete( BPy_MEdgeSeq * self, PyObject *args )
|
||||
else {
|
||||
MEM_freeN( edge_table );
|
||||
Py_DECREF( tmp );
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of ints or MEdges" );
|
||||
}
|
||||
@@ -2679,7 +2749,6 @@ static PyObject *MEdgeSeq_delete( BPy_MEdgeSeq * self, PyObject *args )
|
||||
/* if index out-of-range, throw exception */
|
||||
if( edge_table[i] >= (unsigned int)mesh->totedge ) {
|
||||
MEM_freeN( edge_table );
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"array index out of range" );
|
||||
}
|
||||
@@ -2773,9 +2842,8 @@ static PyObject *MEdgeSeq_delete( BPy_MEdgeSeq * self, PyObject *args )
|
||||
MEM_freeN( del_table );
|
||||
MEM_freeN( vert_table );
|
||||
MEM_freeN( edge_table );
|
||||
Py_DECREF( args );
|
||||
mesh_update ( mesh );
|
||||
return EXPP_incr_ret( Py_None );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
static PyObject *MEdgeSeq_selected( BPy_MEdgeSeq * self )
|
||||
@@ -3388,21 +3456,22 @@ static int MFace_setUV( BPy_MFace * self, PyObject * value )
|
||||
if( !MFace_get_pointer( self ) )
|
||||
return -1;
|
||||
|
||||
if( !PyTuple_Check( value ) ||
|
||||
if( !PySequence_Check( value ) ||
|
||||
EXPP_check_sequence_consistency( value, &vector_Type ) != 1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected tuple of vectors" );
|
||||
"expected sequence of vectors" );
|
||||
|
||||
length = self->mesh->mface[self->index].v4 ? 4 : 3;
|
||||
if( length != PyTuple_Size( value ) )
|
||||
if( length != PySequence_Size( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"size of vertex and UV lists differ" );
|
||||
"size of vertex and UV sequences differ" );
|
||||
|
||||
face = &self->mesh->tface[self->index];
|
||||
for( i=0; i<length; ++i ) {
|
||||
VectorObject *vector = (VectorObject *)PyTuple_GET_ITEM( value, i );
|
||||
VectorObject *vector = (VectorObject *)PySequence_ITEM( value, i );
|
||||
face->uv[i][0] = vector->vec[0];
|
||||
face->uv[i][1] = vector->vec[1];
|
||||
Py_DECREF( vector );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -3531,6 +3600,54 @@ static PyObject *MFace_getCol( BPy_MFace * self )
|
||||
return attr;
|
||||
}
|
||||
|
||||
/*
|
||||
* set a face's vertex colors
|
||||
*/
|
||||
|
||||
static int MFace_setCol( BPy_MFace * self, PyObject *value )
|
||||
{
|
||||
int length, i;
|
||||
MCol * mcol;
|
||||
|
||||
/* if there's no mesh color vectors or texture faces, nothing to do */
|
||||
|
||||
if( !self->mesh->mcol && !self->mesh->tface )
|
||||
return EXPP_ReturnIntError( PyExc_ValueError,
|
||||
"face has no vertex colors" );
|
||||
|
||||
if( !MFace_get_pointer( self ) )
|
||||
return -1;
|
||||
|
||||
if( self->mesh->tface )
|
||||
mcol = (MCol *) self->mesh->tface[self->index].col;
|
||||
else
|
||||
mcol = &self->mesh->mcol[self->index*4];
|
||||
|
||||
length = self->mesh->mface[self->index].v4 ? 4 : 3;
|
||||
|
||||
if( !PyList_Check( value ) && !PyTuple_Check( value ) )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected a sequence of MCols" );
|
||||
|
||||
if( EXPP_check_sequence_consistency( value, &MCol_Type ) != 1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected a sequence of MCols" );
|
||||
|
||||
if( PySequence_Size( value ) != length )
|
||||
return EXPP_ReturnIntError( PyExc_ValueError,
|
||||
"incorrect number of colors for this face" );
|
||||
|
||||
for( i=0; i<length; ++i ) {
|
||||
BPy_MCol *obj = (BPy_MCol *)PySequence_ITEM( value, i );
|
||||
mcol[i].r = obj->color->r;
|
||||
mcol[i].g = obj->color->g;
|
||||
mcol[i].b = obj->color->b;
|
||||
mcol[i].a = obj->color->a;
|
||||
Py_DECREF( obj );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Python MFace_Type attributes get/set structure
|
||||
@@ -3575,7 +3692,7 @@ static PyGetSetDef BPy_MFace_getseters[] = {
|
||||
/* attributes for texture faces (mostly, I think) */
|
||||
|
||||
{"col",
|
||||
(getter)MFace_getCol, (setter)NULL,
|
||||
(getter)MFace_getCol, (setter)MFace_setCol,
|
||||
"face's vertex colors",
|
||||
NULL},
|
||||
{"flag",
|
||||
@@ -3891,40 +4008,53 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
|
||||
Py_DECREF( tmp );
|
||||
|
||||
/* make sure we get a sequence of tuples of something */
|
||||
/* make sure we get a tuple of sequences of something */
|
||||
|
||||
switch( PySequence_Size( args ) ) {
|
||||
case 1: /* better be a list or a tuple */
|
||||
args = PyTuple_GET_ITEM( args, 0 );
|
||||
if( !PySequence_Check ( args ) )
|
||||
case 1: /* better be a sequence or a tuple */
|
||||
/* if a sequence... */
|
||||
tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PySequence_Check( tmp ) ) {
|
||||
/* if another sequence, use it */
|
||||
PyObject *tmp2 = PySequence_ITEM( tmp, 0 );
|
||||
if( PySequence_Check( tmp2 ) )
|
||||
args = tmp;
|
||||
Py_INCREF( args );
|
||||
Py_DECREF( tmp2 );
|
||||
} else
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of tuple pairs" );
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
"expected a sequence of sequence pairs" );
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4: /* two to four args may be individual verts */
|
||||
tmp = PyTuple_GET_ITEM( args, 0 );
|
||||
if( PyTuple_Check( tmp ) ) {/* maybe just tuples, so use args as-is */
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* if first item isn't a sequence, then assume it's a bunch of MVerts
|
||||
* and wrap inside a tuple
|
||||
*/
|
||||
if( !PySequence_Check( tmp ) ) {
|
||||
args = Py_BuildValue( "(O)", args );
|
||||
if( !args )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"Py_BuildValue() failed" );
|
||||
/*
|
||||
* otherwise, assume it already a bunch of sequences so use as-is
|
||||
*/
|
||||
} else {
|
||||
Py_INCREF( args ); /* so we can safely DECREF later */
|
||||
}
|
||||
break;
|
||||
default: /* anything else is definitely wrong */
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected a sequence of tuple pairs" );
|
||||
"expected a sequence of sequence pairs" );
|
||||
}
|
||||
|
||||
/* make sure there is something to add */
|
||||
/* if nothing to add, just exit */
|
||||
len = PySequence_Size( args );
|
||||
if( len == 0 ) {
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected at least one tuple" );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
/* verify the param list and get a total count of number of edges */
|
||||
@@ -3933,19 +4063,19 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
tmp = PySequence_GetItem( args, i );
|
||||
|
||||
/* not a tuple of MVerts... error */
|
||||
if( !PyTuple_Check( tmp ) ||
|
||||
if( !PySequence_Check( tmp ) ||
|
||||
EXPP_check_sequence_consistency( tmp, &MVert_Type ) != 1 ) {
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected sequence of MVert tuples" );
|
||||
"expected sequence of MVert sequences" );
|
||||
}
|
||||
|
||||
/* not the right number of MVerts... error */
|
||||
nverts = PyTuple_Size( tmp );
|
||||
nverts = PySequence_Size( tmp );
|
||||
if( nverts < 2 || nverts > 4 ) {
|
||||
Py_DECREF( args );
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"expected 2 to 4 MVerts per tuple" );
|
||||
"expected 2 to 4 MVerts per sequence" );
|
||||
}
|
||||
|
||||
if( nverts != 2 ) /* new faces cannot have only 2 verts */
|
||||
@@ -3965,7 +4095,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
unsigned int vert[4]={0,0,0,0};
|
||||
unsigned char order[4]={0,1,2,3};
|
||||
tmp = PySequence_GetItem( args, i );
|
||||
nverts = PyTuple_Size( tmp );
|
||||
nverts = PySequence_Size( tmp );
|
||||
|
||||
if( nverts == 2 ) /* again, ignore 2-vert tuples */
|
||||
break;
|
||||
@@ -3975,15 +4105,19 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
* vertices are not index 0
|
||||
*/
|
||||
|
||||
e = (BPy_MVert *)PyTuple_GET_ITEM( tmp, 0 );
|
||||
e = (BPy_MVert *)PySequence_ITEM( tmp, 0 );
|
||||
tmpface.v1 = e->index;
|
||||
e = (BPy_MVert *)PyTuple_GET_ITEM( tmp, 1 );
|
||||
Py_DECREF( e );
|
||||
e = (BPy_MVert *)PySequence_ITEM( tmp, 1 );
|
||||
tmpface.v2 = e->index;
|
||||
e = (BPy_MVert *)PyTuple_GET_ITEM( tmp, 2 );
|
||||
Py_DECREF( e );
|
||||
e = (BPy_MVert *)PySequence_ITEM( tmp, 2 );
|
||||
tmpface.v3 = e->index;
|
||||
Py_DECREF( e );
|
||||
if( nverts == 4 ) {
|
||||
e = (BPy_MVert *)PyTuple_GET_ITEM( tmp, 3 );
|
||||
e = (BPy_MVert *)PySequence_ITEM( tmp, 3 );
|
||||
tmpface.v4 = e->index;
|
||||
Py_DECREF( e );
|
||||
}
|
||||
Py_DECREF( tmp );
|
||||
|
||||
@@ -4016,6 +4150,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
}
|
||||
tmppair->v[j] = vert[j];
|
||||
}
|
||||
tmppair->index = i;
|
||||
|
||||
/* pack order into a byte */
|
||||
tmppair->order = order[0]|(order[1]<<2)|(order[2]<<4)|(order[3]<<6);
|
||||
@@ -4111,6 +4246,9 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
mesh->tface = tmptface;
|
||||
}
|
||||
|
||||
/* sort the faces back into their original input list order */
|
||||
qsort( newpair, new_face_count, sizeof(SrchFaces), mface_index_comp );
|
||||
|
||||
/* allocate new face list */
|
||||
tmpface = MEM_callocN(totface*sizeof(MFace), "Mesh_addFaces");
|
||||
|
||||
@@ -4157,7 +4295,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args )
|
||||
mesh_update( mesh );
|
||||
Py_DECREF ( args );
|
||||
MEM_freeN( newpair );
|
||||
return EXPP_incr_ret( Py_None );
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
struct fourEdges
|
||||
@@ -5373,7 +5511,53 @@ static PyObject *Mesh_getVertGroupNames( BPy_Mesh * self )
|
||||
return list;
|
||||
}
|
||||
|
||||
#ifdef MESH_TOOLS
|
||||
static PyObject *Mesh_getVertexInfluences( BPy_Mesh * self, PyObject * args )
|
||||
{
|
||||
int index;
|
||||
PyObject *influence_list = NULL;
|
||||
Object *object = self->object;
|
||||
Mesh *me = self->mesh;
|
||||
|
||||
/* Get a reference to the mesh object wrapped in here. */
|
||||
if( !object )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"This mesh must be linked to an object" );
|
||||
|
||||
/* Parse the parameters: only on integer (vertex index) */
|
||||
if( !PyArg_ParseTuple( args, "i", &index ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected int argument (index of the vertex)" );
|
||||
|
||||
/* check for valid index */
|
||||
if( index < 0 || index >= me->totvert )
|
||||
return EXPP_ReturnPyObjError( PyExc_IndexError,
|
||||
"vertex index out of range" );
|
||||
|
||||
influence_list = PyList_New( 0 );
|
||||
|
||||
/* Proceed only if we have vertex deformation information */
|
||||
if( me->dvert ) {
|
||||
int i;
|
||||
MDeformWeight *sweight = NULL;
|
||||
|
||||
/* Number of bones influencing the vertex */
|
||||
int totinfluences = me->dvert[index].totweight;
|
||||
|
||||
/* Get the reference of the first weight structure */
|
||||
sweight = me->dvert[index].dw;
|
||||
|
||||
/* Build the list only with weights and names of the influent bones */
|
||||
for( i = 0; i < totinfluences; i++, sweight++ ) {
|
||||
bDeformGroup *defgroup = BLI_findlink( &object->defbase,
|
||||
sweight->def_nr );
|
||||
if( defgroup )
|
||||
PyList_Append( influence_list, Py_BuildValue( "[sf]",
|
||||
defgroup->name, sweight->weight ) );
|
||||
}
|
||||
}
|
||||
|
||||
return influence_list;
|
||||
}
|
||||
|
||||
static PyObject *Mesh_Tools( BPy_Mesh * self, int type, void **args )
|
||||
{
|
||||
@@ -5575,8 +5759,6 @@ static PyObject *Mesh_fill( BPy_Mesh * self )
|
||||
return Mesh_Tools( self, MESH_TOOL_FILL, NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static struct PyMethodDef BPy_Mesh_methods[] = {
|
||||
{"calcNormals", (PyCFunction)Mesh_calcNormals, METH_NOARGS,
|
||||
"all recalculate vertex normals"},
|
||||
@@ -5604,10 +5786,10 @@ static struct PyMethodDef BPy_Mesh_methods[] = {
|
||||
"Rename an existing vertex group"},
|
||||
{"getVertGroupNames", (PyCFunction)Mesh_getVertGroupNames, METH_NOARGS,
|
||||
"Get names of vertex groups"},
|
||||
{"getVertexInfluences", (PyCFunction)Mesh_getVertexInfluences, METH_VARARGS,
|
||||
"Get list of the influences of bones for a given mesh vertex"},
|
||||
|
||||
|
||||
|
||||
#ifdef MESH_TOOLS
|
||||
/* Mesh tools */
|
||||
{"smooth", (PyCFunction)Mesh_smooth, METH_NOARGS,
|
||||
"Flattens angle of selected faces (experimental)"},
|
||||
{"flipNormals", (PyCFunction)Mesh_flipNormals, METH_NOARGS,
|
||||
@@ -5626,7 +5808,6 @@ static struct PyMethodDef BPy_Mesh_methods[] = {
|
||||
"Removes duplicates from selected vertices (experimental)"},
|
||||
{"recalcNormals", (PyCFunction)Mesh_recalcNormals, METH_VARARGS,
|
||||
"Recalculates inside or outside normals (experimental)"},
|
||||
#endif
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -5906,8 +6087,12 @@ static int Mesh_setFlag( BPy_Mesh * self, PyObject *value, void *type )
|
||||
MEM_freeN( mesh->tface );
|
||||
mesh->tface = NULL;
|
||||
}
|
||||
} else if( !mesh->tface )
|
||||
} else if( !mesh->tface ) {
|
||||
if( !mesh->totface )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
"mesh has no faces" );
|
||||
make_tfaces( mesh );
|
||||
}
|
||||
return 0;
|
||||
case MESH_HASMCOL:
|
||||
if( !param ) {
|
||||
@@ -6098,8 +6283,6 @@ static PyGetSetDef BPy_Mesh_getseters[] = {
|
||||
(getter)Mesh_getMode, (setter)Mesh_setMode,
|
||||
"The mesh's mode bitfield",
|
||||
NULL},
|
||||
|
||||
|
||||
{"faceUV",
|
||||
(getter)Mesh_getFlag, (setter)Mesh_setFlag,
|
||||
"UV-mapped textured faces enabled",
|
||||
@@ -6124,11 +6307,6 @@ static PyGetSetDef BPy_Mesh_getseters[] = {
|
||||
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python Mesh_Type callback function prototypes: */
|
||||
/*****************************************************************************/
|
||||
static void Mesh_dealloc( BPy_Mesh * object );
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Python Mesh_Type structure definition: */
|
||||
/*****************************************************************************/
|
||||
@@ -6329,6 +6507,28 @@ static PyObject *M_Mesh_MVert( PyObject * self, PyObject * args )
|
||||
return PVert_CreatePyObject( &vert );
|
||||
}
|
||||
|
||||
static PyObject *M_Mesh_Modes( PyObject * self, PyObject * args )
|
||||
{
|
||||
int modes = 0;
|
||||
|
||||
if( !G.scene ) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
if( !PyArg_ParseTuple( args, "|i", &modes ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected optional int as argument" );
|
||||
|
||||
if( modes > ( SCE_SELECT_VERTEX | SCE_SELECT_EDGE | SCE_SELECT_FACE ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
"value out of range" );
|
||||
|
||||
if( modes > 0 )
|
||||
G.scene->selectmode = modes;
|
||||
|
||||
return PyInt_FromLong( G.scene->selectmode );
|
||||
}
|
||||
|
||||
static struct PyMethodDef M_Mesh_methods[] = {
|
||||
{"New", (PyCFunction)M_Mesh_New, METH_VARARGS,
|
||||
"Create a new mesh"},
|
||||
@@ -6336,10 +6536,12 @@ static struct PyMethodDef M_Mesh_methods[] = {
|
||||
"Get a mesh by name"},
|
||||
{"MVert", (PyCFunction)M_Mesh_MVert, METH_VARARGS,
|
||||
"Create a new MVert"},
|
||||
{"Mode", (PyCFunction)M_Mesh_Modes, METH_VARARGS,
|
||||
"Get/set edit selection mode(s)"},
|
||||
{NULL, NULL, 0, NULL},
|
||||
};
|
||||
|
||||
static PyObject *M_Mesh_Modes( void )
|
||||
static PyObject *M_Mesh_ModesDict( void )
|
||||
{
|
||||
PyObject *Modes = PyConstant_New( );
|
||||
|
||||
@@ -6444,18 +6646,32 @@ static PyObject *M_Mesh_VertAssignDict( void )
|
||||
return Vert;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *M_Mesh_SelectModeDict( void )
|
||||
{
|
||||
PyObject *Mode = PyConstant_New( );
|
||||
if( Mode ) {
|
||||
BPy_constant *d = ( BPy_constant * ) Mode;
|
||||
PyConstant_Insert(d, "VERTEX", PyInt_FromLong(SCE_SELECT_VERTEX));
|
||||
PyConstant_Insert(d, "EDGE", PyInt_FromLong(SCE_SELECT_EDGE));
|
||||
PyConstant_Insert(d, "FACE", PyInt_FromLong(SCE_SELECT_FACE));
|
||||
}
|
||||
return Mode;
|
||||
}
|
||||
|
||||
static char M_Mesh_doc[] = "The Blender.Mesh submodule";
|
||||
|
||||
PyObject *Mesh_Init( void )
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
PyObject *Modes = M_Mesh_Modes( );
|
||||
PyObject *Modes = M_Mesh_ModesDict( );
|
||||
PyObject *FaceFlags = M_Mesh_FaceFlagsDict( );
|
||||
PyObject *FaceModes = M_Mesh_FaceModesDict( );
|
||||
PyObject *FaceTranspModes = M_Mesh_FaceTranspModesDict( );
|
||||
PyObject *EdgeFlags = M_Mesh_EdgeFlagsDict( );
|
||||
PyObject *AssignModes = M_Mesh_VertAssignDict( );
|
||||
PyObject *SelectModes = M_Mesh_SelectModeDict( );
|
||||
|
||||
if( PyType_Ready( &MCol_Type ) < 0 )
|
||||
return NULL;
|
||||
@@ -6491,6 +6707,8 @@ PyObject *Mesh_Init( void )
|
||||
PyModule_AddObject( submodule, "EdgeFlags", EdgeFlags );
|
||||
if( AssignModes )
|
||||
PyModule_AddObject( submodule, "AssignModes", AssignModes );
|
||||
if( SelectModes )
|
||||
PyModule_AddObject( submodule, "SelectModes", SelectModes );
|
||||
|
||||
|
||||
return submodule;
|
||||
|
||||
@@ -471,11 +471,15 @@ PyObject *Action_CreatePyObject( struct bAction * act )
|
||||
{
|
||||
BPy_Action *blen_action;
|
||||
|
||||
if(!act)
|
||||
return EXPP_incr_ret(Py_None);
|
||||
|
||||
blen_action =
|
||||
( BPy_Action * ) PyObject_NEW( BPy_Action, &Action_Type );
|
||||
|
||||
if( blen_action == NULL ) {
|
||||
return ( NULL );
|
||||
if( !blen_action) {
|
||||
return ( EXPP_ReturnPyObjError
|
||||
( PyExc_RuntimeError, "failure to create object!" ) );
|
||||
}
|
||||
blen_action->action = act;
|
||||
return ( ( PyObject * ) blen_action );
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
/** NLA module initialization function. */
|
||||
PyObject *NLA_Init( void );
|
||||
|
||||
extern PyTypeObject Action_Type;
|
||||
|
||||
/** Python BPy_NLA structure definition. */
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
|
||||
@@ -1466,71 +1466,55 @@ static PyObject *NMesh_update( PyObject *self, PyObject *a, PyObject *kwd )
|
||||
* influences that this vertex receives.
|
||||
* @author Jordi Rovira i Bonet
|
||||
*/
|
||||
|
||||
static PyObject *NMesh_getVertexInfluences( PyObject * self, PyObject * args )
|
||||
{
|
||||
int index;
|
||||
PyObject *influence_list = NULL;
|
||||
|
||||
/* Get a reference to the mesh object wrapped in here. */
|
||||
Object *object = ( ( BPy_NMesh * ) self )->object;
|
||||
Mesh *me = ( ( BPy_NMesh * ) self )->mesh;
|
||||
|
||||
/* Get a reference to the mesh object wrapped in here. */
|
||||
if( !me )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"unlinked nmesh: call its .update() method first" );
|
||||
|
||||
if( !object )
|
||||
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
|
||||
"This mesh must be linked to an object" );
|
||||
|
||||
/* Parse the parameters: only on integer (vertex index) */
|
||||
if( !PyArg_ParseTuple( args, "i", &index ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected int argument (index of the vertex)" );
|
||||
|
||||
/* Proceed only if we have vertex deformation information and index is valid */
|
||||
if( me->dvert ) {
|
||||
if( ( index >= 0 ) && ( index < me->totvert ) ) {
|
||||
/* check for valid index */
|
||||
if( index < 0 || index >= me->totvert )
|
||||
return EXPP_ReturnPyObjError( PyExc_IndexError,
|
||||
"vertex index out of range" );
|
||||
|
||||
influence_list = PyList_New( 0 );
|
||||
|
||||
/* Proceed only if we have vertex deformation information */
|
||||
if( me->dvert ) {
|
||||
int i;
|
||||
MDeformWeight *sweight = NULL;
|
||||
|
||||
/* Number of bones influencing the vertex */
|
||||
int totinfluences = me->dvert[index].totweight;
|
||||
|
||||
/* Build the list only with weights and names of the influent bones */
|
||||
/*influence_list = PyList_New(totinfluences); */
|
||||
influence_list = PyList_New( 0 );
|
||||
|
||||
/* Get the reference of the first weight structure */
|
||||
sweight = me->dvert[index].dw;
|
||||
|
||||
for( i = 0; i < totinfluences; i++ ) {
|
||||
/*Add the weight and the name of the bone, which is used to identify it */
|
||||
|
||||
/* Disabled this code, it couldn't be correct!
|
||||
* sweight->data was being set to a posechannel not a bone
|
||||
* for one thing, and it is not always set for another.
|
||||
* The only thing safe here is to return the defgroup number. -zr
|
||||
*/
|
||||
// if( sweight->data )
|
||||
/* valid bone: return its name */
|
||||
/* PyList_SetItem(influence_list, i,
|
||||
Py_BuildValue("[sf]", sweight->data->name, sweight->weight));
|
||||
else // NULL bone: return Py_None instead
|
||||
PyList_SetItem(influence_list, i,
|
||||
Py_BuildValue("[Of]", Py_None, sweight->weight)); */
|
||||
// PyList_Append( influence_list,
|
||||
// Py_BuildValue( "[sf]",
|
||||
// sweight->
|
||||
// data->
|
||||
// name,
|
||||
// sweight->
|
||||
// weight ) );
|
||||
|
||||
/* Next weight */
|
||||
sweight++;
|
||||
/* Build the list only with weights and names of the influent bones */
|
||||
for( i = 0; i < totinfluences; i++, sweight++ ) {
|
||||
bDeformGroup *defgroup = (bDeformGroup *) BLI_findlink( &object->defbase,
|
||||
sweight->def_nr );
|
||||
if( defgroup )
|
||||
PyList_Append( influence_list, Py_BuildValue( "[sf]",
|
||||
defgroup->name, sweight->weight ) );
|
||||
}
|
||||
}
|
||||
} else //influence_list = PyList_New(0);
|
||||
return EXPP_ReturnPyObjError( PyExc_IndexError,
|
||||
"vertex index out of range" );
|
||||
} else
|
||||
influence_list = PyList_New( 0 );
|
||||
|
||||
return influence_list;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,9 @@ struct rctf;
|
||||
#include "NLA.h"
|
||||
#include "logic.h"
|
||||
#include "Effect.h"
|
||||
#include "Pose.h"
|
||||
#include "gen_utils.h"
|
||||
#include "BIF_editkey.h"
|
||||
|
||||
/* Defines for insertIpoKey */
|
||||
|
||||
@@ -291,6 +293,7 @@ static PyObject *Object_getSBUseEdges( BPy_Object * self );
|
||||
static PyObject *Object_setSBUseEdges( BPy_Object * self, PyObject * args );
|
||||
static PyObject *Object_getSBStiffQuads( BPy_Object * self );
|
||||
static PyObject *Object_setSBStiffQuads( BPy_Object * self, PyObject * args );
|
||||
static PyObject *Object_insertShapeKey(BPy_Object * self);
|
||||
/*****************************************************************************/
|
||||
/* Python BPy_Object methods table: */
|
||||
/*****************************************************************************/
|
||||
@@ -322,7 +325,7 @@ If 'name_only' is nonzero or True, only the name of the datablock is returned"},
|
||||
{"getAction", ( PyCFunction ) Object_getAction, METH_NOARGS,
|
||||
"Returns the active action for this object"},
|
||||
{"getPose", ( PyCFunction ) Object_getPose, METH_NOARGS,
|
||||
"Returns the pose for this object"},
|
||||
"() - returns the pose from an object if it exists, else None"},
|
||||
{"isSelected", ( PyCFunction ) Object_isSelected, METH_NOARGS,
|
||||
"Return a 1 or 0 depending on whether the object is selected"},
|
||||
{"getEuler", ( PyCFunction ) Object_getEuler, METH_NOARGS,
|
||||
@@ -585,7 +588,8 @@ works only if self and the object specified are of the same type."},
|
||||
"([s1<,s2,s3...>]) - Delete specified scriptlinks from this object."},
|
||||
{"setDupliVerts", ( PyCFunction ) Object_setDupliVerts,
|
||||
METH_VARARGS, "() - set or reset duplicate child objects on all vertices"},
|
||||
|
||||
{"insertShapeKey", ( PyCFunction ) Object_insertShapeKey,
|
||||
METH_NOARGS, "() - Insert a Shape Key in the current object"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -750,9 +754,13 @@ PyObject *M_Object_Get( PyObject * self, PyObject * args )
|
||||
object = GetObjectByName( name );
|
||||
|
||||
/* No object exists with the name specified in the argument name. */
|
||||
if( !object )
|
||||
return EXPP_ReturnPyObjError( PyExc_AttributeError,
|
||||
"Unknown object specified." );
|
||||
if( !object ){
|
||||
char buffer[128];
|
||||
PyOS_snprintf( buffer, sizeof(buffer),
|
||||
"object \"%s\" not found", name);
|
||||
return EXPP_ReturnPyObjError( PyExc_ValueError,
|
||||
buffer );
|
||||
}
|
||||
|
||||
return Object_CreatePyObject( object );
|
||||
} else {
|
||||
@@ -883,7 +891,7 @@ static PyObject *M_Object_Duplicate( PyObject * self, PyObject * args, PyObject
|
||||
/*****************************************************************************/
|
||||
PyObject *Object_Init( void )
|
||||
{
|
||||
PyObject *module;
|
||||
PyObject *module, *dict;
|
||||
|
||||
Object_Type.ob_type = &PyType_Type;
|
||||
|
||||
@@ -908,6 +916,11 @@ PyObject *Object_Init( void )
|
||||
PyModule_AddIntConstant( module, "MAGNET",PFIELD_MAGNET );
|
||||
PyModule_AddIntConstant( module, "WIND",PFIELD_WIND );
|
||||
|
||||
//Add SUBMODULES to the module
|
||||
dict = PyModule_GetDict( module ); //borrowed
|
||||
PyDict_SetItemString(dict, "Pose", Pose_Init()); //creates a *new* module
|
||||
//PyDict_SetItemString(dict, "Constraint", Constraint_Init()); //creates a *new* module
|
||||
|
||||
return ( module );
|
||||
}
|
||||
|
||||
@@ -1178,6 +1191,7 @@ static PyObject *Object_getAction( BPy_Object * self )
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static PyObject *Object_getPose( BPy_Object * self )
|
||||
{
|
||||
/*BPy_Action *py_action = NULL; */
|
||||
@@ -1190,6 +1204,14 @@ static PyObject *Object_getPose( BPy_Object * self )
|
||||
return Pose_CreatePyObject( self->object->pose );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static PyObject * Object_getPose(BPy_Object *self)
|
||||
{
|
||||
//if there is no pose will return PyNone
|
||||
return PyPose_FromPose(self->object->pose, self->object->id.name+2);
|
||||
}
|
||||
|
||||
static PyObject *Object_isSelected( BPy_Object * self )
|
||||
{
|
||||
Base *base;
|
||||
@@ -3011,6 +3033,12 @@ static PyObject *Object_getEffects( BPy_Object * self )
|
||||
return effect_list;
|
||||
}
|
||||
|
||||
static PyObject *Object_insertShapeKey(BPy_Object * self)
|
||||
{
|
||||
insert_shapekey(self->object);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Function: Object_CreatePyObject */
|
||||
/* Description: This function will create a new BlenObject from an existing */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,68 @@
|
||||
/*
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Joseph Gilbert
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef EXPP_POSE_H
|
||||
#define EXPP_POSE_H
|
||||
|
||||
#include <Python.h>
|
||||
#include "DNA_action_types.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <DNA_action_types.h>
|
||||
|
||||
/* EXPP PyType Objects */
|
||||
//-------------------TYPE CHECKS---------------------------------
|
||||
#define PoseObject_Check(v) ((v)->ob_type == &Pose_Type)
|
||||
#define PoseBoneObject_Check(v) ((v)->ob_type == &PoseBone_Type)
|
||||
#define PoseBonesDictObject_Check(v) ((v)->ob_type == &PoseBonesDict_Type)
|
||||
//-------------------TYPEOBJECT----------------------------------
|
||||
extern PyTypeObject Pose_Type;
|
||||
|
||||
struct BPy_Pose;
|
||||
extern PyTypeObject PoseBone_Type;
|
||||
extern PyTypeObject PoseBonesDict_Type;
|
||||
//-------------------STRUCT DEFINITION----------------------------
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *bonesMap;
|
||||
ListBase *bones;
|
||||
} BPy_PoseBonesDict;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD /* required python macro */
|
||||
PyObject_HEAD
|
||||
bPose *pose;
|
||||
} BPy_Pose; /* a pose */
|
||||
char name[24]; //because poses have not names :(
|
||||
BPy_PoseBonesDict *Bones;
|
||||
} BPy_Pose;
|
||||
|
||||
PyObject *Pose_CreatePyObject( bPose * p );
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
bPoseChannel *posechannel;
|
||||
} BPy_PoseBone;
|
||||
|
||||
#endif /* EXPP_KEY_H */
|
||||
//-------------------VISIBLE PROTOTYPES-------------------------
|
||||
PyObject *Pose_Init(void);
|
||||
PyObject *PyPose_FromPose(bPose *pose, char *name);
|
||||
PyObject *PyPoseBone_FromPosechannel(bPoseChannel *pchan);
|
||||
#endif
|
||||
|
||||
@@ -889,20 +889,23 @@ static PyObject *M_Window_EditMode( PyObject * self, PyObject * args )
|
||||
short status = -1;
|
||||
char *undo_str = "From script";
|
||||
int undo_str_len = 11;
|
||||
int do_undo = 1;
|
||||
|
||||
if( !PyArg_ParseTuple
|
||||
( args, "|hs#", &status, &undo_str, &undo_str_len ) )
|
||||
if( !PyArg_ParseTuple( args,
|
||||
"|hs#i", &status, &undo_str, &undo_str_len, &do_undo ) )
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected nothing or an int (bool) and a string as arguments" );
|
||||
"expected optional int (bool), string and int (bool) as arguments" );
|
||||
|
||||
if( status >= 0 ) {
|
||||
if( status ) {
|
||||
if( !G.obedit )
|
||||
enter_editmode( );
|
||||
} else if( G.obedit ) {
|
||||
if( do_undo && U.undosteps != 0 ) {
|
||||
if( undo_str_len > 63 )
|
||||
undo_str[63] = '\0'; /* 64 is max */
|
||||
undo_push_mesh( undo_str ); /* use better solution after 2.34 */
|
||||
}
|
||||
exit_editmode( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ static PyMethodDef BPy_constant_methods[] = {
|
||||
"() - Returns the keys the dictionary"},
|
||||
{"values", (PyCFunction) constant_values, METH_NOARGS,
|
||||
"() - Returns the values from the dictionary"},
|
||||
{NULL}
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
//------------------------mp_length
|
||||
static int constantLength(BPy_constant *self)
|
||||
|
||||
@@ -33,6 +33,7 @@ The Blender Python API Reference
|
||||
- L{NMesh} (*)
|
||||
- L{Noise}
|
||||
- L{Object} (*)
|
||||
- L{Pose}
|
||||
- L{Registry}
|
||||
- L{Scene}
|
||||
- L{Radio}
|
||||
|
||||
@@ -212,7 +212,7 @@ class Bone:
|
||||
@type matrix: Matrix Object
|
||||
@ivar parent: The parent Bone.
|
||||
@type parent: Bone Object
|
||||
@ivar children: The children bones.
|
||||
@ivar children: The children directly attached to this bone.
|
||||
@type children: List of Bone Objects
|
||||
@ivar weight: The bone's weight.
|
||||
@type weight: Float
|
||||
@@ -246,6 +246,13 @@ class Bone:
|
||||
@rtype: Bool
|
||||
"""
|
||||
|
||||
def getAllChildren():
|
||||
"""
|
||||
Gets all the children under this bone including the children's children.
|
||||
@rtype: List of Bone object
|
||||
@return: all bones under this one
|
||||
"""
|
||||
|
||||
class Editbone:
|
||||
"""
|
||||
The Editbone Object
|
||||
@@ -260,7 +267,7 @@ class Editbone:
|
||||
@type head: Vector Object
|
||||
@ivar tail: This Bone's "tail" ending position when in rest state (armaturespace).
|
||||
@type tail: Vector Object
|
||||
@ivar matrix: This Bone's matrix. (armaturespace) This cannot be set.
|
||||
@ivar matrix: This Bone's matrix. (armaturespace)
|
||||
@type matrix: Matrix Object
|
||||
@ivar parent: The parent Bone.
|
||||
@type parent: Editbone Object
|
||||
|
||||
@@ -297,6 +297,16 @@ class IpoCurve:
|
||||
Can be Constant, Extrapolation, Cyclic or Cyclic_extrapolation.
|
||||
@rtype: None
|
||||
@return: None
|
||||
@note: Cyclic Ipo curves never reach the end value. If the first and
|
||||
last bezier points do not have the same y coordinate, the value of the
|
||||
curve when it "cycles" is that of the first point. If a user wants to
|
||||
get the value of the final curve point, read the final point from the
|
||||
curve's L{bezierPoints} attribute::
|
||||
|
||||
ipo = Blender.Object.Get('Cube').ipo
|
||||
icu = ipo.getCurves('LocX')
|
||||
endtime,endvalue = icu.bezierPoints[-1].pt
|
||||
|
||||
"""
|
||||
|
||||
def getExtrapolation():
|
||||
|
||||
@@ -6,7 +6,7 @@ The Blender.Key submodule.
|
||||
This module provides access to B{Key} objects in Blender.
|
||||
|
||||
@type Types: readonly dictionary
|
||||
@var Types: The type of a key, indicating the type of data in the
|
||||
@var Types: The type of a key owner, indicating the type of data in the
|
||||
data blocks.
|
||||
- MESH - the key is a Mesh key; data blocks contain
|
||||
L{NMVert<NMesh.NMVert>} vertices.
|
||||
@@ -15,7 +15,6 @@ data blocks.
|
||||
3 floating point numbers).
|
||||
- LATTICE - the key is a Lattice key; data blocks contain
|
||||
BPoints, each point represented by a list of 3 floating point numbers.
|
||||
|
||||
"""
|
||||
|
||||
def Get(name = None):
|
||||
@@ -38,7 +37,7 @@ class Key:
|
||||
keyframe data.
|
||||
|
||||
@ivar ipo: Key Ipo. Contains the Ipo if one is assigned to the
|
||||
object, B{None} otherwise. Setting to B{None} clears the current Ipo..
|
||||
object, B{None} otherwise. Setting to B{None} clears the current Ipo.
|
||||
@type ipo: Blender Ipo
|
||||
@ivar value: The value of the key. Read-only.
|
||||
@type value: float
|
||||
@@ -47,6 +46,8 @@ class Key:
|
||||
@type type: int
|
||||
@ivar blocks: A list of KeyBlocks for the key. Read-only.
|
||||
@type blocks: Blender KeyBlock.
|
||||
@ivar relative: Indicates whether the key is relative(=True) or normal.
|
||||
@type relative: bool
|
||||
"""
|
||||
|
||||
def getIpo():
|
||||
@@ -66,6 +67,8 @@ class KeyBlock:
|
||||
Each Key object has a list of KeyBlocks attached, each KeyBlock
|
||||
representing a keyframe.
|
||||
|
||||
@ivar curval: Current value of the corresponding IpoCurve. Read-only.
|
||||
@type curval: float
|
||||
@ivar name: The name of the Keyblock. Truncated to 32 characters.
|
||||
@type name: string
|
||||
@ivar pos: The position of the keyframe.
|
||||
|
||||
@@ -493,6 +493,7 @@ class Vector:
|
||||
def resize4D():
|
||||
"""
|
||||
Resize the vector to 4d. New axis will be 0.0.
|
||||
The last component will be 1.0, to make multiplying 3d vectors by 4x4 matrices easier.
|
||||
@return: a copy of itself
|
||||
"""
|
||||
|
||||
|
||||
@@ -112,6 +112,11 @@ Example::
|
||||
already associated with a group, else it does nothing.\n
|
||||
- REPLACE: attempts to replace a weight with the new weight value
|
||||
for an already associated vertex/group, else it does nothing.
|
||||
@type SelectModes: readonly dictionary.
|
||||
@var SelectModes: The available edit select modes.
|
||||
- VERTEX: vertex select mode.
|
||||
- EDGE: edge select mode.
|
||||
- FACE: face select mode.
|
||||
"""
|
||||
|
||||
AssignModes = {'REPLACE':1}
|
||||
@@ -135,6 +140,19 @@ def New(name='Mesh'):
|
||||
@return: a new Blender mesh.
|
||||
"""
|
||||
|
||||
def Mode(mode=0):
|
||||
"""
|
||||
Get and/or set the selection modes for mesh editing. These are the modes
|
||||
visible in the 3D window when a mesh is in Edit Mode.
|
||||
@type mode: int
|
||||
@param mode: The name of the mesh data object. See L{SelectModes} for values.
|
||||
Modes can be combined. If omitted, the selection mode is not changed.
|
||||
@rtype: int
|
||||
@return: the current selection mode.
|
||||
@note: The selection mode is an attribute of the current scene. If the
|
||||
scene is changed, the selection mode may not be the same.
|
||||
"""
|
||||
|
||||
class MCol:
|
||||
"""
|
||||
The MCol object
|
||||
@@ -273,9 +291,9 @@ class MVertSeq:
|
||||
l=[(.1,.1,.1),Vector([2,2,.5])]
|
||||
me.verts.extend(l) # add multiple vertices
|
||||
|
||||
@type coords: tuple(s) of floats or vectors
|
||||
@type coords: sequences(s) of floats or vectors
|
||||
@param coords: coords can be
|
||||
- a tuple of three floats,
|
||||
- a sequence of three floats,
|
||||
- a 3D vector, or
|
||||
- a sequence (list or tuple) of either of the above.
|
||||
"""
|
||||
@@ -348,12 +366,12 @@ class MEdgeSeq:
|
||||
v = me.verts # get vertices
|
||||
if len(v) >= 6: # if there are enough vertices...
|
||||
me.edges.extend(v[0],v[1]) # add a single edge
|
||||
l=[(v[1],v[2],v[3]),(v[0],v[2],v[4],v[5])]
|
||||
l=[(v[1],v[2],v[3]),[v[0],v[2],v[4],v[5]]]
|
||||
me.edges.extend(l) # add multiple edges
|
||||
|
||||
@type vertseq: tuple(s) of MVerts
|
||||
@type vertseq: sequence(s) of MVerts
|
||||
@param vertseq: either two to four MVerts, or sequence (list or tuple)
|
||||
of tuples each containing two to four MVerts.
|
||||
of sequences each containing two to four MVerts.
|
||||
"""
|
||||
|
||||
def delete(edges):
|
||||
@@ -442,7 +460,7 @@ class MFace:
|
||||
colors; use L{Mesh.faceUV} and L{Mesh.vertexColors} to test. B{Note}:
|
||||
if a mesh has i{both} UV faces and vertex colors, the colors stored in
|
||||
the UV faces will be used here.
|
||||
@type col: list of MCols
|
||||
@type col: sequence of MCols
|
||||
@ivar mat: The face's index into the mesh's materials
|
||||
list. It is in the range [0,15].
|
||||
@type mat: int
|
||||
@@ -520,7 +538,7 @@ class MFaceSeq:
|
||||
def extend(vertseq):
|
||||
"""
|
||||
Add one or more faces to the mesh. Faces which already exist in the
|
||||
mesh are ignored. Tuples of two vertices are accepted, but no face
|
||||
mesh are ignored. Sequences of two vertices are accepted, but no face
|
||||
will be created.
|
||||
|
||||
Example::
|
||||
@@ -531,12 +549,12 @@ class MFaceSeq:
|
||||
v = me.verts # get vertices
|
||||
if len(v) >= 6: # if there are enough vertices...
|
||||
me.faces.extend(v[1],v[2],v[3]) # add a single edge
|
||||
l=[(v[0],v[1]),(v[0],v[2],v[4],v[5])]
|
||||
l=[(v[0],v[1]),[v[0],v[2],v[4],v[5]]]
|
||||
me.faces.extend(l) # add another face
|
||||
|
||||
@type vertseq: tuple(s) of MVerts
|
||||
@type vertseq: sequence(s) of MVerts
|
||||
@param vertseq: either two to four MVerts, or sequence (list or tuple)
|
||||
of tuples each containing two to four MVerts.
|
||||
of sequences each containing two to four MVerts.
|
||||
"""
|
||||
|
||||
def delete(deledges, faces):
|
||||
@@ -608,6 +626,9 @@ class Mesh:
|
||||
be set. Furthermore, if vertexColors is already set when faceUV is set,
|
||||
vertexColors is cleared. This is because the vertex color information
|
||||
is stored with UV faces, so enabling faceUV implies enabling vertexColors.
|
||||
In addition, faceUV cannot be set when the mesh has no faces defined
|
||||
(this is the same behavior as the UI). Attempting to do so will throw
|
||||
a RuntimeError exception.
|
||||
@type faceUV: bool
|
||||
@ivar vertexColors: The mesh contains vertex colors. See L{faceUV} for the
|
||||
use of vertex colors when UV-mapped texture faces are enabled.
|
||||
@@ -706,11 +727,11 @@ class Mesh:
|
||||
|
||||
def findEdges(edges):
|
||||
"""
|
||||
Quickly search for the location of an edge.
|
||||
@type edges: tuple(s) of ints or MVerts
|
||||
Quickly search for the location of an edges.
|
||||
@type edges: sequence(s) of ints or MVerts
|
||||
@param edges: can be tuples of MVerts or integer indexes (B{note:} will
|
||||
not work with PVerts) or a sequence (list or tuple) containing two or
|
||||
more tuples.
|
||||
more sequences.
|
||||
@rtype: int, None or list
|
||||
@return: if an edge is found, its index is returned; otherwise None is
|
||||
returned. If a sequence of edges is passed, a list is returned.
|
||||
@@ -825,6 +846,16 @@ class Mesh:
|
||||
associated with the mesh's object
|
||||
"""
|
||||
|
||||
def getVertexInfluences(index):
|
||||
"""
|
||||
Get the bone influences for a specific vertex.
|
||||
@type index: int
|
||||
@param index: The index of a vertex.
|
||||
@rtype: list of lists
|
||||
@return: List of pairs [name, weight], where name is the bone name (string)
|
||||
and weight is a float value.
|
||||
"""
|
||||
|
||||
def smooth():
|
||||
"""
|
||||
Flattens angle of selected faces. Experimental mesh tool.
|
||||
|
||||
@@ -269,6 +269,19 @@ class Object:
|
||||
the type Effect.
|
||||
"""
|
||||
|
||||
def insertShapeKey():
|
||||
"""
|
||||
Insert a Shape Key in the current object. It applies to Objects of
|
||||
the type Mesh, Lattice, or Curve.
|
||||
"""
|
||||
|
||||
def getPose():
|
||||
"""
|
||||
Gets the current Pose of the object.
|
||||
@rtype: Pose object
|
||||
@return: the current pose object
|
||||
"""
|
||||
|
||||
def clearIpo():
|
||||
"""
|
||||
Unlinks the ipo from this object.
|
||||
|
||||
@@ -184,6 +184,10 @@ class ThemeSpace:
|
||||
@ivar face_select: theme rgba var.
|
||||
@ivar face_dot: theme rgba var.
|
||||
@ivar normal: theme rgba var.
|
||||
@ivar bone_solid: theme rgba var.
|
||||
@ivar bon_pose: theme rgba var.
|
||||
@ivar strip: theme rgba var.
|
||||
@ivar strip_select: theme rgba var.
|
||||
@ivar syntaxl: theme rgba var.
|
||||
@ivar syntaxn: theme rgba var.
|
||||
@ivar syntaxb: theme rgba var.
|
||||
|
||||
@@ -232,7 +232,7 @@ def GetPerspMatrix ():
|
||||
@return: the current matrix.
|
||||
"""
|
||||
|
||||
def EditMode(enable = -1, undo_msg = 'From script'):
|
||||
def EditMode(enable = -1, undo_msg = 'From script', undo = 1):
|
||||
"""
|
||||
Get and optionally set the current edit mode status: in or out.
|
||||
|
||||
@@ -258,6 +258,9 @@ def EditMode(enable = -1, undo_msg = 'From script'):
|
||||
string is used as the undo message in the Mesh->Undo History submenu in
|
||||
the 3d view header. Max length is 63, strings longer than that get
|
||||
clamped.
|
||||
@param undo: don't save Undo information (only needed when exiting edit
|
||||
mode).
|
||||
@type undo: int
|
||||
@rtype: int (bool)
|
||||
@return: 0 if Blender is not in edit mode right now, 1 otherwise.
|
||||
@warn: this is an important function. NMesh operates on normal Blender
|
||||
|
||||
@@ -458,7 +458,7 @@ static int Matrix_ass_item(MatrixObject * self, int i, PyObject * ob)
|
||||
float vec[4];
|
||||
PyObject *m, *f;
|
||||
|
||||
if(i > self->rowSize || i < 0){
|
||||
if(i >= self->rowSize || i < 0){
|
||||
return EXPP_ReturnIntError(PyExc_TypeError,
|
||||
"matrix[attribute] = x: bad row\n");
|
||||
}
|
||||
|
||||
@@ -160,9 +160,9 @@ PyObject *Vector_Resize4D(VectorObject * self)
|
||||
self->vec = self->data.py_data; //force
|
||||
if(self->size == 2){
|
||||
self->data.py_data[2] = 0.0f;
|
||||
self->data.py_data[3] = 0.0f;
|
||||
self->data.py_data[3] = 1.0f;
|
||||
}else if(self->size == 3){
|
||||
self->data.py_data[3] = 0.0f;
|
||||
self->data.py_data[3] = 1.0f;
|
||||
}
|
||||
self->size = 4;
|
||||
return EXPP_incr_ret((PyObject*)self);
|
||||
|
||||
@@ -170,6 +170,10 @@ static PyObject *ThemeSpace_getAttr( BPy_ThemeSpace * self, char *name )
|
||||
ELSEIF_TSP_RGBA( face_select )
|
||||
ELSEIF_TSP_RGBA( face_dot )
|
||||
ELSEIF_TSP_RGBA( normal )
|
||||
ELSEIF_TSP_RGBA( bone_solid )
|
||||
ELSEIF_TSP_RGBA( bone_pose )
|
||||
ELSEIF_TSP_RGBA( strip )
|
||||
ELSEIF_TSP_RGBA( strip_select )
|
||||
ELSEIF_TSP_RGBA( syntaxl )
|
||||
ELSEIF_TSP_RGBA( syntaxn )
|
||||
ELSEIF_TSP_RGBA( syntaxb )
|
||||
@@ -180,14 +184,15 @@ static PyObject *ThemeSpace_getAttr( BPy_ThemeSpace * self, char *name )
|
||||
else if( !strcmp( name, "facedot_size" ) )
|
||||
attrib = Py_BuildValue( "i", tsp->facedot_size );
|
||||
else if( !strcmp( name, "__members__" ) )
|
||||
attrib = Py_BuildValue( "[sssssssssssssssssssssssssssssss]", "theme",
|
||||
attrib = Py_BuildValue("[sssssssssssssssssssssssssssssssssss]", "theme",
|
||||
"back", "text", "text_hi", "header",
|
||||
"panel", "shade1", "shade2", "hilite",
|
||||
"grid", "wire", "lamp", "select", "active",
|
||||
"transform", "vertex", "vertex_select",
|
||||
"edge", "edge_select", "edge_seam",
|
||||
"edge_facesel", "face", "face_select",
|
||||
"face_dot", "normal",
|
||||
"face_dot", "normal", "bone_solid", "bone_pose",
|
||||
"strip", "strip_select",
|
||||
"syntaxl", "syntaxn", "syntaxb", "syntaxv", "syntaxc",
|
||||
"vertex_size", "facedot_size" );
|
||||
|
||||
@@ -230,6 +235,10 @@ static int ThemeSpace_setAttr( BPy_ThemeSpace * self, char *name,
|
||||
ELSEIF_TSP_RGBA( face_select )
|
||||
ELSEIF_TSP_RGBA( face_dot )
|
||||
ELSEIF_TSP_RGBA( normal )
|
||||
ELSEIF_TSP_RGBA( bone_solid )
|
||||
ELSEIF_TSP_RGBA( bone_pose )
|
||||
ELSEIF_TSP_RGBA( strip )
|
||||
ELSEIF_TSP_RGBA( strip_select )
|
||||
ELSEIF_TSP_RGBA( syntaxl )
|
||||
ELSEIF_TSP_RGBA( syntaxn )
|
||||
ELSEIF_TSP_RGBA( syntaxb )
|
||||
|
||||
@@ -1300,7 +1300,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
|
||||
uiDefButBitS(block, TOG, MOD_MIR_CLIPPING, B_MODIFIER_RECALC, "Do Clipping", lx+60, cy, buttonWidth-60,19, &mmd->flag, 1, 2, 0, 0, "Prevents during Transform vertices to go through Mirror");
|
||||
} else if (md->type==eModifierType_Decimate) {
|
||||
DecimateModifierData *dmd = (DecimateModifierData*) md;
|
||||
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Percent:", lx,(cy-=19),buttonWidth,19, &dmd->percent, 0.0, 1.0, 10, 0, "Defines the percentage of triangles to reduce to");
|
||||
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Ratio:", lx,(cy-=19),buttonWidth,19, &dmd->percent, 0.0, 1.0, 10, 0, "Defines the percentage of triangles to reduce to");
|
||||
sprintf(str, "Face Count: %d", dmd->faceCount);
|
||||
uiDefBut(block, LABEL, 1, str, lx, (cy-=19), 160,19, NULL, 0.0, 0.0, 0, 0, "Displays the current number of faces in the decimated mesh");
|
||||
} else if (md->type==eModifierType_Wave) {
|
||||
|
||||
@@ -2438,7 +2438,7 @@ void buttons_ketsji(uiBlock *block, Object *ob)
|
||||
&ob->gameflag, 0, 0,0, 0,
|
||||
"Specify a bounds object for physics");
|
||||
if (ob->gameflag & OB_BOUNDS) {
|
||||
uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Concave Mesh %x4|Convex Polytope%x5",
|
||||
uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|",
|
||||
85, 125, 140, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,16 +825,34 @@ void drawseqspace(ScrArea *sa, void *spacedata)
|
||||
|
||||
if(ed) {
|
||||
seq= ed->seqbasep->first;
|
||||
while(seq) {
|
||||
if(seq->flag & SELECT); else drawseq(seq);
|
||||
while(seq) { /* bound box test, dont draw outside the view */
|
||||
if (seq->flag & SELECT ||
|
||||
seq->start > G.v2d->cur.xmax ||
|
||||
seq->start+seq->len < G.v2d->cur.xmin ||
|
||||
seq->machine+1.0 < G.v2d->cur.ymin ||
|
||||
seq->machine > G.v2d->cur.ymax)
|
||||
{
|
||||
/* dont draw */
|
||||
} else {
|
||||
drawseq(seq);
|
||||
}
|
||||
seq= seq->next;
|
||||
}
|
||||
}
|
||||
ed= G.scene->ed;
|
||||
if(ed) {
|
||||
seq= ed->seqbasep->first;
|
||||
while(seq) {
|
||||
if(seq->flag & SELECT) drawseq(seq);
|
||||
while(seq) { /* bound box test, dont draw outside the view */
|
||||
if (!(seq->flag & SELECT) ||
|
||||
seq->start > G.v2d->cur.xmax ||
|
||||
seq->start+seq->len < G.v2d->cur.xmin ||
|
||||
seq->machine+1.0 < G.v2d->cur.ymin ||
|
||||
seq->machine > G.v2d->cur.ymax)
|
||||
{
|
||||
/* dont draw */
|
||||
} else {
|
||||
drawseq(seq);
|
||||
}
|
||||
seq= seq->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ void drawsoundspace(ScrArea *sa, void *spacedata);
|
||||
static void draw_wave(int startsamp, int endsamp, short sampdx, short offset, short *sp, float sampfac, float y)
|
||||
{
|
||||
float min, max, v1[2], v2[3];
|
||||
int i, j;
|
||||
short value, deltasp;
|
||||
int i, j, deltasp, value; /*deltasp, value: were both shorts but for music files 5min, zooming out cased a crash */
|
||||
|
||||
sp+= offset*startsamp;
|
||||
|
||||
|
||||
@@ -335,6 +335,7 @@ void transform_oops(int mode, int context)
|
||||
if(val) {
|
||||
switch(event) {
|
||||
case ESCKEY:
|
||||
case RIGHTMOUSE:
|
||||
case LEFTMOUSE:
|
||||
case SPACEKEY:
|
||||
case RETKEY:
|
||||
@@ -358,7 +359,7 @@ void transform_oops(int mode, int context)
|
||||
}
|
||||
}
|
||||
|
||||
if(event==ESCKEY) {
|
||||
if(event==ESCKEY || event==RIGHTMOUSE) {
|
||||
tv= transmain;
|
||||
for(a=0; a<tot; a++, tv++) {
|
||||
tv->loc[0]= tv->oldloc[0];
|
||||
|
||||
@@ -1111,14 +1111,21 @@ void drawfilespace(ScrArea *sa, void *spacedata)
|
||||
}
|
||||
else loadbutton= 0;
|
||||
|
||||
uiDefBut(block, TEX,1,"", textrct.xmin, filebuty1, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
|
||||
uiDefBut(block, TEX,2,"", textrct.xmin, filebuty2, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX,2,"", textrct.xmin, filebuty2, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "Directory, enter a directory and press enter to create it"); /* Directory input */
|
||||
if(loadbutton) {
|
||||
uiSetCurFont(block, UI_HELV);
|
||||
uiDefBut(block, BUT, 5, sfile->title, textrct.xmax-loadbutton, filebuty2, loadbutton, 21, sfile->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX,1,"", textrct.xmin, filebuty1, textrct.xmax-textrct.xmin-loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "File, increment version number with (+/-)"); /* File input */
|
||||
if(loadbutton) {
|
||||
uiSetCurFont(block, UI_HELV);
|
||||
uiDefBut(block, BUT, 6, "Cancel", textrct.xmax-loadbutton, filebuty1, loadbutton, 21, sfile->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
menu= fsmenu_build_menu();
|
||||
if(menu[0]) // happens when no .Bfs is there, and first time browse
|
||||
|
||||
@@ -128,8 +128,10 @@ void file_buttons(void)
|
||||
BIF_DrawString(uiBlockGetCurFont(block), sfile->title, (U.transopts & USER_TR_BUTTONS));
|
||||
xco+= BIF_GetStringWidth(G.font, sfile->title, (U.transopts & USER_TR_BUTTONS));
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitS(block, ICONTOG, FILE_SHOWSHORT, B_SORTFILELIST, ICON_LONGDISPLAY,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Toggles long info");
|
||||
uiDefIconButBitS(block, TOG, FILE_HIDE_DOT, B_RELOADDIR, ICON_GHOST,xco+=XIC,0,XIC,YIC, &sfile->flag, 0, 0, 0, 0, "Hides dot files");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiDefButBitS(block, TOG, FILE_STRINGCODE, 0, "Relative Paths", xco+=XIC+20,0,100,YIC, &sfile->flag, 0, 0, 0, 0, "Makes sure returned paths are relative to the current .blend file");
|
||||
|
||||
|
||||
@@ -125,12 +125,15 @@ void imasel_buttons(void)
|
||||
xco+=BMF_GetStringWidth(G.fonts, simasel->title);
|
||||
xco+=25;
|
||||
}
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconBut(block, BUT, B_IMASELREMOVEBIP, ICON_BPIBFOLDER_X, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "");/* remove */
|
||||
|
||||
uiDefIconButS(block, TOG|BIT|0, B_REDR, ICON_BPIBFOLDERGREY, xco+=XIC,0,XIC,YIC, &simasel->mode, 0, 0, 0, 0, "Toggles display of directory information");/* dir */
|
||||
uiDefIconButS(block, TOG|BIT|1, B_REDR, ICON_INFO, xco+=XIC,0,XIC,YIC, &simasel->mode, 0, 0, 0, 0, "Toggles display of selected image information");/* info */
|
||||
uiDefIconButS(block, TOG|BIT|2, B_REDR, ICON_IMAGE_COL, xco+=XIC,0,XIC,YIC, &simasel->mode, 0, 0, 0, 0, "");/* image */
|
||||
uiDefIconButS(block, TOG|BIT|3, B_REDR, ICON_MAGNIFY, xco+=XIC,0,XIC,YIC, &simasel->mode, 0, 0, 0, 0, "Toggles magnified view of thumbnail of images under mouse pointer");/* magnify */
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* always do as last */
|
||||
curarea->headbutlen= xco+2*XIC;
|
||||
|
||||
@@ -1183,6 +1183,7 @@ void ipo_buttons(void)
|
||||
|
||||
/* COPY PASTE */
|
||||
xco-= XIC/2;
|
||||
uiBlockBeginAlign(block);
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
|
||||
uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, "Can't edit library data");
|
||||
@@ -1193,12 +1194,16 @@ void ipo_buttons(void)
|
||||
uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, "Can't edit library data");
|
||||
uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
xco+=XIC/2;
|
||||
|
||||
uiClearButLock();
|
||||
|
||||
/* ZOOMBORDER */
|
||||
uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to area");
|
||||
|
||||
xco+=XIC/2;
|
||||
|
||||
/* draw LOCK */
|
||||
uiDefIconButS(block, ICONTOG, 1, ICON_UNLOCKED, xco+=XIC,0,XIC,YIC, &(G.sipo->lock), 0, 0, 0, 0, "Toggles forced redraw of other windows to reflect changes in real time");
|
||||
|
||||
|
||||
@@ -72,42 +72,64 @@ void do_oops_buttons(short event)
|
||||
{
|
||||
float dx, dy;
|
||||
|
||||
/* used for maximize hack */
|
||||
int win_width, win_height;
|
||||
float aspect_win, aspect_oops, oops_width, oops_height, oops_x_mid, oops_y_mid;
|
||||
|
||||
|
||||
if(curarea->win==0) return;
|
||||
|
||||
switch(event) {
|
||||
case B_OOPSHOME:
|
||||
init_v2d_oops(curarea, curarea->spacedata.first); // forces min/max to be reset
|
||||
boundbox_oops(0);
|
||||
G.v2d->cur= G.v2d->tot;
|
||||
dx= 0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
dy= 0.15*(G.v2d->cur.ymax-G.v2d->cur.ymin);
|
||||
G.v2d->cur.xmin-= dx;
|
||||
G.v2d->cur.xmax+= dx;
|
||||
G.v2d->cur.ymin-= dy;
|
||||
G.v2d->cur.ymax+= dy;
|
||||
test_view2d(G.v2d, curarea->winx, curarea->winy);
|
||||
scrarea_queue_winredraw(curarea);
|
||||
break;
|
||||
|
||||
case B_OOPSVIEWSEL:
|
||||
init_v2d_oops(curarea, curarea->spacedata.first); // forces min/max to be reset
|
||||
boundbox_oops(1);
|
||||
G.v2d->cur= G.v2d->tot;
|
||||
dx= 0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
dy= 0.15*(G.v2d->cur.ymax-G.v2d->cur.ymin);
|
||||
G.v2d->cur.xmin-= dx;
|
||||
G.v2d->cur.xmax+= dx;
|
||||
G.v2d->cur.ymin-= dy;
|
||||
G.v2d->cur.ymax+= dy;
|
||||
test_view2d(G.v2d, curarea->winx, curarea->winy);
|
||||
scrarea_queue_winredraw(curarea);
|
||||
break;
|
||||
|
||||
case B_NEWOOPS:
|
||||
if (event == B_NEWOOPS) {
|
||||
scrarea_queue_winredraw(curarea);
|
||||
scrarea_queue_headredraw(curarea);
|
||||
G.soops->lockpoin= 0;
|
||||
break;
|
||||
} else { /* must be either B_OOPSHOME or B_OOPSVIEWSEL */
|
||||
init_v2d_oops(curarea, curarea->spacedata.first); // forces min/max to be reset
|
||||
if (event == B_OOPSHOME) {
|
||||
boundbox_oops(0); /* Test all oops blocks */
|
||||
} else {
|
||||
boundbox_oops(1); /* Test only selected oops blocks */
|
||||
}
|
||||
|
||||
|
||||
/* Hack to work with test_view2d in drawipo.c
|
||||
Modify the bounding box so it is maximized to the window aspect
|
||||
so viewing all oops blocks isnt limited to hoz/vert only.
|
||||
Cant modify drawipo.c because many other functions use this hos/vert operation - Campbell*/
|
||||
|
||||
win_width= curarea->winrct.xmax - curarea->winrct.xmin;
|
||||
win_height= curarea->winrct.ymax - curarea->winrct.ymin;
|
||||
|
||||
oops_width = G.v2d->tot.xmax - G.v2d->tot.xmin;
|
||||
oops_height = G.v2d->tot.ymax - G.v2d->tot.ymin;
|
||||
|
||||
oops_x_mid = (G.v2d->tot.xmax + G.v2d->tot.xmin)*0.5;
|
||||
oops_y_mid = (G.v2d->tot.ymax + G.v2d->tot.ymin)*0.5;
|
||||
/* wide windows will be above 1, skinny below 1 */
|
||||
aspect_win= (float)win_width / (float)win_height;
|
||||
aspect_oops = (float)oops_width / (float)oops_height;
|
||||
if (aspect_win>aspect_oops) {/* the window is wider then the oops bounds, increase the oops width */
|
||||
G.v2d->tot.xmin = oops_x_mid - ((oops_x_mid-G.v2d->tot.xmin) * (aspect_win/aspect_oops) ); /* scale the min */
|
||||
G.v2d->tot.xmax = oops_x_mid + ((G.v2d->tot.xmax-oops_x_mid) * (aspect_win/aspect_oops) );/* scale the max */
|
||||
} else { /* the window is skinnier then the oops bounds, increase the oops height */
|
||||
G.v2d->tot.ymin = oops_y_mid - ((oops_y_mid-G.v2d->tot.ymin) * (aspect_oops/aspect_win) ); /* scale the min */
|
||||
G.v2d->tot.ymax = oops_y_mid + ((G.v2d->tot.ymax-oops_y_mid) * (aspect_oops/aspect_win) );/* scale the max */
|
||||
}
|
||||
|
||||
/* maybe we should restore the correct values? - do next of its needed */
|
||||
/* end hack */
|
||||
|
||||
|
||||
|
||||
G.v2d->cur= G.v2d->tot;
|
||||
dx= 0.15*(G.v2d->cur.xmax-G.v2d->cur.xmin);
|
||||
dy= 0.15*(G.v2d->cur.ymax-G.v2d->cur.ymin);
|
||||
G.v2d->cur.xmin-= dx;
|
||||
G.v2d->cur.xmax+= dx;
|
||||
G.v2d->cur.ymin-= dy;
|
||||
G.v2d->cur.ymax+= dy;
|
||||
test_view2d(G.v2d, curarea->winx, curarea->winy);
|
||||
scrarea_queue_winredraw(curarea);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@ void script_buttons(void)
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconBut(block, BUT, B_SCRIPT2PREV, ICON_GO_LEFT, xco+=XIC, 0, XIC, YIC,
|
||||
0, 0, 0, 0, 0, "Returns to previous window");
|
||||
|
||||
@@ -262,6 +263,7 @@ void script_buttons(void)
|
||||
else
|
||||
uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco+=XIC,0,XIC,YIC, 0, 0,
|
||||
0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* STD SCRIPT BUTTONS */
|
||||
xco += 2*XIC;
|
||||
|
||||
@@ -484,8 +484,10 @@ void seq_buttons()
|
||||
|
||||
/* ZOOM and BORDER */
|
||||
xco+= 8;
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButI(block, TOG, B_VIEW2DZOOM, ICON_VIEWZOOM, xco+=XIC,0,XIC,YIC, &viewmovetemp, 0, 0, 0, 0, "Zooms view in and out (Ctrl MiddleMouse)");
|
||||
uiDefIconBut(block, BUT, B_IPOBORDER, ICON_BORDERMOVE, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Zooms view to fit area");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* CLEAR MEM */
|
||||
xco+= 8;
|
||||
|
||||
@@ -613,12 +613,14 @@ void text_buttons(void)
|
||||
xco += 10;
|
||||
|
||||
/* FULL WINDOW */
|
||||
uiBlockBeginAlign(block);
|
||||
if(curarea->full) uiDefIconBut(block, BUT,B_FULL, ICON_SPLITSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Returns to multiple views window (CTRL+Up arrow)");
|
||||
else uiDefIconBut(block, BUT,B_FULL, ICON_FULLSCREEN, xco,0,XIC,YIC, 0, 0, 0, 0, 0, "Makes current window full screen (CTRL+Down arrow)");
|
||||
|
||||
uiDefIconButI(block, ICONTOG, B_TEXTLINENUM, ICON_LONGDISPLAY, xco+=XIC,0,XIC,YIC, &st->showlinenrs, 0, 0, 0, 0, "Displays line numbers");
|
||||
|
||||
uiDefIconButI(block, ICONTOG, B_SYNTAX, ICON_SYNTAX, xco+=XIC,0,XIC,YIC, &st->showsyntax, 0, 0, 0, 0, "Enables Syntax Highlighting");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
/* STD TEXT BUTTONS */
|
||||
xco+= 2*XIC;
|
||||
|
||||
@@ -4432,6 +4432,7 @@ void view3d_buttons(void)
|
||||
|
||||
if (ob && (ob->flag & OB_POSEMODE)) {
|
||||
xco+= XIC/2;
|
||||
uiBlockBeginAlign(block);
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiDefIconBut(block, BUT, B_ACTCOPY, ICON_COPYUP,
|
||||
xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
|
||||
@@ -4456,6 +4457,7 @@ void view3d_buttons(void)
|
||||
xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0,
|
||||
"Pastes the mirrored pose from the buffer");
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
/* Always do this last */
|
||||
|
||||
@@ -5364,7 +5364,7 @@ void uiBlockEndAlign(uiBlock *block)
|
||||
uiBut *prev, *but=NULL, *next;
|
||||
int flag= 0, cols=0, rows=0;
|
||||
|
||||
if ( !((BIF_GetThemeValue(TH_BUT_DRAWTYPE) == 1) || (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == 2))) {
|
||||
if ( !((BIF_GetThemeValue(TH_BUT_DRAWTYPE) == 0) || (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == 1) || (BIF_GetThemeValue(TH_BUT_DRAWTYPE) == 2))) {
|
||||
block->flag &= ~UI_BUT_ALIGN; // all 4 flags
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1207,11 +1207,17 @@ static void ui_draw_round(int type, int colorid, float asp, float x1, float y1,
|
||||
/* super minimal button as used in logic menu */
|
||||
static void ui_draw_minimal(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
|
||||
{
|
||||
|
||||
/* too much space between buttons */
|
||||
/*
|
||||
x1+= asp;
|
||||
x2-= asp;
|
||||
y1+= asp;
|
||||
y2-= asp;
|
||||
*/
|
||||
|
||||
/* Less space between buttons looks nicer */
|
||||
y2-= asp;
|
||||
x2-= asp;
|
||||
|
||||
/* paper */
|
||||
if(flag & UI_SELECT) {
|
||||
@@ -1744,6 +1750,15 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
unsigned char ustr[16];
|
||||
PackedFile *pf;
|
||||
int result = 0;
|
||||
int charmax = G.charmax;
|
||||
|
||||
/* <builtin> font in use */
|
||||
if(!strcmp(G.selfont->name, "<builtin>"))
|
||||
charmax = 0xff;
|
||||
|
||||
/* Category list exited without selecting the area */
|
||||
if(G.charmax == 0)
|
||||
charmax = G.charmax = 0xffff;
|
||||
|
||||
/* Calculate the size of the button */
|
||||
width = abs(but->x2 - but->x1);
|
||||
@@ -1777,7 +1792,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
|
||||
strcpy(tmpStr, G.selfont->name);
|
||||
BLI_convertstringcode(tmpStr, G.sce, 0);
|
||||
err = FTF_SetFont(tmpStr, 0, 14.0);
|
||||
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1791,12 +1806,12 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
for(y = 0; y < 6; y++)
|
||||
{
|
||||
// Do not draw more than the category allows
|
||||
if(cs > G.charmax) break;
|
||||
if(cs > charmax) break;
|
||||
|
||||
for(x = 0; x < 12; x++)
|
||||
{
|
||||
// Do not draw more than the category allows
|
||||
if(cs > G.charmax) break;
|
||||
if(cs > charmax) break;
|
||||
|
||||
// Draw one grid cell
|
||||
glBegin(GL_LINE_LOOP);
|
||||
@@ -1810,8 +1825,17 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
memset(wstr, 0, sizeof(wchar_t)*2);
|
||||
memset(ustr, 0, 16);
|
||||
|
||||
// Set the font to be either unicode or <builtin>
|
||||
wstr[0] = cs;
|
||||
wcs2utf8s(ustr, wstr);
|
||||
if(strcmp(G.selfont->name, "<builtin>"))
|
||||
{
|
||||
wcs2utf8s((char *)ustr, (wchar_t *)wstr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ustr[0] = cs;
|
||||
ustr[1] = 0;
|
||||
}
|
||||
|
||||
if(G.selfont && strcmp(G.selfont->name, "<builtin>"))
|
||||
{
|
||||
@@ -1821,8 +1845,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
float px, py;
|
||||
|
||||
// Calculate the position
|
||||
wid = FTF_GetStringWidth(ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
||||
FTF_GetBoundingBox(ustr, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
||||
wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
||||
FTF_GetBoundingBox((char *) ustr, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
||||
dx = urx-llx;
|
||||
dy = ury-lly;
|
||||
|
||||
@@ -1832,12 +1856,12 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
|
||||
// Set the position and draw the character
|
||||
ui_rasterpos_safe(px, py, but->aspect);
|
||||
FTF_DrawString(ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
||||
FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui_rasterpos_safe(sx + butw/2, sy + buth/2, but->aspect);
|
||||
BIF_DrawString(but->font, ustr, 0);
|
||||
BIF_DrawString(but->font, (char *) ustr, 0);
|
||||
}
|
||||
|
||||
// Calculate the next position and character
|
||||
@@ -1855,16 +1879,16 @@ static void ui_draw_but_CHARTAB(uiBut *but)
|
||||
/* Return Font Settings to original */
|
||||
if(U.fontsize && U.fontname[0])
|
||||
{
|
||||
result = FTF_SetFont(U.fontname, 0, U.fontsize);
|
||||
result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
|
||||
}
|
||||
else if (U.fontsize)
|
||||
{
|
||||
result = FTF_SetFont(datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
|
||||
result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, U.fontsize);
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
result = FTF_SetFont(datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
|
||||
result = FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 11);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1012,9 +1012,16 @@ void BIF_do_render(int anim)
|
||||
/* if start render in 3d win, use layer from window (e.g also local view) */
|
||||
if(curarea && curarea->spacetype==SPACE_VIEW3D) {
|
||||
int lay= G.scene->lay;
|
||||
/*
|
||||
* if view is defined (might not be if called form script), check
|
||||
* and set layers
|
||||
*/
|
||||
if(G.vd) {
|
||||
if(G.vd->lay & 0xFF000000) // localview
|
||||
G.scene->lay |= G.vd->lay;
|
||||
else G.scene->lay= G.vd->lay;
|
||||
else
|
||||
G.scene->lay= G.vd->lay;
|
||||
}
|
||||
|
||||
do_render(anim);
|
||||
|
||||
|
||||
@@ -3018,6 +3018,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
} else if(U.userpref == 5) { /* file paths */
|
||||
|
||||
/* yafray: (temporary) path button for yafray xml export, now with fileselect */
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "YFexport: ",
|
||||
(xpos+edgsp), y2+buth+rspace, lpref-smfileselbut, buth,
|
||||
U.yfexportdir, 1.0, 63.0, 0, 0,
|
||||
@@ -3025,7 +3026,9 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
uiDefIconBut(block, BUT, B_YAFRAYDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+lpref-smfileselbut), y2+buth+rspace, smfileselbut, buth,
|
||||
0, 0, 0, 0, 0, "Select the default yafray export directory");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Fonts: ",
|
||||
(xpos+edgsp),y2,(lpref-smfileselbut),buth,
|
||||
U.fontdir, 1.0, 63.0, 0, 0,
|
||||
@@ -3033,37 +3036,47 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
uiDefIconBut(block, BUT, B_FONTDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+lpref-smfileselbut),y2,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default font directory");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Textures: ",
|
||||
(xpos+edgsp+lpref+midsp),y2,(lpref-smfileselbut),buth,
|
||||
U.textudir, 1.0, 63.0, 0, 0, "The default directory to search for textures");
|
||||
uiDefIconBut(block, BUT, B_TEXTUDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+(2*lpref)+midsp-smfileselbut),y2,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default texture location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Tex Plugins: ",
|
||||
(xpos+edgsp+(2*lpref)+(2*midsp)),y2,(lpref-smfileselbut),buth,
|
||||
U.plugtexdir, 1.0, 63.0, 0, 0, "The default directory to search for texture plugins");
|
||||
uiDefIconBut(block, BUT, B_PLUGTEXDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+(3*lpref)+(2*midsp)-smfileselbut),y2,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default texture plugin location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Seq Plugins: ",
|
||||
(xpos+edgsp+(3*lpref)+(3*midsp)),y2,(lpref-smfileselbut),buth,
|
||||
U.plugseqdir, 1.0, 63.0, 0, 0, "The default directory to search for sequence plugins");
|
||||
uiDefIconBut(block, BUT, B_PLUGSEQDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+(4*lpref)+(3*midsp)-smfileselbut),y2,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default sequence plugin location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Render: ",
|
||||
(xpos+edgsp),y1,(lpref-smfileselbut),buth,
|
||||
U.renderdir, 1.0, 63.0, 0, 0, "The default directory for rendering output");
|
||||
uiDefIconBut(block, BUT, B_RENDERDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+lpref-smfileselbut),y1,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default render output location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Python: ",
|
||||
(xpos+edgsp+lpref+midsp),y1,(lpref-2*smfileselbut),buth,
|
||||
U.pythondir, 1.0, 63.0, 0, 0, "The default directory to search for Python scripts");
|
||||
@@ -3073,21 +3086,26 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
uiDefIconBut(block, BUT, B_PYTHONDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+(2*lpref)+midsp-smfileselbut),y1,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default Python script location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Sounds: ",
|
||||
(xpos+edgsp+(2*lpref)+(2*midsp)),y1,(lpref-smfileselbut),buth,
|
||||
U.sounddir, 1.0, 63.0, 0, 0, "The default directory to search for sounds");
|
||||
uiDefIconBut(block, BUT, B_SOUNDDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+(3*lpref)+(2*midsp)-smfileselbut),y1,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default sound location");
|
||||
0, 0, 0, 0, 0, "Selet the default sound location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, TEX, 0, "Temp: ",
|
||||
(xpos+edgsp+(3*lpref)+(3*midsp)),y1,(lpref-smfileselbut),buth,
|
||||
U.tempdir, 1.0, 63.0, 0, 0, "The directory for storing temporary save files");
|
||||
uiDefIconBut(block, BUT, B_TEMPDIRFILESEL, ICON_FILESEL,
|
||||
(xpos+edgsp+(4*lpref)+(3*midsp)-smfileselbut),y1,smfileselbut,buth,
|
||||
0, 0, 0, 0, 0, "Select the default temporary save file location");
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1359,6 +1359,19 @@ int do_clever_numbuts(char *name, int tot, int winevent)
|
||||
int a, sizex, sizey, x1, y2;
|
||||
short mval[2], event;
|
||||
|
||||
/* Clear all events so tooltips work, this is not ideal and
|
||||
only needed because calls from the menu still have some events
|
||||
left over when do_clever_numbuts is called.
|
||||
Calls from keyshortcuts do not have this problem.*/
|
||||
ScrArea *sa;
|
||||
BWinEvent temp_bevt;
|
||||
for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
|
||||
while( bwin_qread( sa->win, &temp_bevt ) ) {}
|
||||
while( bwin_qread( sa->headwin, &temp_bevt ) ) {}
|
||||
}
|
||||
/* Done clearing events */
|
||||
|
||||
|
||||
if(tot<=0 || tot>MAXNUMBUTS) return 0;
|
||||
|
||||
getmouseco_sc(mval);
|
||||
@@ -1383,6 +1396,9 @@ int do_clever_numbuts(char *name, int tot, int winevent)
|
||||
|
||||
/* WATCH IT: TEX BUTTON EXCEPTION */
|
||||
/* WARNING: ONLY A SINGLE BIT-BUTTON POSSIBLE: WE WORK AT COPIED DATA! */
|
||||
|
||||
BIF_ThemeColor(TH_MENU_TEXT); /* makes text readable on dark theme */
|
||||
|
||||
uiDefBut(block, LABEL, 0, name, (short)(x1+15), (short)(y2-35), (short)(sizex-60), 19, 0, 1.0, 0.0, 0, 0, "");
|
||||
|
||||
/*
|
||||
@@ -1394,12 +1410,22 @@ int do_clever_numbuts(char *name, int tot, int winevent)
|
||||
uiBlockBeginAlign(block);
|
||||
varstr= &numbuts[0];
|
||||
for(a=0; a<tot; a++, varstr++) {
|
||||
|
||||
if(varstr->type==TEX) {
|
||||
uiDefBut(block, TEX, 0, varstr->name,(short)(x1+15),(short)(y2-55-20*a),(short)(sizex-60), 19, numbpoin[a], varstr->min, varstr->max, 0, 0, varstr->tip);
|
||||
}
|
||||
else {
|
||||
|
||||
if(varstr->type==LABEL) /* dont include the label when rounding the buttons */
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiDefBut(block, varstr->type, 0, varstr->name,(short)(x1+15),(short)(y2-55-20*a), (short)(sizex-60), 19, &(numbdata[a]), varstr->min, varstr->max, 100, 0, varstr->tip);
|
||||
|
||||
if(varstr->type==LABEL)
|
||||
uiBlockBeginAlign(block);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
|
||||
@@ -761,7 +761,10 @@ void calculateCenter(TransInfo *t)
|
||||
projectIntView(t, axis, t->center2d);
|
||||
|
||||
/* rotate only needs correct 2d center, grab needs initgrabz() value */
|
||||
if(t->mode==TFM_TRANSLATION) VECCOPY(t->center, axis);
|
||||
if(t->mode==TFM_TRANSLATION) {
|
||||
VECCOPY(t->center, axis);
|
||||
VECCOPY(t->con.center, t->center);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -536,7 +536,14 @@ void viewmove(int mode)
|
||||
short use_sel = 0;
|
||||
short preview3d_event= 1;
|
||||
|
||||
/* 3D window may not be defined */
|
||||
if( !G.vd ) {
|
||||
fprintf( stderr, "G.vd == NULL in viewmove()\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* sometimes this routine is called from headerbuttons */
|
||||
|
||||
areawinset(curarea->win);
|
||||
|
||||
initgrabz(-G.vd->ofs[0], -G.vd->ofs[1], -G.vd->ofs[2]);
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
#pragma warning (disable:4786)
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#endif
|
||||
|
||||
#include "KX_BlenderGL.h"
|
||||
#include "KX_BlenderCanvas.h"
|
||||
#include "KX_BlenderKeyboardDevice.h"
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <windows.h>
|
||||
#endif //WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
|
||||
@@ -168,16 +168,16 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
|
||||
// maybe there are events for us in the queue !
|
||||
if (frame)
|
||||
{
|
||||
for (vector<CValue*>::iterator i=m_events.end(); !(i==m_events.begin());)
|
||||
for (vector<CValue*>::iterator i=m_events.begin(); !(i==m_events.end());i++)
|
||||
{
|
||||
i--;
|
||||
if ((*i)->GetNumber() == 0.0f)
|
||||
bNegativeEvent = true;
|
||||
else
|
||||
bPositiveEvent= true;
|
||||
(*i)->Release();
|
||||
m_events.pop_back();
|
||||
|
||||
}
|
||||
m_events.clear();
|
||||
|
||||
if (bPositiveEvent)
|
||||
m_flag |= ACT_FLAG_ACTIVE;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
// -----------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
@@ -31,7 +32,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),
|
||||
@@ -40,19 +41,14 @@ BL_Shader::BL_Shader(int n, PyTypeObject *T)
|
||||
mOk(0),
|
||||
mUse(0),
|
||||
vertProg(""),
|
||||
fragProg("")
|
||||
fragProg(""),
|
||||
mError(0),
|
||||
mLog(0)
|
||||
|
||||
{
|
||||
// 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;
|
||||
@@ -66,16 +62,20 @@ using namespace bgl;
|
||||
BL_Shader::~BL_Shader()
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mLog) {
|
||||
MEM_freeN(mLog);
|
||||
mLog=0;
|
||||
}
|
||||
if( mShader ) {
|
||||
glDeleteObjectARB(mShader);
|
||||
bgl::blDeleteObjectARB(mShader);
|
||||
mShader = 0;
|
||||
}
|
||||
if( mFrag ) {
|
||||
glDeleteObjectARB(mFrag);
|
||||
bgl::blDeleteObjectARB(mFrag);
|
||||
mFrag = 0;
|
||||
}
|
||||
if( mVert ) {
|
||||
glDeleteObjectARB(mVert);
|
||||
bgl::blDeleteObjectARB(mVert);
|
||||
mVert = 0;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ BL_Shader::~BL_Shader()
|
||||
fragProg = 0;
|
||||
mOk = 0;
|
||||
|
||||
glUseProgramObjectARB(0);
|
||||
bgl::blUseProgramObjectARB(0);
|
||||
#endif//GL_ARB_shader_objects
|
||||
}
|
||||
|
||||
@@ -91,68 +91,74 @@ BL_Shader::~BL_Shader()
|
||||
bool BL_Shader::LinkProgram()
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
int numchars=0;
|
||||
char* log=0;
|
||||
|
||||
int vertlen = 0, fraglen=0, proglen=0;
|
||||
int vertstatus=0, fragstatus=0, progstatus=0;
|
||||
unsigned int tmpVert=0, tmpFrag=0, tmpProg=0;
|
||||
int char_len=0;
|
||||
|
||||
if(mError)
|
||||
goto programError;
|
||||
|
||||
if(!vertProg || !fragProg){
|
||||
spit("Invalid GLSL sources");
|
||||
return false;
|
||||
}
|
||||
|
||||
// create our objects
|
||||
unsigned int tmpVert = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
|
||||
unsigned int tmpFrag = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
|
||||
unsigned int tmpProg = glCreateProgramObjectARB();
|
||||
|
||||
if(!tmpVert || !tmpFrag || !tmpProg){
|
||||
glDeleteObjectARB(tmpVert);
|
||||
glDeleteObjectARB(tmpFrag);
|
||||
glDeleteObjectARB(tmpProg);
|
||||
if( !RAS_EXT_support._ARB_fragment_shader) {
|
||||
spit("Fragment shaders not supported");
|
||||
return false;
|
||||
}
|
||||
// set/compile vertex shader
|
||||
glShaderSourceARB(tmpVert, 1, (const char**)&vertProg, 0);
|
||||
glCompileShaderARB(tmpVert);
|
||||
glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &vertlen);
|
||||
|
||||
if( vertlen > 0 && !PrintInfo(vertlen,tmpVert, "Vertex Shader") ){
|
||||
spit("Vertex shader failed");
|
||||
glDeleteObjectARB(tmpVert);
|
||||
glDeleteObjectARB(tmpFrag);
|
||||
glDeleteObjectARB(tmpProg);
|
||||
mOk = 0;
|
||||
return false;
|
||||
}
|
||||
// set/compile fragment shader
|
||||
glShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0);
|
||||
glCompileShaderARB(tmpFrag);
|
||||
glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, &fraglen);
|
||||
if(fraglen >0 && !PrintInfo(fraglen,tmpFrag, "Fragment Shader") ){
|
||||
spit("Fragment shader failed");
|
||||
glDeleteObjectARB(tmpVert);
|
||||
glDeleteObjectARB(tmpFrag);
|
||||
glDeleteObjectARB(tmpProg);
|
||||
mOk = 0;
|
||||
if( !RAS_EXT_support._ARB_vertex_shader) {
|
||||
spit("Vertex shaders not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
// -- vertex shader ------------------
|
||||
tmpVert = bgl::blCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
|
||||
bgl::blShaderSourceARB(tmpVert, 1, (const char**)&vertProg, 0);
|
||||
bgl::blCompileShaderARB(tmpVert);
|
||||
bgl::blGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &vertlen);
|
||||
// print info if any
|
||||
if( vertlen > 1){
|
||||
PrintInfo(vertlen,tmpVert, &char_len);
|
||||
goto programError;
|
||||
}
|
||||
// check for compile errors
|
||||
bgl::blGetObjectParameterivARB(tmpVert, GL_OBJECT_COMPILE_STATUS_ARB, &vertstatus);
|
||||
if(!vertstatus)
|
||||
goto programError;
|
||||
|
||||
// -- fragment shader ----------------
|
||||
tmpFrag = bgl::blCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
|
||||
bgl::blShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0);
|
||||
bgl::blCompileShaderARB(tmpFrag);
|
||||
bgl::blGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, &fraglen);
|
||||
if(fraglen >1 ){
|
||||
PrintInfo(fraglen,tmpFrag, &char_len);
|
||||
goto programError;
|
||||
}
|
||||
bgl::blGetObjectParameterivARB(tmpFrag, GL_OBJECT_COMPILE_STATUS_ARB, &fragstatus);
|
||||
if(!fragstatus)
|
||||
goto programError;
|
||||
|
||||
|
||||
// -- program ------------------------
|
||||
// set compiled vert/frag shader & link
|
||||
glAttachObjectARB(tmpProg, tmpVert);
|
||||
glAttachObjectARB(tmpProg, tmpFrag);
|
||||
glLinkProgramARB(tmpProg);
|
||||
tmpProg = bgl::blCreateProgramObjectARB();
|
||||
bgl::blAttachObjectARB(tmpProg, tmpVert);
|
||||
bgl::blAttachObjectARB(tmpProg, tmpFrag);
|
||||
bgl::blLinkProgramARB(tmpProg);
|
||||
bgl::blGetObjectParameterivARB(tmpProg, GL_OBJECT_INFO_LOG_LENGTH_ARB, &proglen);
|
||||
bgl::blGetObjectParameterivARB(tmpProg, GL_OBJECT_LINK_STATUS_ARB, &progstatus);
|
||||
if(!progstatus)
|
||||
goto programError;
|
||||
|
||||
glGetObjectParameterivARB(tmpProg, GL_OBJECT_INFO_LOG_LENGTH_ARB, &proglen);
|
||||
if(proglen > 0) {
|
||||
PrintInfo(proglen,tmpProg, "GLSL Shader");
|
||||
}
|
||||
else{
|
||||
spit("Program failed");
|
||||
glDeleteObjectARB(tmpVert);
|
||||
glDeleteObjectARB(tmpFrag);
|
||||
glDeleteObjectARB(tmpProg);
|
||||
mOk = 0;
|
||||
return false;
|
||||
// print success
|
||||
PrintInfo(proglen,tmpProg, &char_len);
|
||||
if(char_len >0)
|
||||
spit(mLog);
|
||||
mError = 0;
|
||||
}
|
||||
|
||||
// set
|
||||
@@ -161,34 +167,42 @@ bool BL_Shader::LinkProgram()
|
||||
mFrag = tmpFrag;
|
||||
mOk = 1;
|
||||
return true;
|
||||
|
||||
programError:
|
||||
if(tmpVert) {
|
||||
bgl::blDeleteObjectARB(tmpVert);
|
||||
tmpVert=0;
|
||||
}
|
||||
if(tmpFrag) {
|
||||
bgl::blDeleteObjectARB(tmpFrag);
|
||||
tmpFrag=0;
|
||||
}
|
||||
|
||||
if(tmpProg) {
|
||||
bgl::blDeleteObjectARB(tmpProg);
|
||||
tmpProg=0;
|
||||
}
|
||||
|
||||
mOk = 0;
|
||||
mUse=0;
|
||||
mError = 1;
|
||||
spit("----------");
|
||||
spit("GLSL Error ");
|
||||
if(mLog)
|
||||
spit(mLog);
|
||||
spit("--------------------");
|
||||
return false;
|
||||
#else
|
||||
return false;
|
||||
#endif//GL_ARB_shader_objects
|
||||
}
|
||||
|
||||
bool BL_Shader::PrintInfo(int len, unsigned int handle, const char *type)
|
||||
void BL_Shader::PrintInfo(int len, unsigned int handle, int* num)
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
int numchars=0;
|
||||
char *log = (char*)MEM_mallocN(sizeof(char)*len, "print_log");
|
||||
if(!log) {
|
||||
spit("BL_Shader::PrintInfo() MEM_mallocN failed");
|
||||
return false;
|
||||
}
|
||||
glGetInfoLogARB(handle, len, &numchars, log);
|
||||
|
||||
if(numchars >0){
|
||||
spit(type);
|
||||
spit(log);
|
||||
MEM_freeN(log);
|
||||
log=0;
|
||||
return false;
|
||||
}
|
||||
MEM_freeN(log);
|
||||
log=0;
|
||||
return true;
|
||||
#else
|
||||
return false
|
||||
mLog = (char*)MEM_mallocN(sizeof(char)*len, "print_log");
|
||||
//MT_assert(mLog, "Failed to create memory");
|
||||
bgl::blGetInfoLogARB(handle, len, num, mLog);
|
||||
#endif//GL_ARB_shader_objects
|
||||
}
|
||||
|
||||
@@ -234,13 +248,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 +294,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
|
||||
};
|
||||
@@ -332,15 +338,14 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProg
|
||||
vertProg = v;
|
||||
fragProg = f;
|
||||
if( LinkProgram() ) {
|
||||
glUseProgramObjectARB( mShader );
|
||||
bgl::blUseProgramObjectARB( mShader );
|
||||
mUse = apply!=0;
|
||||
Py_Return;
|
||||
}
|
||||
vertProg = 0;
|
||||
fragProg = 0;
|
||||
mUse = 0;
|
||||
glUseProgramObjectARB( 0 );
|
||||
PyErr_Format(PyExc_ValueError, "GLSL Error");
|
||||
Py_Return;
|
||||
}
|
||||
return NULL;
|
||||
#else
|
||||
@@ -352,9 +357,9 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProg
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
glDeleteObjectARB(mShader);
|
||||
glDeleteObjectARB(mFrag);
|
||||
glDeleteObjectARB(mVert);
|
||||
bgl::blDeleteObjectARB(mShader);
|
||||
bgl::blDeleteObjectARB(mFrag);
|
||||
bgl::blDeleteObjectARB(mVert);
|
||||
mShader = 0;
|
||||
mFrag = 0;
|
||||
mVert = 0;
|
||||
@@ -362,13 +367,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" )
|
||||
fragProg = 0;
|
||||
mOk = 0;
|
||||
mUse = 0;
|
||||
glUseProgramObjectARB(0);
|
||||
bgl::blUseProgramObjectARB(0);
|
||||
#endif
|
||||
Py_Return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, isValid, "isValid()" )
|
||||
{
|
||||
return PyInt_FromLong( ( mShader !=0 && mOk ) );
|
||||
@@ -384,21 +388,22 @@ 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(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
if(mShader==0) {
|
||||
PyErr_Format(PyExc_TypeError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int stat = 0;
|
||||
glValidateProgramARB(mShader);
|
||||
glGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB, &stat);
|
||||
|
||||
return PyInt_FromLong((stat!=0));
|
||||
bgl::blValidateProgramARB(mShader);
|
||||
bgl::blGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB, &stat);
|
||||
return PyInt_FromLong(0);
|
||||
#else
|
||||
Py_Return;
|
||||
#endif//GL_ARB_shader_objects
|
||||
@@ -408,6 +413,11 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
char *uniform="";
|
||||
int index=-1;
|
||||
if(PyArg_ParseTuple(args, "si", &uniform, &index))
|
||||
@@ -417,7 +427,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader, uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader, uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
@@ -446,7 +456,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )
|
||||
if(!PyArg_ParseTuple(args, "i", &pass))
|
||||
return NULL;
|
||||
|
||||
mPass = pass;
|
||||
mPass = 1;
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -454,6 +464,11 @@ KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
char *uniform="";
|
||||
float value=0;
|
||||
if(PyArg_ParseTuple(args, "sf", &uniform, &value ))
|
||||
@@ -463,15 +478,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader, uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader, uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB( mShader );
|
||||
glUniform1fARB( loc, value );
|
||||
bgl::blUseProgramObjectARB( mShader );
|
||||
bgl::blUniform1fARB( loc, value );
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -486,6 +501,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
float array[2]={ 0,0 };
|
||||
if(PyArg_ParseTuple(args, "sff", &uniform, &array[0],&array[1] ))
|
||||
@@ -495,15 +514,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB( mShader );
|
||||
glUniform2fARB(loc, array[0],array[1] );
|
||||
bgl::blUseProgramObjectARB( mShader );
|
||||
bgl::blUniform2fARB(loc, array[0],array[1] );
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -518,6 +537,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
float array[3]={0,0,0};
|
||||
if(PyArg_ParseTuple(args, "sfff", &uniform, &array[0],&array[1],&array[2]))
|
||||
@@ -527,15 +550,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform3fARB(loc, array[0],array[1],array[2]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform3fARB(loc, array[0],array[1],array[2]);
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -550,6 +573,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) ")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
float array[4]={0,0,0,0};
|
||||
if(PyArg_ParseTuple(args, "sffff", &uniform, &array[0],&array[1],&array[2], &array[3]))
|
||||
@@ -559,15 +586,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) "
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform4fARB(loc, array[0],array[1],array[2], array[3]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform4fARB(loc, array[0],array[1],array[2], array[3]);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -581,6 +608,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) "
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
int value=0;
|
||||
if(PyArg_ParseTuple(args, "si", &uniform, &value ))
|
||||
@@ -590,15 +621,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader, uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader, uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB( mShader );
|
||||
glUniform1iARB( loc, value );
|
||||
bgl::blUseProgramObjectARB( mShader );
|
||||
bgl::blUniform1iARB( loc, value );
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -612,6 +643,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
int array[2]={ 0,0 };
|
||||
if(PyArg_ParseTuple(args, "sii", &uniform, &array[0],&array[1] ))
|
||||
@@ -621,15 +656,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB( mShader );
|
||||
glUniform2iARB(loc, array[0],array[1] );
|
||||
bgl::blUseProgramObjectARB( mShader );
|
||||
bgl::blUniform2iARB(loc, array[0],array[1] );
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -643,6 +678,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
int array[3]={0,0,0};
|
||||
if(PyArg_ParseTuple(args, "siii", &uniform, &array[0],&array[1],&array[2]))
|
||||
@@ -652,15 +691,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform3iARB(loc, array[0],array[1],array[2]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform3iARB(loc, array[0],array[1],array[2]);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -673,6 +712,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) ")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char *uniform="";
|
||||
int array[4]={0,0,0, 0};
|
||||
if(PyArg_ParseTuple(args, "siiii", &uniform, &array[0],&array[1],&array[2], &array[3] ))
|
||||
@@ -682,15 +725,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) "
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
Py_Return;
|
||||
}else
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform4iARB(loc, array[0],array[1],array[2], array[3]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform4iARB(loc, array[0],array[1],array[2], array[3]);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -703,6 +746,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) "
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or list3 or list4) )")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char*uniform = "";
|
||||
PyObject *listPtr =0;
|
||||
float array_data[4] = {0.f,0.f,0.f,0.f};
|
||||
@@ -714,7 +761,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
@@ -735,20 +782,20 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform2fARB(loc, array_data[0],array_data[1]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform2fARB(loc, array_data[0],array_data[1]);
|
||||
Py_Return;
|
||||
} break;
|
||||
case 3:
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform3fARB(loc, array_data[0],array_data[1], array_data[2]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform3fARB(loc, array_data[0],array_data[1], array_data[2]);
|
||||
Py_Return;
|
||||
}break;
|
||||
case 4:
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform4fARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform4fARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]);
|
||||
Py_Return;
|
||||
}break;
|
||||
default:
|
||||
@@ -770,6 +817,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis
|
||||
KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3 or list4) )")
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
char*uniform = "";
|
||||
PyObject *listPtr =0;
|
||||
int array_data[4] = {0,0,0,0};
|
||||
@@ -781,7 +832,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
@@ -802,20 +853,20 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform2iARB(loc, array_data[0],array_data[1]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform2iARB(loc, array_data[0],array_data[1]);
|
||||
Py_Return;
|
||||
} break;
|
||||
case 3:
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform3iARB(loc, array_data[0],array_data[1], array_data[2]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform3iARB(loc, array_data[0],array_data[1], array_data[2]);
|
||||
Py_Return;
|
||||
}break;
|
||||
case 4:
|
||||
{
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniform4iARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniform4iARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]);
|
||||
Py_Return;
|
||||
}break;
|
||||
default:
|
||||
@@ -838,6 +889,11 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
|
||||
"setUniformMatrix4(uniform-name, mat-4x4, transpose(row-major=true, col-major=false)" )
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
float matr[16] = {
|
||||
1,0,0,0,
|
||||
0,1,0,0,
|
||||
@@ -855,7 +911,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
@@ -868,8 +924,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
|
||||
if (PyMatTo(matrix, mat))
|
||||
{
|
||||
mat.getValue(matr);
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniformMatrix4fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniformMatrix4fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -886,6 +942,11 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
|
||||
"setUniformMatrix3(uniform-name, list[3x3], transpose(row-major=true, col-major=false)" )
|
||||
{
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(mError) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
float matr[9] = {
|
||||
1,0,0,
|
||||
0,1,0,
|
||||
@@ -902,7 +963,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
|
||||
PyErr_Format(PyExc_ValueError, "invalid shader object");
|
||||
return NULL;
|
||||
}
|
||||
int loc= glGetUniformLocationARB(mShader , uniform);
|
||||
int loc= bgl::blGetUniformLocationARB(mShader , uniform);
|
||||
if( loc==-1 )
|
||||
{
|
||||
spit("Invalid uniform value: " << uniform << ".");
|
||||
@@ -915,8 +976,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
|
||||
if (PyMatTo(matrix, mat))
|
||||
{
|
||||
mat.getValue(matr);
|
||||
glUseProgramObjectARB(mShader);
|
||||
glUniformMatrix3fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr);
|
||||
bgl::blUseProgramObjectARB(mShader);
|
||||
bgl::blUniformMatrix3fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr);
|
||||
Py_Return;
|
||||
}
|
||||
}
|
||||
@@ -927,16 +988,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;
|
||||
}
|
||||
|
||||
@@ -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,15 @@ 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);
|
||||
bool mError;
|
||||
char* mLog;
|
||||
|
||||
bool LinkProgram();
|
||||
void PrintInfo( int len, unsigned int handle,int *num);
|
||||
public:
|
||||
BL_Shader(int n, PyTypeObject *T=&Type);
|
||||
BL_Shader(PyTypeObject *T=&Type);
|
||||
virtual ~BL_Shader();
|
||||
|
||||
char* GetVertPtr();
|
||||
@@ -59,11 +49,10 @@ public:
|
||||
// ---
|
||||
int getNumPass() {return mPass;}
|
||||
bool use() {return mUse;}
|
||||
|
||||
bool GetError() {return mError;}
|
||||
// ---
|
||||
// access
|
||||
const uSampler* getSampler(int i);
|
||||
const uBlending* getBlending( int pass );
|
||||
const bool Ok()const;
|
||||
|
||||
unsigned int GetProg();
|
||||
@@ -108,8 +97,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 );
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
@@ -20,7 +21,6 @@
|
||||
#include "DNA_image_types.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
#include "BKE_image.h"
|
||||
//#include "IMB_imbuf.h"
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "RAS_GLExtensionManager.h"
|
||||
@@ -35,6 +35,7 @@ using namespace bgl;
|
||||
extern "C" {
|
||||
// envmaps
|
||||
#include "IMB_imbuf.h"
|
||||
|
||||
void my_envmap_split_ima(EnvMap *env);
|
||||
void my_free_envmapdata(EnvMap *env);
|
||||
}
|
||||
@@ -345,18 +346,18 @@ void my_envmap_split_ima(EnvMap *env)
|
||||
ima->ok= 1;
|
||||
env->cube[part]= ima;
|
||||
}
|
||||
IMB_rectcpy(env->cube[0]->ibuf, env->ima->ibuf,
|
||||
0, 0, 0, 0, dx, dx);
|
||||
IMB_rectcpy(env->cube[1]->ibuf, env->ima->ibuf,
|
||||
0, 0, dx, 0, dx, dx);
|
||||
IMB_rectcpy(env->cube[2]->ibuf, env->ima->ibuf,
|
||||
0, 0, 2*dx, 0, dx, dx);
|
||||
IMB_rectcpy(env->cube[3]->ibuf, env->ima->ibuf,
|
||||
0, 0, 0, dx, dx, dx);
|
||||
IMB_rectcpy(env->cube[4]->ibuf, env->ima->ibuf,
|
||||
0, 0, dx, dx, dx, dx);
|
||||
IMB_rectcpy(env->cube[5]->ibuf, env->ima->ibuf,
|
||||
0, 0, 2*dx, dx, dx, dx);
|
||||
IMB_rectop(env->cube[0]->ibuf, env->ima->ibuf,
|
||||
0, 0, 0, 0, dx, dx, IMB_rectcpy, 0);
|
||||
IMB_rectop(env->cube[1]->ibuf, env->ima->ibuf,
|
||||
0, 0, dx, 0, dx, dx, IMB_rectcpy, 0);
|
||||
IMB_rectop(env->cube[2]->ibuf, env->ima->ibuf,
|
||||
0, 0, 2*dx, 0, dx, dx, IMB_rectcpy, 0);
|
||||
IMB_rectop(env->cube[3]->ibuf, env->ima->ibuf,
|
||||
0, 0, 0, dx, dx, dx, IMB_rectcpy, 0);
|
||||
IMB_rectop(env->cube[4]->ibuf, env->ima->ibuf,
|
||||
0, 0, dx, dx, dx, dx, IMB_rectcpy, 0);
|
||||
IMB_rectop(env->cube[5]->ibuf, env->ima->ibuf,
|
||||
0, 0, 2*dx, dx, dx, dx, IMB_rectcpy, 0);
|
||||
env->ok= 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
@@ -22,6 +23,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 +77,10 @@ KX_BlenderMaterial::KX_BlenderMaterial(
|
||||
mMaterial(data),
|
||||
mShader(0),
|
||||
mScene(scene),
|
||||
mUserDefBlend(0),
|
||||
mModified(0),
|
||||
mPass(0)
|
||||
|
||||
{
|
||||
///RAS_EXT_support._ARB_multitexture == true if were here
|
||||
|
||||
@@ -132,14 +137,9 @@ 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++) {
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
#ifdef GL_ARB_texture_cube_map
|
||||
if( mMaterial->mapping[i].mapping & USEENV ) {
|
||||
if(!RAS_EXT_support._ARB_texture_cube_map) {
|
||||
@@ -149,9 +149,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 +157,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 +164,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()
|
||||
@@ -180,14 +177,14 @@ void KX_BlenderMaterial::OnExit()
|
||||
if( RAS_EXT_support._ARB_shader_objects && mShader ) {
|
||||
//note, the shader here is allocated, per unique material
|
||||
//and this function is called per face
|
||||
glUseProgramObjectARB(0);
|
||||
bgl::blUseProgramObjectARB(0);
|
||||
delete mShader;
|
||||
mShader = 0;
|
||||
}
|
||||
#endif //GL_ARB_shader_objects
|
||||
|
||||
for(int i=0; i<mMaterial->num_enabled; i++) {
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
|
||||
mTextures[i].DeleteTex();
|
||||
|
||||
@@ -213,7 +210,7 @@ void KX_BlenderMaterial::OnExit()
|
||||
gTextureDict = 0;
|
||||
}*/
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
|
||||
#ifdef GL_ARB_texture_cube_map
|
||||
if(RAS_EXT_support._ARB_texture_cube_map)
|
||||
@@ -238,7 +235,7 @@ void KX_BlenderMaterial::DisableTexData()
|
||||
#ifdef GL_ARB_multitexture
|
||||
int i=(MAXTEX>=bgl::max_texture_units?bgl::max_texture_units:MAXTEX)-1;
|
||||
for(; i>=0; i--) {
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
@@ -268,13 +265,13 @@ void KX_BlenderMaterial::setShaderData( bool enable )
|
||||
int i;
|
||||
if( !enable || !mShader->Ok() ) {
|
||||
// frame cleanup.
|
||||
glUseProgramObjectARB( 0 );
|
||||
bgl::blUseProgramObjectARB( 0 );
|
||||
DisableTexData();
|
||||
return;
|
||||
}
|
||||
|
||||
DisableTexData();
|
||||
glUseProgramObjectARB( mShader->GetProg() );
|
||||
bgl::blUseProgramObjectARB( mShader->GetProg() );
|
||||
|
||||
// for each enabled unit
|
||||
for(i=0; i<mMaterial->num_enabled; i++) {
|
||||
@@ -282,7 +279,7 @@ void KX_BlenderMaterial::setShaderData( bool enable )
|
||||
const uSampler *samp = mShader->getSampler(i);
|
||||
if( samp->loc == -1 || samp->glTexture == 0 ) continue;
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
|
||||
#ifdef GL_ARB_texture_cube_map
|
||||
if( mMaterial->mapping[i].mapping &USEENV ) {
|
||||
@@ -297,9 +294,17 @@ void KX_BlenderMaterial::setShaderData( bool enable )
|
||||
}
|
||||
#endif//GL_ARB_texture_cube_map
|
||||
// use a sampler
|
||||
glUniform1iARB(samp->loc, i );
|
||||
bgl::blUniform1iARB(samp->loc, i );
|
||||
}
|
||||
|
||||
if(!mUserDefBlend) {
|
||||
setDefaultBlending();
|
||||
}else
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
// tested to be valid enums
|
||||
glBlendFunc(mBlendFunc[0], mBlendFunc[1]);
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
#endif//GL_ARB_shader_objects
|
||||
#endif//GL_ARB_multitexture
|
||||
@@ -314,7 +319,7 @@ void KX_BlenderMaterial::setTexData( bool enable )
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(RAS_EXT_support._ARB_shader_objects) {
|
||||
// switch back to fixed func
|
||||
glUseProgramObjectARB( 0 );
|
||||
bgl::blUseProgramObjectARB( 0 );
|
||||
}
|
||||
#endif//GL_ARB_shader_objects
|
||||
|
||||
@@ -336,7 +341,7 @@ void KX_BlenderMaterial::setTexData( bool enable )
|
||||
// no material connected to the object
|
||||
if( mTextures[0] ) {
|
||||
if( !mTextures[0].Ok() ) return;
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
glBindTexture( GL_TEXTURE_2D, mTextures[0] );
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
setTextureEnvironment( -1 ); // modulate
|
||||
@@ -352,7 +357,7 @@ void KX_BlenderMaterial::setTexData( bool enable )
|
||||
for(i=0; (i<mMaterial->num_enabled); i++) {
|
||||
if( !mTextures[i].Ok() ) continue;
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i);
|
||||
|
||||
#ifdef GL_ARB_texture_cube_map
|
||||
// use environment maps
|
||||
@@ -388,15 +393,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
|
||||
}
|
||||
|
||||
@@ -548,7 +554,7 @@ KX_BlenderMaterial::Activate(
|
||||
return dopass;
|
||||
}
|
||||
else {
|
||||
glUseProgramObjectARB( 0 );
|
||||
bgl::blUseProgramObjectARB( 0 );
|
||||
mPass = 0;
|
||||
dopass = false;
|
||||
return dopass;
|
||||
@@ -589,7 +595,6 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
|
||||
GLfloat blend_operand = 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 +602,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 +614,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) {
|
||||
@@ -622,23 +627,38 @@ void KX_BlenderMaterial::setTextureEnvironment( int textureIndex )
|
||||
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:
|
||||
{
|
||||
// ------------------------------
|
||||
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);
|
||||
if(!using_alpha)
|
||||
glTexEnvf( GL_TEXTURE_ENV, source2, GL_CONSTANT_ARB );
|
||||
glTexEnvf( GL_TEXTURE_ENV, op2, GL_SRC_ALPHA);
|
||||
else
|
||||
glTexEnvf( GL_TEXTURE_ENV, source2, GL_TEXTURE );
|
||||
|
||||
glTexEnvf( GL_TEXTURE_ENV, op2, alphaOp);
|
||||
}break;
|
||||
case BLEND_MUL:
|
||||
{
|
||||
@@ -647,6 +667,9 @@ 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 );
|
||||
if(using_alpha)
|
||||
glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp);
|
||||
else
|
||||
glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
|
||||
}break;
|
||||
case BLEND_ADD:
|
||||
@@ -656,6 +679,9 @@ 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 );
|
||||
if(using_alpha)
|
||||
glTexEnvf( GL_TEXTURE_ENV, op1, alphaOp);
|
||||
else
|
||||
glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand);
|
||||
}break;
|
||||
case BLEND_SUB:
|
||||
@@ -674,37 +700,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 );
|
||||
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 +878,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 ),
|
||||
|
||||
@@ -914,17 +920,75 @@ int KX_BlenderMaterial::_setattr(const STR_String& attr, PyObject *pyvalue)
|
||||
return PyObjectPlus::_setattr(attr, pyvalue);
|
||||
}
|
||||
|
||||
|
||||
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
|
||||
{
|
||||
#ifdef GL_ARB_fragment_shader
|
||||
if( !RAS_EXT_support._ARB_fragment_shader) {
|
||||
if(!mModified)
|
||||
spit("Fragment shaders not supported");
|
||||
|
||||
mModified = true;
|
||||
Py_Return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_vertex_shader
|
||||
if( !RAS_EXT_support._ARB_vertex_shader) {
|
||||
if(!mModified)
|
||||
spit("Vertex shaders not supported");
|
||||
|
||||
mModified = true;
|
||||
Py_Return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_shader_objects
|
||||
if(!RAS_EXT_support._ARB_shader_objects) {
|
||||
PyErr_Format(PyExc_SystemError, "GLSL not supported");
|
||||
return NULL;
|
||||
if(!mModified)
|
||||
spit("GLSL not supported");
|
||||
mModified = true;
|
||||
Py_Return;
|
||||
}
|
||||
else {
|
||||
// returns Py_None on error
|
||||
// the calling script will need to check
|
||||
|
||||
if(!mShader && !mModified) {
|
||||
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]);
|
||||
}
|
||||
mModified = true;
|
||||
}
|
||||
|
||||
if(mShader && !mShader->GetError()) {
|
||||
Py_INCREF(mShader);
|
||||
return mShader;
|
||||
}else
|
||||
{
|
||||
// decref all references to the object
|
||||
// then delete it!
|
||||
// We will then go back to fixed functionality
|
||||
// for this material
|
||||
if(mShader) {
|
||||
if(mShader->ob_refcnt > 1) {
|
||||
Py_DECREF(mShader);
|
||||
}
|
||||
else {
|
||||
delete mShader;
|
||||
mShader=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Format(PyExc_ValueError, "GLSL Error");
|
||||
return NULL;
|
||||
|
||||
#else
|
||||
Py_Return;
|
||||
#endif//GL_ARB_shader_objects
|
||||
@@ -947,3 +1011,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,10 @@ private:
|
||||
KX_Scene* mScene;
|
||||
BL_Texture mTextures[MAXTEX]; // texture array
|
||||
|
||||
bool mUserDefBlend;
|
||||
unsigned int mBlendFunc[2];
|
||||
bool mModified;
|
||||
|
||||
// message centers
|
||||
void setTexData( bool enable );
|
||||
void setShaderData( bool enable );
|
||||
@@ -90,7 +95,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
|
||||
|
||||
@@ -127,8 +127,10 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
|
||||
|
||||
m_firstframe(true),
|
||||
|
||||
m_previoustime(0.0),
|
||||
m_deltatime(0.0),
|
||||
m_frameTime(0.f),
|
||||
m_clockTime(0.f),
|
||||
m_previousClockTime(0.f),
|
||||
|
||||
|
||||
m_exitcode(KX_EXIT_REQUEST_NO_REQUEST),
|
||||
m_exitstring(""),
|
||||
@@ -258,13 +260,19 @@ void KX_KetsjiEngine::SetSceneConverter(KX_ISceneConverter* sceneconverter)
|
||||
*/
|
||||
void KX_KetsjiEngine::StartEngine()
|
||||
{
|
||||
m_previoustime = m_kxsystem->GetTimeInSeconds();
|
||||
m_clockTime = m_kxsystem->GetTimeInSeconds();
|
||||
m_frameTime = m_kxsystem->GetTimeInSeconds();
|
||||
m_previousClockTime = m_kxsystem->GetTimeInSeconds();
|
||||
|
||||
m_firstframe = true;
|
||||
m_bInitialized = true;
|
||||
m_ticrate = DEFAULT_LOGIC_TIC_RATE;
|
||||
m_currentFrame = 0;
|
||||
|
||||
if (m_game2ipo)
|
||||
{
|
||||
m_sceneconverter->ResetPhysicsObjectsAnimationIpo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -317,33 +325,32 @@ void KX_KetsjiEngine::EndFrame()
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include "PIL_time.h"
|
||||
|
||||
void KX_KetsjiEngine::NextFrame()
|
||||
{
|
||||
m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true);
|
||||
|
||||
double curtime;
|
||||
if (m_bFixedTime)
|
||||
curtime = m_previoustime + 1.0/m_ticrate;
|
||||
m_clockTime += 1.0/m_ticrate;
|
||||
else
|
||||
curtime = m_kxsystem->GetTimeInSeconds();
|
||||
m_deltatime += curtime - m_previoustime;
|
||||
float realDeltaTime = curtime - m_previoustime;
|
||||
m_clockTime = m_kxsystem->GetTimeInSeconds();
|
||||
|
||||
|
||||
double localtime = curtime - m_deltatime;
|
||||
double deltatime = m_clockTime - m_frameTime;
|
||||
|
||||
// Compute the number of logic frames to do each update (fixed tic bricks)
|
||||
int frames = (int) (m_deltatime*m_ticrate);
|
||||
m_deltatime -= double(frames)/m_ticrate;
|
||||
int frames =int(deltatime*m_ticrate);
|
||||
|
||||
// if (!frames)
|
||||
// PIL_sleep_ms(4);
|
||||
|
||||
KX_SceneList::iterator sceneit;
|
||||
|
||||
while (frames)
|
||||
{
|
||||
|
||||
localtime += 1.0/m_ticrate;
|
||||
m_frameTime += 1.0/m_ticrate;
|
||||
|
||||
for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit)
|
||||
// for each scene, call the proceed functions
|
||||
{
|
||||
@@ -361,15 +368,15 @@ void KX_KetsjiEngine::NextFrame()
|
||||
// if the scene was suspended recalcutlate the delta tu "curtime"
|
||||
m_suspendedtime = scene->getSuspendedTime();
|
||||
if (scene->getSuspendedTime()!=0.0)
|
||||
scene->setSuspendedDelta(scene->getSuspendedDelta()+curtime-scene->getSuspendedTime());
|
||||
scene->setSuspendedDelta(scene->getSuspendedDelta()+m_clockTime-scene->getSuspendedTime());
|
||||
m_suspendeddelta = scene->getSuspendedDelta();
|
||||
|
||||
|
||||
m_logger->StartLog(tc_network, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->GetNetworkScene()->proceed(localtime);
|
||||
scene->GetNetworkScene()->proceed(m_frameTime);
|
||||
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(localtime);
|
||||
scene->UpdateParents(m_frameTime);
|
||||
|
||||
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
|
||||
// set Python hooks for each scene
|
||||
@@ -381,35 +388,38 @@ void KX_KetsjiEngine::NextFrame()
|
||||
// Update scenegraph after physics step. This maps physics calculations
|
||||
// into node positions.
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(localtime);
|
||||
scene->UpdateParents(m_frameTime);
|
||||
|
||||
// Process sensors, and controllers
|
||||
m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->LogicBeginFrame(localtime);
|
||||
scene->LogicBeginFrame(m_frameTime);
|
||||
|
||||
// Scenegraph needs to be updated again, because Logic Controllers
|
||||
// can affect the local matrices.
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(localtime);
|
||||
scene->UpdateParents(m_frameTime);
|
||||
|
||||
// Process actuators
|
||||
|
||||
// Do some cleanup work for this logic frame
|
||||
m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->LogicUpdateFrame(localtime, true);
|
||||
scene->LogicUpdateFrame(m_frameTime, true);
|
||||
scene->LogicEndFrame();
|
||||
|
||||
// Actuators can affect the scenegraph
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(localtime);
|
||||
scene->UpdateParents(m_frameTime);
|
||||
|
||||
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->GetPhysicsEnvironment()->beginFrame();
|
||||
|
||||
// Perform physics calculations on the scene. This can involve
|
||||
// many iterations of the physics solver.
|
||||
scene->GetPhysicsEnvironment()->proceedDeltaTime(localtime,realDeltaTime);
|
||||
m_previoustime = curtime;
|
||||
scene->GetPhysicsEnvironment()->proceedDeltaTime(m_frameTime,1.0/m_ticrate);//m_deltatimerealDeltaTime);
|
||||
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(m_frameTime);
|
||||
|
||||
|
||||
if (m_game2ipo)
|
||||
{
|
||||
@@ -420,7 +430,7 @@ void KX_KetsjiEngine::NextFrame()
|
||||
} // suspended
|
||||
else
|
||||
if(scene->getSuspendedTime()==0.0)
|
||||
scene->setSuspendedTime(curtime);
|
||||
scene->setSuspendedTime(m_clockTime);
|
||||
|
||||
DoSound(scene);
|
||||
|
||||
@@ -447,6 +457,10 @@ void KX_KetsjiEngine::NextFrame()
|
||||
frames--;
|
||||
}
|
||||
|
||||
bool bUseAsyncLogicBricks= false;
|
||||
|
||||
if (bUseAsyncLogicBricks)
|
||||
{
|
||||
// Logic update sub frame: this will let some logic bricks run at the
|
||||
// full frame rate.
|
||||
for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); ++sceneit)
|
||||
@@ -459,7 +473,7 @@ void KX_KetsjiEngine::NextFrame()
|
||||
// if the scene was suspended recalcutlate the delta tu "curtime"
|
||||
m_suspendedtime = scene->getSuspendedTime();
|
||||
if (scene->getSuspendedTime()!=0.0)
|
||||
scene->setSuspendedDelta(scene->getSuspendedDelta()+curtime-scene->getSuspendedTime());
|
||||
scene->setSuspendedDelta(scene->getSuspendedDelta()+m_clockTime-scene->getSuspendedTime());
|
||||
m_suspendeddelta = scene->getSuspendedDelta();
|
||||
|
||||
// set Python hooks for each scene
|
||||
@@ -467,35 +481,39 @@ void KX_KetsjiEngine::NextFrame()
|
||||
PHY_SetActiveScene(scene);
|
||||
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(curtime);
|
||||
scene->UpdateParents(m_clockTime);
|
||||
|
||||
// Perform physics calculations on the scene. This can involve
|
||||
// many iterations of the physics solver.
|
||||
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->GetPhysicsEnvironment()->proceedDeltaTime(curtime,0.f);
|
||||
scene->GetPhysicsEnvironment()->proceedDeltaTime(m_clockTime,0.f);
|
||||
// Update scenegraph after physics step. This maps physics calculations
|
||||
// into node positions.
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(curtime);
|
||||
scene->UpdateParents(m_clockTime);
|
||||
|
||||
// Do some cleanup work for this logic frame
|
||||
m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->LogicUpdateFrame(curtime, false);
|
||||
scene->LogicUpdateFrame(m_clockTime, false);
|
||||
|
||||
// Actuators can affect the scenegraph
|
||||
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
|
||||
scene->UpdateParents(curtime);
|
||||
scene->UpdateParents(m_clockTime);
|
||||
|
||||
scene->setSuspendedTime(0.0);
|
||||
} // suspended
|
||||
else
|
||||
if(scene->getSuspendedTime()==0.0)
|
||||
scene->setSuspendedTime(curtime);
|
||||
scene->setSuspendedTime(m_clockTime);
|
||||
|
||||
DoSound(scene);
|
||||
|
||||
m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_previousClockTime = m_clockTime;
|
||||
|
||||
// Start logging time spend outside main loop
|
||||
m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true);
|
||||
|
||||
@@ -99,8 +99,10 @@ private:
|
||||
bool m_firstframe;
|
||||
int m_currentFrame;
|
||||
|
||||
double m_previoustime;
|
||||
double m_deltatime;
|
||||
double m_frameTime;//discrete timestamp of the 'game logic frame'
|
||||
double m_clockTime;//current time
|
||||
double m_previousClockTime;//previous clock time
|
||||
|
||||
static double m_ticrate;
|
||||
|
||||
static double m_suspendedtime;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
@@ -277,34 +278,69 @@ 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."));
|
||||
count = 1;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_vertex_shader
|
||||
pprint(" GL_ARB_vertex_shader supported? "<< (ext._ARB_vertex_shader? "yes.":"no."));
|
||||
support= ext._ARB_vertex_shader;
|
||||
pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no."));
|
||||
count = 1;
|
||||
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
|
||||
pprint(" GL_ARB_fragment_shader supported? "<< (ext._ARB_fragment_shader? "yes.":"no."));
|
||||
support=ext._ARB_fragment_shader;
|
||||
pprint(" GL_ARB_fragment_shader supported? "<< (support?"yes.":"no."));
|
||||
count = 1;
|
||||
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
|
||||
pprint(" GL_ARB_texture_cube_map supported? "<< (ext._ARB_texture_cube_map? "yes.":"no."));
|
||||
count = 1;
|
||||
#endif
|
||||
#ifdef GL_EXT_texture3D
|
||||
pprint(" GL_EXT_texture3D supported? "<< (ext._EXT_texture3D? "yes.":"no."));
|
||||
count = 1;
|
||||
#endif
|
||||
#ifdef GL_EXT_blend_color
|
||||
pprint(" GL_EXT_blend_color supported? "<< (ext._EXT_blend_color? "yes.":"no."));
|
||||
support = ext._ARB_texture_cube_map;
|
||||
pprint(" GL_ARB_texture_cube_map supported? "<< (support?"yes.":"no."));
|
||||
count = 1;
|
||||
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
|
||||
pprint(" GL_ARB_multitexture supported? "<< (ext._ARB_multitexture? "yes.":"no."));
|
||||
support = ext._ARB_multitexture;
|
||||
count = 1;
|
||||
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."));
|
||||
@@ -707,6 +743,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())
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ include nan_compile.mk
|
||||
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||
|
||||
CPPFLAGS += $(OGL_CPPFLAGS)
|
||||
CPPFLAGS += -I$(OPENGL_HEADERS)
|
||||
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) -I../../blender/python
|
||||
CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include
|
||||
|
||||
@@ -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,14 +301,28 @@ 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");
|
||||
|
||||
if (timeStep == 0.f)
|
||||
if (SimdFuzzyZero(timeStep))
|
||||
return true;
|
||||
|
||||
if (m_debugDrawer)
|
||||
@@ -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,16 +786,23 @@ 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;
|
||||
|
||||
if (!(i == m_p2pConstraints.end()) )
|
||||
//std::find(m_p2pConstraints.begin(), m_p2pConstraints.end(),
|
||||
// (Point2PointConstraint *)p2p);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -101,7 +101,7 @@ int DummyPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ct
|
||||
|
||||
}
|
||||
|
||||
void DummyPhysicsEnvironment::removeConstraint(void * constraintid)
|
||||
void DummyPhysicsEnvironment::removeConstraint(int constraintid)
|
||||
{
|
||||
if (constraintid)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ int SumoPhysicsEnvironment::createConstraint(
|
||||
return constraintid;
|
||||
}
|
||||
|
||||
void SumoPhysicsEnvironment::removeConstraint(void * constraintid)
|
||||
void SumoPhysicsEnvironment::removeConstraint(int constraintid)
|
||||
{
|
||||
if (constraintid)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -42,7 +42,9 @@ CPPFLAGS += -I$(OPENGL_HEADERS)
|
||||
CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I../../kernel/gen_system
|
||||
|
||||
ifeq ($(OS),darwin)
|
||||
CPPFLAGS += -fpascal-strings
|
||||
endif
|
||||
###############
|
||||
|
||||
SOURCEDIR = source/gameengine/Rasterizer
|
||||
|
||||
@@ -44,4 +44,6 @@ CPPFLAGS += -I$(NAN_STRING)/include
|
||||
CPPFLAGS += -I$(NAN_MOTO)/include
|
||||
CPPFLAGS += -I../../../kernel/gen_system
|
||||
CPPFLAGS += -I..
|
||||
|
||||
ifeq ($(OS),darwin)
|
||||
CPPFLAGS += -fpascal-strings
|
||||
endif
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# include <Carbon/Carbon.h>
|
||||
|
||||
# define GL_GLEXT_LEGACY 1
|
||||
# include <OpenGL/gl.h>
|
||||
|
||||
#else /* UNIX */
|
||||
@@ -322,88 +322,88 @@ BL_EXTInfo RAS_EXT_support;
|
||||
|
||||
#ifdef GL_ARB_multitexture
|
||||
int max_texture_units = 2;
|
||||
PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
|
||||
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
|
||||
PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB;
|
||||
PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB;
|
||||
PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB;
|
||||
PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB;
|
||||
PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB;
|
||||
PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB;
|
||||
PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB;
|
||||
PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB;
|
||||
PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB;
|
||||
PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB;
|
||||
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
|
||||
PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB;
|
||||
PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
|
||||
PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB;
|
||||
PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB;
|
||||
PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB;
|
||||
PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB;
|
||||
PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB;
|
||||
PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB;
|
||||
PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB;
|
||||
PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB;
|
||||
PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB;
|
||||
PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB;
|
||||
PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB;
|
||||
PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB;
|
||||
PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB;
|
||||
PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB;
|
||||
PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
|
||||
PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB;
|
||||
PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB;
|
||||
PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB;
|
||||
PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB;
|
||||
PFNGLACTIVETEXTUREARBPROC blActiveTextureARB;
|
||||
PFNGLCLIENTACTIVETEXTUREARBPROC blClientActiveTextureARB;
|
||||
PFNGLMULTITEXCOORD1DARBPROC blMultiTexCoord1dARB;
|
||||
PFNGLMULTITEXCOORD1DVARBPROC blMultiTexCoord1dvARB;
|
||||
PFNGLMULTITEXCOORD1FARBPROC blMultiTexCoord1fARB;
|
||||
PFNGLMULTITEXCOORD1FVARBPROC blMultiTexCoord1fvARB;
|
||||
PFNGLMULTITEXCOORD1IARBPROC blMultiTexCoord1iARB;
|
||||
PFNGLMULTITEXCOORD1IVARBPROC blMultiTexCoord1ivARB;
|
||||
PFNGLMULTITEXCOORD1SARBPROC blMultiTexCoord1sARB;
|
||||
PFNGLMULTITEXCOORD1SVARBPROC blMultiTexCoord1svARB;
|
||||
PFNGLMULTITEXCOORD2DARBPROC blMultiTexCoord2dARB;
|
||||
PFNGLMULTITEXCOORD2DVARBPROC blMultiTexCoord2dvARB;
|
||||
PFNGLMULTITEXCOORD2FARBPROC blMultiTexCoord2fARB;
|
||||
PFNGLMULTITEXCOORD2FVARBPROC blMultiTexCoord2fvARB;
|
||||
PFNGLMULTITEXCOORD2IARBPROC blMultiTexCoord2iARB;
|
||||
PFNGLMULTITEXCOORD2IVARBPROC blMultiTexCoord2ivARB;
|
||||
PFNGLMULTITEXCOORD2SARBPROC blMultiTexCoord2sARB;
|
||||
PFNGLMULTITEXCOORD2SVARBPROC blMultiTexCoord2svARB;
|
||||
PFNGLMULTITEXCOORD3DARBPROC blMultiTexCoord3dARB;
|
||||
PFNGLMULTITEXCOORD3DVARBPROC blMultiTexCoord3dvARB;
|
||||
PFNGLMULTITEXCOORD3FARBPROC blMultiTexCoord3fARB;
|
||||
PFNGLMULTITEXCOORD3FVARBPROC blMultiTexCoord3fvARB;
|
||||
PFNGLMULTITEXCOORD3IARBPROC blMultiTexCoord3iARB;
|
||||
PFNGLMULTITEXCOORD3IVARBPROC blMultiTexCoord3ivARB;
|
||||
PFNGLMULTITEXCOORD3SARBPROC blMultiTexCoord3sARB;
|
||||
PFNGLMULTITEXCOORD3SVARBPROC blMultiTexCoord3svARB;
|
||||
PFNGLMULTITEXCOORD4DARBPROC blMultiTexCoord4dARB;
|
||||
PFNGLMULTITEXCOORD4DVARBPROC blMultiTexCoord4dvARB;
|
||||
PFNGLMULTITEXCOORD4FARBPROC blMultiTexCoord4fARB;
|
||||
PFNGLMULTITEXCOORD4FVARBPROC blMultiTexCoord4fvARB;
|
||||
PFNGLMULTITEXCOORD4IARBPROC blMultiTexCoord4iARB;
|
||||
PFNGLMULTITEXCOORD4IVARBPROC blMultiTexCoord4ivARB;
|
||||
PFNGLMULTITEXCOORD4SARBPROC blMultiTexCoord4sARB;
|
||||
PFNGLMULTITEXCOORD4SVARBPROC blMultiTexCoord4svARB;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_shader_objects
|
||||
PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
|
||||
PFNGLGETHANDLEARBPROC glGetHandleARB;
|
||||
PFNGLDETACHOBJECTARBPROC glDetachObjectARB;
|
||||
PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
|
||||
PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
|
||||
PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
|
||||
PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
|
||||
PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
|
||||
PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
|
||||
PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
|
||||
PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB;
|
||||
PFNGLUNIFORM1FARBPROC glUniform1fARB;
|
||||
PFNGLUNIFORM2FARBPROC glUniform2fARB;
|
||||
PFNGLUNIFORM3FARBPROC glUniform3fARB;
|
||||
PFNGLUNIFORM4FARBPROC glUniform4fARB;
|
||||
PFNGLUNIFORM1IARBPROC glUniform1iARB;
|
||||
PFNGLUNIFORM2IARBPROC glUniform2iARB;
|
||||
PFNGLUNIFORM3IARBPROC glUniform3iARB;
|
||||
PFNGLUNIFORM4IARBPROC glUniform4iARB;
|
||||
PFNGLUNIFORM1FVARBPROC glUniform1fvARB;
|
||||
PFNGLUNIFORM2FVARBPROC glUniform2fvARB;
|
||||
PFNGLUNIFORM3FVARBPROC glUniform3fvARB;
|
||||
PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
|
||||
PFNGLUNIFORM1IVARBPROC glUniform1ivARB;
|
||||
PFNGLUNIFORM2IVARBPROC glUniform2ivARB;
|
||||
PFNGLUNIFORM3IVARBPROC glUniform3ivARB;
|
||||
PFNGLUNIFORM4IVARBPROC glUniform4ivARB;
|
||||
PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB;
|
||||
PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB;
|
||||
PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB;
|
||||
PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB;
|
||||
PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
|
||||
PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
|
||||
PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB;
|
||||
PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
|
||||
PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
|
||||
PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB;
|
||||
PFNGLGETUNIFORMIVARBPROC glGetUniformivARB;
|
||||
PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB;
|
||||
PFNGLDELETEOBJECTARBPROC blDeleteObjectARB;
|
||||
PFNGLGETHANDLEARBPROC blGetHandleARB;
|
||||
PFNGLDETACHOBJECTARBPROC blDetachObjectARB;
|
||||
PFNGLCREATESHADEROBJECTARBPROC blCreateShaderObjectARB;
|
||||
PFNGLSHADERSOURCEARBPROC blShaderSourceARB;
|
||||
PFNGLCOMPILESHADERARBPROC blCompileShaderARB;
|
||||
PFNGLCREATEPROGRAMOBJECTARBPROC blCreateProgramObjectARB;
|
||||
PFNGLATTACHOBJECTARBPROC blAttachObjectARB;
|
||||
PFNGLLINKPROGRAMARBPROC blLinkProgramARB;
|
||||
PFNGLUSEPROGRAMOBJECTARBPROC blUseProgramObjectARB;
|
||||
PFNGLVALIDATEPROGRAMARBPROC blValidateProgramARB;
|
||||
PFNGLUNIFORM1FARBPROC blUniform1fARB;
|
||||
PFNGLUNIFORM2FARBPROC blUniform2fARB;
|
||||
PFNGLUNIFORM3FARBPROC blUniform3fARB;
|
||||
PFNGLUNIFORM4FARBPROC blUniform4fARB;
|
||||
PFNGLUNIFORM1IARBPROC blUniform1iARB;
|
||||
PFNGLUNIFORM2IARBPROC blUniform2iARB;
|
||||
PFNGLUNIFORM3IARBPROC blUniform3iARB;
|
||||
PFNGLUNIFORM4IARBPROC blUniform4iARB;
|
||||
PFNGLUNIFORM1FVARBPROC blUniform1fvARB;
|
||||
PFNGLUNIFORM2FVARBPROC blUniform2fvARB;
|
||||
PFNGLUNIFORM3FVARBPROC blUniform3fvARB;
|
||||
PFNGLUNIFORM4FVARBPROC blUniform4fvARB;
|
||||
PFNGLUNIFORM1IVARBPROC blUniform1ivARB;
|
||||
PFNGLUNIFORM2IVARBPROC blUniform2ivARB;
|
||||
PFNGLUNIFORM3IVARBPROC blUniform3ivARB;
|
||||
PFNGLUNIFORM4IVARBPROC blUniform4ivARB;
|
||||
PFNGLUNIFORMMATRIX2FVARBPROC blUniformMatrix2fvARB;
|
||||
PFNGLUNIFORMMATRIX3FVARBPROC blUniformMatrix3fvARB;
|
||||
PFNGLUNIFORMMATRIX4FVARBPROC blUniformMatrix4fvARB;
|
||||
PFNGLGETOBJECTPARAMETERFVARBPROC blGetObjectParameterfvARB;
|
||||
PFNGLGETOBJECTPARAMETERIVARBPROC blGetObjectParameterivARB;
|
||||
PFNGLGETINFOLOGARBPROC blGetInfoLogARB;
|
||||
PFNGLGETATTACHEDOBJECTSARBPROC blGetAttachedObjectsARB;
|
||||
PFNGLGETUNIFORMLOCATIONARBPROC blGetUniformLocationARB;
|
||||
PFNGLGETACTIVEUNIFORMARBPROC blGetActiveUniformARB;
|
||||
PFNGLGETUNIFORMFVARBPROC blGetUniformfvARB;
|
||||
PFNGLGETUNIFORMIVARBPROC blGetUniformivARB;
|
||||
PFNGLGETSHADERSOURCEARBPROC blGetShaderSourceARB;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_vertex_shader
|
||||
PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
|
||||
PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB;
|
||||
PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
|
||||
PFNGLBINDATTRIBLOCATIONARBPROC blBindAttribLocationARB;
|
||||
PFNGLGETACTIVEATTRIBARBPROC blGetActiveAttribARB;
|
||||
PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB;
|
||||
#endif
|
||||
|
||||
} // namespace bgl
|
||||
@@ -464,41 +464,41 @@ static void LinkExtensions()
|
||||
#ifdef GL_ARB_multitexture
|
||||
if (QueryExtension("GL_ARB_multitexture"))
|
||||
{
|
||||
bgl::glActiveTextureARB = reinterpret_cast<PFNGLACTIVETEXTUREARBPROC>(bglGetProcAddress((const GLubyte *) "glActiveTextureARB"));
|
||||
bgl::glClientActiveTextureARB = reinterpret_cast<PFNGLCLIENTACTIVETEXTUREARBPROC>(bglGetProcAddress((const GLubyte *) "glClientActiveTextureARB"));
|
||||
bgl::glMultiTexCoord1dARB = reinterpret_cast<PFNGLMULTITEXCOORD1DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1dARB"));
|
||||
bgl::glMultiTexCoord1dvARB = reinterpret_cast<PFNGLMULTITEXCOORD1DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1dvARB"));
|
||||
bgl::glMultiTexCoord1fARB = reinterpret_cast<PFNGLMULTITEXCOORD1FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1fARB"));
|
||||
bgl::glMultiTexCoord1fvARB = reinterpret_cast<PFNGLMULTITEXCOORD1FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1fvARB"));
|
||||
bgl::glMultiTexCoord1iARB = reinterpret_cast<PFNGLMULTITEXCOORD1IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1iARB"));
|
||||
bgl::glMultiTexCoord1ivARB = reinterpret_cast<PFNGLMULTITEXCOORD1IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1ivARB"));
|
||||
bgl::glMultiTexCoord1sARB = reinterpret_cast<PFNGLMULTITEXCOORD1SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1sARB"));
|
||||
bgl::glMultiTexCoord1svARB = reinterpret_cast<PFNGLMULTITEXCOORD1SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1svARB"));
|
||||
bgl::glMultiTexCoord2dARB = reinterpret_cast<PFNGLMULTITEXCOORD2DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2dARB"));
|
||||
bgl::glMultiTexCoord2dvARB = reinterpret_cast<PFNGLMULTITEXCOORD2DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2dvARB"));
|
||||
bgl::glMultiTexCoord2fARB = reinterpret_cast<PFNGLMULTITEXCOORD2FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2fARB"));
|
||||
bgl::glMultiTexCoord2fvARB = reinterpret_cast<PFNGLMULTITEXCOORD2FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2fvARB"));
|
||||
bgl::glMultiTexCoord2iARB = reinterpret_cast<PFNGLMULTITEXCOORD2IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2iARB"));
|
||||
bgl::glMultiTexCoord2ivARB = reinterpret_cast<PFNGLMULTITEXCOORD2IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2ivARB"));
|
||||
bgl::glMultiTexCoord2sARB = reinterpret_cast<PFNGLMULTITEXCOORD2SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2sARB"));
|
||||
bgl::glMultiTexCoord2svARB = reinterpret_cast<PFNGLMULTITEXCOORD2SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2svARB"));
|
||||
bgl::glMultiTexCoord3dARB = reinterpret_cast<PFNGLMULTITEXCOORD3DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3dARB"));
|
||||
bgl::glMultiTexCoord3dvARB = reinterpret_cast<PFNGLMULTITEXCOORD3DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3dvARB"));
|
||||
bgl::glMultiTexCoord3fARB = reinterpret_cast<PFNGLMULTITEXCOORD3FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3fARB"));
|
||||
bgl::glMultiTexCoord3fvARB = reinterpret_cast<PFNGLMULTITEXCOORD3FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3fvARB"));
|
||||
bgl::glMultiTexCoord3iARB = reinterpret_cast<PFNGLMULTITEXCOORD3IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3iARB"));
|
||||
bgl::glMultiTexCoord3ivARB = reinterpret_cast<PFNGLMULTITEXCOORD3IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3ivARB"));
|
||||
bgl::glMultiTexCoord3sARB = reinterpret_cast<PFNGLMULTITEXCOORD3SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3sARB"));
|
||||
bgl::glMultiTexCoord3svARB = reinterpret_cast<PFNGLMULTITEXCOORD3SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3svARB"));
|
||||
bgl::glMultiTexCoord4dARB = reinterpret_cast<PFNGLMULTITEXCOORD4DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4dARB"));
|
||||
bgl::glMultiTexCoord4dvARB = reinterpret_cast<PFNGLMULTITEXCOORD4DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4dvARB"));
|
||||
bgl::glMultiTexCoord4fARB = reinterpret_cast<PFNGLMULTITEXCOORD4FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4fARB"));
|
||||
bgl::glMultiTexCoord4fvARB = reinterpret_cast<PFNGLMULTITEXCOORD4FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4fvARB"));
|
||||
bgl::glMultiTexCoord4iARB = reinterpret_cast<PFNGLMULTITEXCOORD4IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4iARB"));
|
||||
bgl::glMultiTexCoord4ivARB = reinterpret_cast<PFNGLMULTITEXCOORD4IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4ivARB"));
|
||||
bgl::glMultiTexCoord4sARB = reinterpret_cast<PFNGLMULTITEXCOORD4SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4sARB"));
|
||||
bgl::glMultiTexCoord4svARB = reinterpret_cast<PFNGLMULTITEXCOORD4SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4svARB"));
|
||||
if (bgl::glActiveTextureARB && bgl::glClientActiveTextureARB && bgl::glMultiTexCoord1dARB && bgl::glMultiTexCoord1dvARB && bgl::glMultiTexCoord1fARB && bgl::glMultiTexCoord1fvARB && bgl::glMultiTexCoord1iARB && bgl::glMultiTexCoord1ivARB && bgl::glMultiTexCoord1sARB && bgl::glMultiTexCoord1svARB && bgl::glMultiTexCoord2dARB && bgl::glMultiTexCoord2dvARB && bgl::glMultiTexCoord2fARB && bgl::glMultiTexCoord2fvARB && bgl::glMultiTexCoord2iARB && bgl::glMultiTexCoord2ivARB && bgl::glMultiTexCoord2sARB && bgl::glMultiTexCoord2svARB && bgl::glMultiTexCoord3dARB && bgl::glMultiTexCoord3dvARB && bgl::glMultiTexCoord3fARB && bgl::glMultiTexCoord3fvARB && bgl::glMultiTexCoord3iARB && bgl::glMultiTexCoord3ivARB && bgl::glMultiTexCoord3sARB && bgl::glMultiTexCoord3svARB && bgl::glMultiTexCoord4dARB && bgl::glMultiTexCoord4dvARB && bgl::glMultiTexCoord4fARB && bgl::glMultiTexCoord4fvARB && bgl::glMultiTexCoord4iARB && bgl::glMultiTexCoord4ivARB && bgl::glMultiTexCoord4sARB && bgl::glMultiTexCoord4svARB) {
|
||||
bgl::blActiveTextureARB = reinterpret_cast<PFNGLACTIVETEXTUREARBPROC>(bglGetProcAddress((const GLubyte *) "glActiveTextureARB"));
|
||||
bgl::blClientActiveTextureARB = reinterpret_cast<PFNGLCLIENTACTIVETEXTUREARBPROC>(bglGetProcAddress((const GLubyte *) "glClientActiveTextureARB"));
|
||||
bgl::blMultiTexCoord1dARB = reinterpret_cast<PFNGLMULTITEXCOORD1DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1dARB"));
|
||||
bgl::blMultiTexCoord1dvARB = reinterpret_cast<PFNGLMULTITEXCOORD1DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1dvARB"));
|
||||
bgl::blMultiTexCoord1fARB = reinterpret_cast<PFNGLMULTITEXCOORD1FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1fARB"));
|
||||
bgl::blMultiTexCoord1fvARB = reinterpret_cast<PFNGLMULTITEXCOORD1FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1fvARB"));
|
||||
bgl::blMultiTexCoord1iARB = reinterpret_cast<PFNGLMULTITEXCOORD1IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1iARB"));
|
||||
bgl::blMultiTexCoord1ivARB = reinterpret_cast<PFNGLMULTITEXCOORD1IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1ivARB"));
|
||||
bgl::blMultiTexCoord1sARB = reinterpret_cast<PFNGLMULTITEXCOORD1SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1sARB"));
|
||||
bgl::blMultiTexCoord1svARB = reinterpret_cast<PFNGLMULTITEXCOORD1SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord1svARB"));
|
||||
bgl::blMultiTexCoord2dARB = reinterpret_cast<PFNGLMULTITEXCOORD2DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2dARB"));
|
||||
bgl::blMultiTexCoord2dvARB = reinterpret_cast<PFNGLMULTITEXCOORD2DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2dvARB"));
|
||||
bgl::blMultiTexCoord2fARB = reinterpret_cast<PFNGLMULTITEXCOORD2FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2fARB"));
|
||||
bgl::blMultiTexCoord2fvARB = reinterpret_cast<PFNGLMULTITEXCOORD2FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2fvARB"));
|
||||
bgl::blMultiTexCoord2iARB = reinterpret_cast<PFNGLMULTITEXCOORD2IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2iARB"));
|
||||
bgl::blMultiTexCoord2ivARB = reinterpret_cast<PFNGLMULTITEXCOORD2IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2ivARB"));
|
||||
bgl::blMultiTexCoord2sARB = reinterpret_cast<PFNGLMULTITEXCOORD2SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2sARB"));
|
||||
bgl::blMultiTexCoord2svARB = reinterpret_cast<PFNGLMULTITEXCOORD2SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord2svARB"));
|
||||
bgl::blMultiTexCoord3dARB = reinterpret_cast<PFNGLMULTITEXCOORD3DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3dARB"));
|
||||
bgl::blMultiTexCoord3dvARB = reinterpret_cast<PFNGLMULTITEXCOORD3DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3dvARB"));
|
||||
bgl::blMultiTexCoord3fARB = reinterpret_cast<PFNGLMULTITEXCOORD3FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3fARB"));
|
||||
bgl::blMultiTexCoord3fvARB = reinterpret_cast<PFNGLMULTITEXCOORD3FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3fvARB"));
|
||||
bgl::blMultiTexCoord3iARB = reinterpret_cast<PFNGLMULTITEXCOORD3IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3iARB"));
|
||||
bgl::blMultiTexCoord3ivARB = reinterpret_cast<PFNGLMULTITEXCOORD3IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3ivARB"));
|
||||
bgl::blMultiTexCoord3sARB = reinterpret_cast<PFNGLMULTITEXCOORD3SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3sARB"));
|
||||
bgl::blMultiTexCoord3svARB = reinterpret_cast<PFNGLMULTITEXCOORD3SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord3svARB"));
|
||||
bgl::blMultiTexCoord4dARB = reinterpret_cast<PFNGLMULTITEXCOORD4DARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4dARB"));
|
||||
bgl::blMultiTexCoord4dvARB = reinterpret_cast<PFNGLMULTITEXCOORD4DVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4dvARB"));
|
||||
bgl::blMultiTexCoord4fARB = reinterpret_cast<PFNGLMULTITEXCOORD4FARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4fARB"));
|
||||
bgl::blMultiTexCoord4fvARB = reinterpret_cast<PFNGLMULTITEXCOORD4FVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4fvARB"));
|
||||
bgl::blMultiTexCoord4iARB = reinterpret_cast<PFNGLMULTITEXCOORD4IARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4iARB"));
|
||||
bgl::blMultiTexCoord4ivARB = reinterpret_cast<PFNGLMULTITEXCOORD4IVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4ivARB"));
|
||||
bgl::blMultiTexCoord4sARB = reinterpret_cast<PFNGLMULTITEXCOORD4SARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4sARB"));
|
||||
bgl::blMultiTexCoord4svARB = reinterpret_cast<PFNGLMULTITEXCOORD4SVARBPROC>(bglGetProcAddress((const GLubyte *) "glMultiTexCoord4svARB"));
|
||||
if (bgl::blActiveTextureARB && bgl::blClientActiveTextureARB && bgl::blMultiTexCoord1dARB && bgl::blMultiTexCoord1dvARB && bgl::blMultiTexCoord1fARB && bgl::blMultiTexCoord1fvARB && bgl::blMultiTexCoord1iARB && bgl::blMultiTexCoord1ivARB && bgl::blMultiTexCoord1sARB && bgl::blMultiTexCoord1svARB && bgl::blMultiTexCoord2dARB && bgl::blMultiTexCoord2dvARB && bgl::blMultiTexCoord2fARB && bgl::blMultiTexCoord2fvARB && bgl::blMultiTexCoord2iARB && bgl::blMultiTexCoord2ivARB && bgl::blMultiTexCoord2sARB && bgl::blMultiTexCoord2svARB && bgl::blMultiTexCoord3dARB && bgl::blMultiTexCoord3dvARB && bgl::blMultiTexCoord3fARB && bgl::blMultiTexCoord3fvARB && bgl::blMultiTexCoord3iARB && bgl::blMultiTexCoord3ivARB && bgl::blMultiTexCoord3sARB && bgl::blMultiTexCoord3svARB && bgl::blMultiTexCoord4dARB && bgl::blMultiTexCoord4dvARB && bgl::blMultiTexCoord4fARB && bgl::blMultiTexCoord4fvARB && bgl::blMultiTexCoord4iARB && bgl::blMultiTexCoord4ivARB && bgl::blMultiTexCoord4sARB && bgl::blMultiTexCoord4svARB) {
|
||||
EnableExtension(_GL_ARB_multitexture);
|
||||
RAS_EXT_support._ARB_multitexture = 1;
|
||||
if (doDebugMessages)
|
||||
@@ -509,49 +509,49 @@ static void LinkExtensions()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_shader_objects
|
||||
#if GL_ARB_shader_objects
|
||||
if (QueryExtension("GL_ARB_shader_objects"))
|
||||
{
|
||||
glDeleteObjectARB = reinterpret_cast<PFNGLDELETEOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glDeleteObjectARB"));
|
||||
glGetHandleARB = reinterpret_cast<PFNGLGETHANDLEARBPROC>(bglGetProcAddress((const GLubyte *) "glGetHandleARB"));
|
||||
glDetachObjectARB = reinterpret_cast<PFNGLDETACHOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glDetachObjectARB"));
|
||||
glCreateShaderObjectARB = reinterpret_cast<PFNGLCREATESHADEROBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glCreateShaderObjectARB"));
|
||||
glShaderSourceARB = reinterpret_cast<PFNGLSHADERSOURCEARBPROC>(bglGetProcAddress((const GLubyte *) "glShaderSourceARB"));
|
||||
glCompileShaderARB = reinterpret_cast<PFNGLCOMPILESHADERARBPROC>(bglGetProcAddress((const GLubyte *) "glCompileShaderARB"));
|
||||
glCreateProgramObjectARB = reinterpret_cast<PFNGLCREATEPROGRAMOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glCreateProgramObjectARB"));
|
||||
glAttachObjectARB = reinterpret_cast<PFNGLATTACHOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glAttachObjectARB"));
|
||||
glLinkProgramARB = reinterpret_cast<PFNGLLINKPROGRAMARBPROC>(bglGetProcAddress((const GLubyte *) "glLinkProgramARB"));
|
||||
glUseProgramObjectARB = reinterpret_cast<PFNGLUSEPROGRAMOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glUseProgramObjectARB"));
|
||||
glValidateProgramARB = reinterpret_cast<PFNGLVALIDATEPROGRAMARBPROC>(bglGetProcAddress((const GLubyte *) "glValidateProgramARB"));
|
||||
glUniform1fARB = reinterpret_cast<PFNGLUNIFORM1FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1fARB"));
|
||||
glUniform2fARB = reinterpret_cast<PFNGLUNIFORM2FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2fARB"));
|
||||
glUniform3fARB = reinterpret_cast<PFNGLUNIFORM3FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3fARB"));
|
||||
glUniform4fARB = reinterpret_cast<PFNGLUNIFORM4FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4fARB"));
|
||||
glUniform1iARB = reinterpret_cast<PFNGLUNIFORM1IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1iARB"));
|
||||
glUniform2iARB = reinterpret_cast<PFNGLUNIFORM2IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2iARB"));
|
||||
glUniform3iARB = reinterpret_cast<PFNGLUNIFORM3IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3iARB"));
|
||||
glUniform4iARB = reinterpret_cast<PFNGLUNIFORM4IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4iARB"));
|
||||
glUniform1fvARB = reinterpret_cast<PFNGLUNIFORM1FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1fvARB"));
|
||||
glUniform2fvARB = reinterpret_cast<PFNGLUNIFORM2FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2fvARB"));
|
||||
glUniform3fvARB = reinterpret_cast<PFNGLUNIFORM3FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3fvARB"));
|
||||
glUniform4fvARB = reinterpret_cast<PFNGLUNIFORM4FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4fvARB"));
|
||||
glUniform1ivARB = reinterpret_cast<PFNGLUNIFORM1IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1ivARB"));
|
||||
glUniform2ivARB = reinterpret_cast<PFNGLUNIFORM2IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2ivARB"));
|
||||
glUniform3ivARB = reinterpret_cast<PFNGLUNIFORM3IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3ivARB"));
|
||||
glUniform4ivARB = reinterpret_cast<PFNGLUNIFORM4IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4ivARB"));
|
||||
glUniformMatrix2fvARB = reinterpret_cast<PFNGLUNIFORMMATRIX2FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniformMatrix2fvARB"));
|
||||
glUniformMatrix3fvARB = reinterpret_cast<PFNGLUNIFORMMATRIX3FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniformMatrix3fvARB"));
|
||||
glUniformMatrix4fvARB = reinterpret_cast<PFNGLUNIFORMMATRIX4FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniformMatrix4fvARB"));
|
||||
glGetObjectParameterfvARB = reinterpret_cast<PFNGLGETOBJECTPARAMETERFVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetObjectParameterfvARB"));
|
||||
glGetObjectParameterivARB = reinterpret_cast<PFNGLGETOBJECTPARAMETERIVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetObjectParameterivARB"));
|
||||
glGetInfoLogARB = reinterpret_cast<PFNGLGETINFOLOGARBPROC>(bglGetProcAddress((const GLubyte *) "glGetInfoLogARB"));
|
||||
glGetAttachedObjectsARB = reinterpret_cast<PFNGLGETATTACHEDOBJECTSARBPROC>(bglGetProcAddress((const GLubyte *) "glGetAttachedObjectsARB"));
|
||||
glGetUniformLocationARB = reinterpret_cast<PFNGLGETUNIFORMLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glGetUniformLocationARB"));
|
||||
glGetActiveUniformARB = reinterpret_cast<PFNGLGETACTIVEUNIFORMARBPROC>(bglGetProcAddress((const GLubyte *) "glGetActiveUniformARB"));
|
||||
glGetUniformfvARB = reinterpret_cast<PFNGLGETUNIFORMFVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetUniformfvARB"));
|
||||
glGetUniformivARB = reinterpret_cast<PFNGLGETUNIFORMIVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetUniformivARB"));
|
||||
glGetShaderSourceARB = reinterpret_cast<PFNGLGETSHADERSOURCEARBPROC>(bglGetProcAddress((const GLubyte *) "glGetShaderSourceARB"));
|
||||
if (glDeleteObjectARB && glGetHandleARB && glDetachObjectARB && glCreateShaderObjectARB && glShaderSourceARB && glCompileShaderARB && glCreateProgramObjectARB && glAttachObjectARB && glLinkProgramARB && glUseProgramObjectARB && glValidateProgramARB && glUniform1fARB && glUniform2fARB && glUniform3fARB && glUniform4fARB && glUniform1iARB && glUniform2iARB && glUniform3iARB && glUniform4iARB && glUniform1fvARB && glUniform2fvARB && glUniform3fvARB && glUniform4fvARB && glUniform1ivARB && glUniform2ivARB && glUniform3ivARB && glUniform4ivARB && glUniformMatrix2fvARB && glUniformMatrix3fvARB && glUniformMatrix4fvARB && glGetObjectParameterfvARB && glGetObjectParameterivARB && glGetInfoLogARB && glGetAttachedObjectsARB && glGetUniformLocationARB && glGetActiveUniformARB && glGetUniformfvARB && glGetUniformivARB && glGetShaderSourceARB) {
|
||||
bgl::blDeleteObjectARB = reinterpret_cast<PFNGLDELETEOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glDeleteObjectARB"));
|
||||
bgl::blGetHandleARB = reinterpret_cast<PFNGLGETHANDLEARBPROC>(bglGetProcAddress((const GLubyte *) "glGetHandleARB"));
|
||||
bgl::blDetachObjectARB = reinterpret_cast<PFNGLDETACHOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glDetachObjectARB"));
|
||||
bgl::blCreateShaderObjectARB = reinterpret_cast<PFNGLCREATESHADEROBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glCreateShaderObjectARB"));
|
||||
bgl::blShaderSourceARB = reinterpret_cast<PFNGLSHADERSOURCEARBPROC>(bglGetProcAddress((const GLubyte *) "glShaderSourceARB"));
|
||||
bgl::blCompileShaderARB = reinterpret_cast<PFNGLCOMPILESHADERARBPROC>(bglGetProcAddress((const GLubyte *) "glCompileShaderARB"));
|
||||
bgl::blCreateProgramObjectARB = reinterpret_cast<PFNGLCREATEPROGRAMOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glCreateProgramObjectARB"));
|
||||
bgl::blAttachObjectARB = reinterpret_cast<PFNGLATTACHOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glAttachObjectARB"));
|
||||
bgl::blLinkProgramARB = reinterpret_cast<PFNGLLINKPROGRAMARBPROC>(bglGetProcAddress((const GLubyte *) "glLinkProgramARB"));
|
||||
bgl::blUseProgramObjectARB = reinterpret_cast<PFNGLUSEPROGRAMOBJECTARBPROC>(bglGetProcAddress((const GLubyte *) "glUseProgramObjectARB"));
|
||||
bgl::blValidateProgramARB = reinterpret_cast<PFNGLVALIDATEPROGRAMARBPROC>(bglGetProcAddress((const GLubyte *) "glValidateProgramARB"));
|
||||
bgl::blUniform1fARB = reinterpret_cast<PFNGLUNIFORM1FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1fARB"));
|
||||
bgl::blUniform2fARB = reinterpret_cast<PFNGLUNIFORM2FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2fARB"));
|
||||
bgl::blUniform3fARB = reinterpret_cast<PFNGLUNIFORM3FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3fARB"));
|
||||
bgl::blUniform4fARB = reinterpret_cast<PFNGLUNIFORM4FARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4fARB"));
|
||||
bgl::blUniform1iARB = reinterpret_cast<PFNGLUNIFORM1IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1iARB"));
|
||||
bgl::blUniform2iARB = reinterpret_cast<PFNGLUNIFORM2IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2iARB"));
|
||||
bgl::blUniform3iARB = reinterpret_cast<PFNGLUNIFORM3IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3iARB"));
|
||||
bgl::blUniform4iARB = reinterpret_cast<PFNGLUNIFORM4IARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4iARB"));
|
||||
bgl::blUniform1fvARB = reinterpret_cast<PFNGLUNIFORM1FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1fvARB"));
|
||||
bgl::blUniform2fvARB = reinterpret_cast<PFNGLUNIFORM2FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2fvARB"));
|
||||
bgl::blUniform3fvARB = reinterpret_cast<PFNGLUNIFORM3FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3fvARB"));
|
||||
bgl::blUniform4fvARB = reinterpret_cast<PFNGLUNIFORM4FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4fvARB"));
|
||||
bgl::blUniform1ivARB = reinterpret_cast<PFNGLUNIFORM1IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform1ivARB"));
|
||||
bgl::blUniform2ivARB = reinterpret_cast<PFNGLUNIFORM2IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform2ivARB"));
|
||||
bgl::blUniform3ivARB = reinterpret_cast<PFNGLUNIFORM3IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform3ivARB"));
|
||||
bgl::blUniform4ivARB = reinterpret_cast<PFNGLUNIFORM4IVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniform4ivARB"));
|
||||
bgl::blUniformMatrix2fvARB = reinterpret_cast<PFNGLUNIFORMMATRIX2FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniformMatrix2fvARB"));
|
||||
bgl::blUniformMatrix3fvARB = reinterpret_cast<PFNGLUNIFORMMATRIX3FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniformMatrix3fvARB"));
|
||||
bgl::blUniformMatrix4fvARB = reinterpret_cast<PFNGLUNIFORMMATRIX4FVARBPROC>(bglGetProcAddress((const GLubyte *) "glUniformMatrix4fvARB"));
|
||||
bgl::blGetObjectParameterfvARB = reinterpret_cast<PFNGLGETOBJECTPARAMETERFVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetObjectParameterfvARB"));
|
||||
bgl::blGetObjectParameterivARB = reinterpret_cast<PFNGLGETOBJECTPARAMETERIVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetObjectParameterivARB"));
|
||||
bgl::blGetInfoLogARB = reinterpret_cast<PFNGLGETINFOLOGARBPROC>(bglGetProcAddress((const GLubyte *) "glGetInfoLogARB"));
|
||||
bgl::blGetAttachedObjectsARB = reinterpret_cast<PFNGLGETATTACHEDOBJECTSARBPROC>(bglGetProcAddress((const GLubyte *) "glGetAttachedObjectsARB"));
|
||||
bgl::blGetUniformLocationARB = reinterpret_cast<PFNGLGETUNIFORMLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glGetUniformLocationARB"));
|
||||
bgl::blGetActiveUniformARB = reinterpret_cast<PFNGLGETACTIVEUNIFORMARBPROC>(bglGetProcAddress((const GLubyte *) "glGetActiveUniformARB"));
|
||||
bgl::blGetUniformfvARB = reinterpret_cast<PFNGLGETUNIFORMFVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetUniformfvARB"));
|
||||
bgl::blGetUniformivARB = reinterpret_cast<PFNGLGETUNIFORMIVARBPROC>(bglGetProcAddress((const GLubyte *) "glGetUniformivARB"));
|
||||
bgl::blGetShaderSourceARB = reinterpret_cast<PFNGLGETSHADERSOURCEARBPROC>(bglGetProcAddress((const GLubyte *) "glGetShaderSourceARB"));
|
||||
if (bgl::blDeleteObjectARB && bgl::blGetHandleARB && bgl::blDetachObjectARB && bgl::blCreateShaderObjectARB && bgl::blShaderSourceARB && bgl::blCompileShaderARB && bgl::blCreateProgramObjectARB && bgl::blAttachObjectARB && bgl::blLinkProgramARB && bgl::blUseProgramObjectARB && bgl::blValidateProgramARB && bgl::blUniform1fARB && bgl::blUniform2fARB && bgl::blUniform3fARB && bgl::blUniform4fARB && bgl::blUniform1iARB && bgl::blUniform2iARB && bgl::blUniform3iARB && bgl::blUniform4iARB && bgl::blUniform1fvARB && bgl::blUniform2fvARB && bgl::blUniform3fvARB && bgl::blUniform4fvARB && bgl::blUniform1ivARB && bgl::blUniform2ivARB && bgl::blUniform3ivARB && bgl::blUniform4ivARB && bgl::blUniformMatrix2fvARB && bgl::blUniformMatrix3fvARB && bgl::blUniformMatrix4fvARB && bgl::blGetObjectParameterfvARB && bgl::blGetObjectParameterivARB && bgl::blGetInfoLogARB && bgl::blGetAttachedObjectsARB && bgl::blGetUniformLocationARB && bgl::blGetActiveUniformARB && bgl::blGetUniformfvARB && bgl::blGetUniformivARB && bgl::blGetShaderSourceARB) {
|
||||
EnableExtension(_GL_ARB_shader_objects);
|
||||
RAS_EXT_support._ARB_shader_objects =1;
|
||||
if (doDebugMessages)
|
||||
@@ -562,13 +562,13 @@ static void LinkExtensions()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_vertex_shader
|
||||
#if GL_ARB_vertex_shader
|
||||
if (QueryExtension("GL_ARB_vertex_shader"))
|
||||
{
|
||||
glBindAttribLocationARB = reinterpret_cast<PFNGLBINDATTRIBLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glBindAttribLocationARB"));
|
||||
glGetActiveAttribARB = reinterpret_cast<PFNGLGETACTIVEATTRIBARBPROC>(bglGetProcAddress((const GLubyte *) "glGetActiveAttribARB"));
|
||||
glGetAttribLocationARB = reinterpret_cast<PFNGLGETATTRIBLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glGetAttribLocationARB"));
|
||||
if (glBindAttribLocationARB && glGetActiveAttribARB && glGetAttribLocationARB) {
|
||||
bgl::blBindAttribLocationARB = reinterpret_cast<PFNGLBINDATTRIBLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glBindAttribLocationARB"));
|
||||
bgl::blGetActiveAttribARB = reinterpret_cast<PFNGLGETACTIVEATTRIBARBPROC>(bglGetProcAddress((const GLubyte *) "glGetActiveAttribARB"));
|
||||
bgl::blGetAttribLocationARB = reinterpret_cast<PFNGLGETATTRIBLOCATIONARBPROC>(bglGetProcAddress((const GLubyte *) "glGetAttribLocationARB"));
|
||||
if (bgl::blBindAttribLocationARB && bgl::blGetActiveAttribARB && bgl::blGetAttribLocationARB) {
|
||||
EnableExtension(_GL_ARB_vertex_shader);
|
||||
RAS_EXT_support._ARB_vertex_shader = 1;
|
||||
if (doDebugMessages)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define __glext_h_
|
||||
# define GL_GLEXT_LEGACY 1
|
||||
# include <OpenGL/gl.h>
|
||||
# include <OpenGL/glu.h>
|
||||
# undef __glext_h_
|
||||
@@ -52,6 +53,7 @@
|
||||
#endif
|
||||
|
||||
#include "glext.h"
|
||||
|
||||
#include "EXT_separate_specular_color.h"
|
||||
#include "ARB_multitexture.h"
|
||||
namespace bgl
|
||||
@@ -379,8 +381,8 @@ namespace bgl
|
||||
void InitExtensions(int debug);
|
||||
|
||||
#if defined(PFNGLPNTRIANGLESIATIPROC)
|
||||
extern PFNGLPNTRIANGLESIATIPROC glPNTrianglesiATI;
|
||||
extern PFNGLPNTRIANGLESFATIPROC glPNTrianglesfATI;
|
||||
extern PFNGLPNTRIANGLESIATIPROC blPNTrianglesiATI;
|
||||
extern PFNGLPNTRIANGLESFATIPROC blPNTrianglesfATI;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -413,89 +415,89 @@ extern BL_EXTInfo RAS_EXT_support;
|
||||
|
||||
#ifdef GL_ARB_multitexture // defined in glext.h now...
|
||||
extern int max_texture_units;
|
||||
extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
|
||||
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB;
|
||||
extern PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB;
|
||||
extern PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB;
|
||||
extern PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB;
|
||||
extern PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB;
|
||||
extern PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB;
|
||||
extern PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB;
|
||||
extern PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB;
|
||||
extern PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB;
|
||||
extern PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB;
|
||||
extern PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB;
|
||||
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
|
||||
extern PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB;
|
||||
extern PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB;
|
||||
extern PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB;
|
||||
extern PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB;
|
||||
extern PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB;
|
||||
extern PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB;
|
||||
extern PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB;
|
||||
extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB;
|
||||
extern PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB;
|
||||
extern PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB;
|
||||
extern PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB;
|
||||
extern PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB;
|
||||
extern PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB;
|
||||
extern PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB;
|
||||
extern PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB;
|
||||
extern PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB;
|
||||
extern PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB;
|
||||
extern PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB;
|
||||
extern PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB;
|
||||
extern PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB;
|
||||
extern PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB;
|
||||
extern PFNGLACTIVETEXTUREARBPROC blActiveTextureARB;
|
||||
extern PFNGLCLIENTACTIVETEXTUREARBPROC blClientActiveTextureARB;
|
||||
extern PFNGLMULTITEXCOORD1DARBPROC blMultiTexCoord1dARB;
|
||||
extern PFNGLMULTITEXCOORD1DVARBPROC blMultiTexCoord1dvARB;
|
||||
extern PFNGLMULTITEXCOORD1FARBPROC blMultiTexCoord1fARB;
|
||||
extern PFNGLMULTITEXCOORD1FVARBPROC blMultiTexCoord1fvARB;
|
||||
extern PFNGLMULTITEXCOORD1IARBPROC blMultiTexCoord1iARB;
|
||||
extern PFNGLMULTITEXCOORD1IVARBPROC blMultiTexCoord1ivARB;
|
||||
extern PFNGLMULTITEXCOORD1SARBPROC blMultiTexCoord1sARB;
|
||||
extern PFNGLMULTITEXCOORD1SVARBPROC blMultiTexCoord1svARB;
|
||||
extern PFNGLMULTITEXCOORD2DARBPROC blMultiTexCoord2dARB;
|
||||
extern PFNGLMULTITEXCOORD2DVARBPROC blMultiTexCoord2dvARB;
|
||||
extern PFNGLMULTITEXCOORD2FARBPROC blMultiTexCoord2fARB;
|
||||
extern PFNGLMULTITEXCOORD2FVARBPROC blMultiTexCoord2fvARB;
|
||||
extern PFNGLMULTITEXCOORD2IARBPROC blMultiTexCoord2iARB;
|
||||
extern PFNGLMULTITEXCOORD2IVARBPROC blMultiTexCoord2ivARB;
|
||||
extern PFNGLMULTITEXCOORD2SARBPROC blMultiTexCoord2sARB;
|
||||
extern PFNGLMULTITEXCOORD2SVARBPROC blMultiTexCoord2svARB;
|
||||
extern PFNGLMULTITEXCOORD3DARBPROC blMultiTexCoord3dARB;
|
||||
extern PFNGLMULTITEXCOORD3DVARBPROC blMultiTexCoord3dvARB;
|
||||
extern PFNGLMULTITEXCOORD3FARBPROC blMultiTexCoord3fARB;
|
||||
extern PFNGLMULTITEXCOORD3FVARBPROC blMultiTexCoord3fvARB;
|
||||
extern PFNGLMULTITEXCOORD3IARBPROC blMultiTexCoord3iARB;
|
||||
extern PFNGLMULTITEXCOORD3IVARBPROC blMultiTexCoord3ivARB;
|
||||
extern PFNGLMULTITEXCOORD3SARBPROC blMultiTexCoord3sARB;
|
||||
extern PFNGLMULTITEXCOORD3SVARBPROC blMultiTexCoord3svARB;
|
||||
extern PFNGLMULTITEXCOORD4DARBPROC blMultiTexCoord4dARB;
|
||||
extern PFNGLMULTITEXCOORD4DVARBPROC blMultiTexCoord4dvARB;
|
||||
extern PFNGLMULTITEXCOORD4FARBPROC blMultiTexCoord4fARB;
|
||||
extern PFNGLMULTITEXCOORD4FVARBPROC blMultiTexCoord4fvARB;
|
||||
extern PFNGLMULTITEXCOORD4IARBPROC blMultiTexCoord4iARB;
|
||||
extern PFNGLMULTITEXCOORD4IVARBPROC blMultiTexCoord4ivARB;
|
||||
extern PFNGLMULTITEXCOORD4SARBPROC blMultiTexCoord4sARB;
|
||||
extern PFNGLMULTITEXCOORD4SVARBPROC blMultiTexCoord4svARB;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GL_ARB_shader_objects
|
||||
extern PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
|
||||
extern PFNGLGETHANDLEARBPROC glGetHandleARB;
|
||||
extern PFNGLDETACHOBJECTARBPROC glDetachObjectARB;
|
||||
extern PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
|
||||
extern PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
|
||||
extern PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
|
||||
extern PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
|
||||
extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
|
||||
extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
|
||||
extern PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
|
||||
extern PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARB;
|
||||
extern PFNGLUNIFORM1FARBPROC glUniform1fARB;
|
||||
extern PFNGLUNIFORM2FARBPROC glUniform2fARB;
|
||||
extern PFNGLUNIFORM3FARBPROC glUniform3fARB;
|
||||
extern PFNGLUNIFORM4FARBPROC glUniform4fARB;
|
||||
extern PFNGLUNIFORM1IARBPROC glUniform1iARB;
|
||||
extern PFNGLUNIFORM2IARBPROC glUniform2iARB;
|
||||
extern PFNGLUNIFORM3IARBPROC glUniform3iARB;
|
||||
extern PFNGLUNIFORM4IARBPROC glUniform4iARB;
|
||||
extern PFNGLUNIFORM1FVARBPROC glUniform1fvARB;
|
||||
extern PFNGLUNIFORM2FVARBPROC glUniform2fvARB;
|
||||
extern PFNGLUNIFORM3FVARBPROC glUniform3fvARB;
|
||||
extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
|
||||
extern PFNGLUNIFORM1IVARBPROC glUniform1ivARB;
|
||||
extern PFNGLUNIFORM2IVARBPROC glUniform2ivARB;
|
||||
extern PFNGLUNIFORM3IVARBPROC glUniform3ivARB;
|
||||
extern PFNGLUNIFORM4IVARBPROC glUniform4ivARB;
|
||||
extern PFNGLUNIFORMMATRIX2FVARBPROC glUniformMatrix2fvARB;
|
||||
extern PFNGLUNIFORMMATRIX3FVARBPROC glUniformMatrix3fvARB;
|
||||
extern PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB;
|
||||
extern PFNGLGETOBJECTPARAMETERFVARBPROC glGetObjectParameterfvARB;
|
||||
extern PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
|
||||
extern PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
|
||||
extern PFNGLGETATTACHEDOBJECTSARBPROC glGetAttachedObjectsARB;
|
||||
extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
|
||||
extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
|
||||
extern PFNGLGETUNIFORMFVARBPROC glGetUniformfvARB;
|
||||
extern PFNGLGETUNIFORMIVARBPROC glGetUniformivARB;
|
||||
extern PFNGLGETSHADERSOURCEARBPROC glGetShaderSourceARB;
|
||||
extern PFNGLDELETEOBJECTARBPROC blDeleteObjectARB;
|
||||
extern PFNGLGETHANDLEARBPROC blGetHandleARB;
|
||||
extern PFNGLDETACHOBJECTARBPROC blDetachObjectARB;
|
||||
extern PFNGLCREATESHADEROBJECTARBPROC blCreateShaderObjectARB;
|
||||
extern PFNGLSHADERSOURCEARBPROC blShaderSourceARB;
|
||||
extern PFNGLCOMPILESHADERARBPROC blCompileShaderARB;
|
||||
extern PFNGLCREATEPROGRAMOBJECTARBPROC blCreateProgramObjectARB;
|
||||
extern PFNGLATTACHOBJECTARBPROC blAttachObjectARB;
|
||||
extern PFNGLLINKPROGRAMARBPROC blLinkProgramARB;
|
||||
extern PFNGLUSEPROGRAMOBJECTARBPROC blUseProgramObjectARB;
|
||||
extern PFNGLVALIDATEPROGRAMARBPROC blValidateProgramARB;
|
||||
extern PFNGLUNIFORM1FARBPROC blUniform1fARB;
|
||||
extern PFNGLUNIFORM2FARBPROC blUniform2fARB;
|
||||
extern PFNGLUNIFORM3FARBPROC blUniform3fARB;
|
||||
extern PFNGLUNIFORM4FARBPROC blUniform4fARB;
|
||||
extern PFNGLUNIFORM1IARBPROC blUniform1iARB;
|
||||
extern PFNGLUNIFORM2IARBPROC blUniform2iARB;
|
||||
extern PFNGLUNIFORM3IARBPROC blUniform3iARB;
|
||||
extern PFNGLUNIFORM4IARBPROC blUniform4iARB;
|
||||
extern PFNGLUNIFORM1FVARBPROC blUniform1fvARB;
|
||||
extern PFNGLUNIFORM2FVARBPROC blUniform2fvARB;
|
||||
extern PFNGLUNIFORM3FVARBPROC blUniform3fvARB;
|
||||
extern PFNGLUNIFORM4FVARBPROC blUniform4fvARB;
|
||||
extern PFNGLUNIFORM1IVARBPROC blUniform1ivARB;
|
||||
extern PFNGLUNIFORM2IVARBPROC blUniform2ivARB;
|
||||
extern PFNGLUNIFORM3IVARBPROC blUniform3ivARB;
|
||||
extern PFNGLUNIFORM4IVARBPROC blUniform4ivARB;
|
||||
extern PFNGLUNIFORMMATRIX2FVARBPROC blUniformMatrix2fvARB;
|
||||
extern PFNGLUNIFORMMATRIX3FVARBPROC blUniformMatrix3fvARB;
|
||||
extern PFNGLUNIFORMMATRIX4FVARBPROC blUniformMatrix4fvARB;
|
||||
extern PFNGLGETOBJECTPARAMETERFVARBPROC blGetObjectParameterfvARB;
|
||||
extern PFNGLGETOBJECTPARAMETERIVARBPROC blGetObjectParameterivARB;
|
||||
extern PFNGLGETINFOLOGARBPROC blGetInfoLogARB;
|
||||
extern PFNGLGETATTACHEDOBJECTSARBPROC blGetAttachedObjectsARB;
|
||||
extern PFNGLGETUNIFORMLOCATIONARBPROC blGetUniformLocationARB;
|
||||
extern PFNGLGETACTIVEUNIFORMARBPROC blGetActiveUniformARB;
|
||||
extern PFNGLGETUNIFORMFVARBPROC blGetUniformfvARB;
|
||||
extern PFNGLGETUNIFORMIVARBPROC blGetUniformivARB;
|
||||
extern PFNGLGETSHADERSOURCEARBPROC blGetShaderSourceARB;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_vertex_shader
|
||||
extern PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB;
|
||||
extern PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB;
|
||||
extern PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB;
|
||||
extern PFNGLBINDATTRIBLOCATIONARBPROC blBindAttribLocationARB;
|
||||
extern PFNGLGETACTIVEATTRIBARBPROC blGetActiveAttribARB;
|
||||
extern PFNGLGETATTRIBLOCATIONARBPROC blGetAttribLocationARB;
|
||||
#endif
|
||||
|
||||
} /* namespace bgl */
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
@@ -1265,10 +1266,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1281,10 +1282,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1296,10 +1297,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1311,10 +1312,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1336,10 +1337,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1352,10 +1353,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1368,10 +1369,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1385,10 +1386,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1416,10 +1417,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1432,10 +1433,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1448,10 +1449,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1471,10 +1472,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1488,10 +1489,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1504,10 +1505,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti(
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1620,10 +1621,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1638,10 +1639,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1656,10 +1657,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1674,10 +1675,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1721,10 +1722,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1740,10 +1741,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1759,10 +1760,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
|
||||
@@ -1777,10 +1778,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1824,10 +1825,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1840,10 +1841,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1856,10 +1857,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1896,10 +1897,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1913,10 +1914,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
@@ -1930,10 +1931,10 @@ void RAS_OpenGLRasterizer::IndexPrimitivesMulti_Ex(const vecVertexArray & vertex
|
||||
if( vertexarray[(indexarray[vindex])].getFlag() & TV_2NDUV &&
|
||||
vertexarray[(indexarray[vindex])].getUnit() == unit )
|
||||
{
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV2());
|
||||
continue;
|
||||
}
|
||||
bgl::glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
bgl::blMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, vertexarray[(indexarray[vindex])].getUV1());
|
||||
}
|
||||
// ------------------------------
|
||||
glVertex3fv(vertexarray[(indexarray[vindex])].getLocalXYZ());
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <windows.h>
|
||||
#endif // WIN32
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY 1
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
|
||||
@@ -80,7 +80,7 @@ endif
|
||||
ifeq ($(OS),darwin)
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=7450
|
||||
CFLAGS += -pipe -fPIC -ffast-math -mcpu=7450 -mtune=G5
|
||||
CCFLAGS += -pipe -fPIC
|
||||
# REL_CFLAGS += -O2
|
||||
# REL_CCFLAGS += -O2
|
||||
|
||||
@@ -46,9 +46,6 @@ all debug::
|
||||
|
||||
# First generic defaults for all platforms which should be constant.
|
||||
# Note: ?= lets these defaults be overruled by environment variables,
|
||||
export NAN_NO_KETSJI=true
|
||||
export NAN_JUST_BLENDERDYNAMIC=true
|
||||
export NAN_NO_OPENAL=true
|
||||
export SRCHOME ?= $(NANBLENDERHOME)/source
|
||||
export CONFIG_GUESS := $(shell ${SRCHOME}/tools/guess/guessconfig)
|
||||
export OS := $(shell echo ${CONFIG_GUESS} | sed -e 's/-.*//')
|
||||
@@ -189,6 +186,9 @@ endif
|
||||
export NAN_SDLCFLAGS ?= -I$(NAN_SDL)/include
|
||||
export NAN_SDLLIBS ?= $(NAN_SDL)/lib/libSDL.a -framework Cocoa -framework IOKit
|
||||
|
||||
export NAN_NO_KETSJI=false
|
||||
|
||||
|
||||
# Uncomment the following line to use Mozilla inplace of netscape
|
||||
# CPPFLAGS +=-DMOZ_NOT_NET
|
||||
# Location of MOZILLA/Netscape header files...
|
||||
|
||||
Reference in New Issue
Block a user