Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2012-05-29 11:12:12 +0400
committerMitchell Stokes <mogurijin@gmail.com>2012-05-29 11:12:12 +0400
commit0e98380bf45253a74fbd70c421105ce486acf58d (patch)
tree666a272594f7cf8bf39c0e4d74b313c3ed7300a1 /source/gameengine/Ketsji
parentb5b7455bad02064b2c19aa85222804184b236521 (diff)
Committing the VBO/Multi-UV patch from Cucumber. I'm putting this here since it still requires a little bit more work before going into trunk (according to Kupoman). However, I'd like to get the major Rasterizer restructuring for storage modes into this branch before people get too crazy with OpenGL refactoring. Also, I'll be making some changes to the converter soon that I hope to use the Multi-UV part of the patch to build from.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r--source/gameengine/Ketsji/BL_Action.cpp14
-rw-r--r--source/gameengine/Ketsji/BL_BlenderShader.cpp12
-rw-r--r--source/gameengine/Ketsji/BL_Material.cpp51
-rw-r--r--source/gameengine/Ketsji/BL_Material.h13
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp9
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp48
6 files changed, 60 insertions, 87 deletions
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 15be4c46894..0145a52d27e 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -41,6 +41,7 @@
extern "C" {
#include "BKE_animsys.h"
+#include "DNA_scene_types.h"
#include "BKE_action.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -445,4 +446,17 @@ void BL_Action::Update(float curtime)
m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD);
}
+
+ // check markers
+ TimeMarker *marker = (TimeMarker*)m_action->markers.first;
+
+ while (marker)
+ {
+ //printf("LocalTime: %d\n", (int)m_localtime);
+ if ((int)m_localtime == marker->frame)
+ {
+ printf("Hit marker: %s\n", marker->name);
+ }
+ marker = marker->next;
+ }
}
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp
index 122d692b599..a1f3ea64e1a 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.cpp
+++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp
@@ -93,21 +93,15 @@ void BL_BlenderShader::SetAttribs(RAS_IRasterizer* ras, const BL_Material *mat)
ras->SetTexCoordNum(0);
ras->SetAttribNum(attrib_num);
- for (i=0; i<attrib_num; i++)
+ for (i = 0; i < attrib_num; i++)
ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, i);
for (i = 0; i < attribs.totlayer; i++) {
if (attribs.layer[i].glindex > attrib_num)
continue;
- if (attribs.layer[i].type == CD_MTFACE) {
- if (!mat->uvName.IsEmpty() && strcmp(mat->uvName.ReadPtr(), attribs.layer[i].name) == 0)
- ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex);
- else if (!mat->uv2Name.IsEmpty() && strcmp(mat->uv2Name.ReadPtr(), attribs.layer[i].name) == 0)
- ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV2, attribs.layer[i].glindex);
- else
- ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex);
- }
+ if (attribs.layer[i].type == CD_MTFACE)
+ ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV, attribs.layer[i].glindex);
else if (attribs.layer[i].type == CD_TANGENT)
ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, attribs.layer[i].glindex);
else if (attribs.layer[i].type == CD_ORCO)
diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp
index 4c7518769e1..716d2ce6076 100644
--- a/source/gameengine/Ketsji/BL_Material.cpp
+++ b/source/gameengine/Ketsji/BL_Material.cpp
@@ -65,14 +65,14 @@ void BL_Material::Initialize()
num_users = 1;
share = false;
- int i;
- for (i=0; i<4; i++)
+ int i,j;
+ for (i = 0; i < 4; i++)
{
- uv[i] = MT_Point2(0.f,1.f);
- uv2[i] = MT_Point2(0.f, 1.f);
+ for (j = 0; j < MAXTEX; j++)
+ uvs[i][j] = MT_Point2(0.0,0.0);
}
- for (i=0; i<MAXTEX; i++) // :(
+ for (i = 0; i < MAXTEX; i++) // :(
{
mapping[i].mapping = 0;
mapping[i].offsets[0] = 0.f;
@@ -114,37 +114,24 @@ void BL_Material::GetConversionRGB(unsigned int *nrgb)
*nrgb = rgb[3];
}
-void BL_Material::SetConversionUV(const STR_String& name, MT_Point2 *nuv)
+void BL_Material::SetConversionUV(const MT_Point2 nuv[4][MAXTEX])
{
- uvName = name;
- uv[0] = *nuv++;
- uv[1] = *nuv++;
- uv[2] = *nuv++;
- uv[3] = *nuv;
-}
-
-void BL_Material::GetConversionUV(MT_Point2 *nuv)
-{
- *nuv++ = uv[0];
- *nuv++ = uv[1];
- *nuv++ = uv[2];
- *nuv = uv[3];
-}
-void BL_Material::SetConversionUV2(const STR_String& name, MT_Point2 *nuv)
-{
- uv2Name = name;
- uv2[0] = *nuv++;
- uv2[1] = *nuv++;
- uv2[2] = *nuv++;
- uv2[3] = *nuv;
+ int i, j;
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < MAXTEX; ++j)
+ uvs[i][j] = nuv[i][j];
+ }
}
-void BL_Material::GetConversionUV2(MT_Point2 *nuv)
+void BL_Material::GetConversionUV(MT_Point2 nuv[4][8])
{
- *nuv++ = uv2[0];
- *nuv++ = uv2[1];
- *nuv++ = uv2[2];
- *nuv = uv2[3];
+ int i, j;
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < MAXTEX; ++j)
+ nuv[i][j] = this->uvs[i][j];
+ }
}
diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h
index 70fd640a07e..0906b9653b4 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -89,20 +89,13 @@ public:
EnvMap* cubemap[MAXTEX];
unsigned int rgb[4];
- MT_Point2 uv[4];
- MT_Point2 uv2[4];
-
- STR_String uvName;
- STR_String uv2Name;
+ MT_Point2 uvs[4][MAXTEX];
void SetConversionRGB(unsigned int *rgb);
void GetConversionRGB(unsigned int *rgb);
- void SetConversionUV(const STR_String& name, MT_Point2 *uv);
- void GetConversionUV(MT_Point2 *uv);
-
- void SetConversionUV2(const STR_String& name, MT_Point2 *uv);
- void GetConversionUV2(MT_Point2 *uv);
+ void SetConversionUV(const MT_Point2 uv[4][MAXTEX]);
+ void GetConversionUV(MT_Point2 uv[4][MAXTEX]);
void SetSharedMaterial(bool v);
bool IsShared();
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 018a8d44cc1..8cf5b77df1a 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -639,13 +639,6 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const
for (int i=0; i<mMaterial->num_enabled; i++) {
int mode = mMaterial->mapping[i].mapping;
- if (mode &USECUSTOMUV)
- {
- if (!mMaterial->mapping[i].uvCoName.IsEmpty())
- ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV2, i);
- continue;
- }
-
if ( mode &(USEREFL|USEOBJ))
ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_GEN, i);
else if (mode &USEORCO)
@@ -653,7 +646,7 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const
else if (mode &USENORM)
ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_NORM, i);
else if (mode &USEUV)
- ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV1, i);
+ ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV, i);
else if (mode &USETANG)
ras->SetTexCoord(RAS_IRasterizer::RAS_TEXTANGENT, i);
else
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index d489c015273..03a398460b2 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -146,25 +146,25 @@ PyObject* KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *a
PyObject* KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyFloat_FromDouble(self->m_vertex->getUV1()[0]);
+ return PyFloat_FromDouble(self->m_vertex->getUV(0)[0]);
}
PyObject* KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyFloat_FromDouble(self->m_vertex->getUV1()[1]);
+ return PyFloat_FromDouble(self->m_vertex->getUV(0)[1]);
}
PyObject* KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyFloat_FromDouble(self->m_vertex->getUV2()[0]);
+ return PyFloat_FromDouble(self->m_vertex->getUV(1)[0]);
}
PyObject* KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyFloat_FromDouble(self->m_vertex->getUV2()[1]);
+ return PyFloat_FromDouble(self->m_vertex->getUV(1)[1]);
}
PyObject* KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -176,7 +176,7 @@ PyObject* KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF
PyObject* KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
{
KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyObjectFrom(MT_Point2(self->m_vertex->getUV1()));
+ return PyObjectFrom(MT_Point2(self->m_vertex->getUV(0)));
}
PyObject* KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
@@ -245,9 +245,9 @@ int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *
if (PyFloat_Check(value))
{
float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV1();
+ MT_Point2 uv = self->m_vertex->getUV(0);
uv[0] = val;
- self->m_vertex->SetUV(uv);
+ self->m_vertex->SetUV(0, uv);
self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
@@ -260,9 +260,9 @@ int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *
if (PyFloat_Check(value))
{
float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV1();
+ MT_Point2 uv = self->m_vertex->getUV(0);
uv[1] = val;
- self->m_vertex->SetUV(uv);
+ self->m_vertex->SetUV(0, uv);
self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
@@ -275,9 +275,9 @@ int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF
if (PyFloat_Check(value))
{
float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV2();
+ MT_Point2 uv = self->m_vertex->getUV(1);
uv[0] = val;
- self->m_vertex->SetUV2(uv);
+ self->m_vertex->SetUV(1, uv);
self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
@@ -290,9 +290,9 @@ int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF
if (PyFloat_Check(value))
{
float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV2();
+ MT_Point2 uv = self->m_vertex->getUV(1);
uv[1] = val;
- self->m_vertex->SetUV2(uv);
+ self->m_vertex->SetUV(1, uv);
self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
@@ -391,7 +391,7 @@ int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF
MT_Point2 vec;
if (PyVecTo(value, vec))
{
- self->m_vertex->SetUV(vec);
+ self->m_vertex->SetUV(0, vec);
self->m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
@@ -523,7 +523,7 @@ PyObject* KX_VertexProxy::PySetRGBA(PyObject* value)
PyObject* KX_VertexProxy::PyGetUV()
{
- return PyObjectFrom(MT_Vector2(m_vertex->getUV1()));
+ return PyObjectFrom(MT_Vector2(m_vertex->getUV(0)));
}
PyObject* KX_VertexProxy::PySetUV(PyObject* value)
@@ -532,31 +532,23 @@ PyObject* KX_VertexProxy::PySetUV(PyObject* value)
if (!PyVecTo(value, vec))
return NULL;
- m_vertex->SetUV(vec);
+ m_vertex->SetUV(0, vec);
m_mesh->SetMeshModified(true);
Py_RETURN_NONE;
}
PyObject* KX_VertexProxy::PyGetUV2()
{
- return PyObjectFrom(MT_Vector2(m_vertex->getUV2()));
+ return PyObjectFrom(MT_Vector2(m_vertex->getUV(1)));
}
-PyObject* KX_VertexProxy::PySetUV2(PyObject* args)
+PyObject* KX_VertexProxy::PySetUV2(PyObject* value)
{
MT_Point2 vec;
- unsigned int unit= RAS_TexVert::SECOND_UV;
-
- PyObject* list= NULL;
- if (!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit))
- return NULL;
-
- if (!PyVecTo(list, vec))
+ if (!PyVecTo(value, vec))
return NULL;
- m_vertex->SetFlag((m_vertex->getFlag()|RAS_TexVert::SECOND_UV));
- m_vertex->SetUnit(unit);
- m_vertex->SetUV2(vec);
+ m_vertex->SetUV(1, vec);
m_mesh->SetMeshModified(true);
Py_RETURN_NONE;
}