Skip to content

Commit

Permalink
UPBGE: Rename RAS_[I]TexVert to RAS_[I]Vertex.
Browse files Browse the repository at this point in the history
The Tex prefix was clunky as this class managed all type of
mesh vertex.
  • Loading branch information
panzergame committed Sep 23, 2017
1 parent 1f074bf commit 64ad74a
Show file tree
Hide file tree
Showing 29 changed files with 117 additions and 117 deletions.
6 changes: 3 additions & 3 deletions source/gameengine/Converter/BL_BlenderDataConversion.cpp
Expand Up @@ -83,7 +83,7 @@

#include "RAS_ICanvas.h"
#include "RAS_Polygon.h"
#include "RAS_TexVert.h"
#include "RAS_Vertex.h"
#include "RAS_BucketManager.h"
#include "RAS_BoundingBoxManager.h"
#include "RAS_IPolygonMaterial.h"
Expand Down Expand Up @@ -338,7 +338,7 @@ SCA_IInputDevice::SCA_EnumInputs ConvertKeyCode(int key_code)
}

static void GetUvRgba(const RAS_MeshObject::LayerList& layers, unsigned int loop,
MT_Vector2 uvs[RAS_Texture::MaxUnits], unsigned int rgba[RAS_ITexVert::MAX_UNIT],
MT_Vector2 uvs[RAS_Texture::MaxUnits], unsigned int rgba[RAS_IVertex::MAX_UNIT],
unsigned short uvLayers, unsigned short colorLayers)
{
// No need to initialize layers to zero as all the converted layer are all the layers needed.
Expand Down Expand Up @@ -483,7 +483,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
meshobj->m_sharedvertex_map.resize(totverts);

// Initialize vertex format with used uv and color layers.
RAS_TexVertFormat vertformat;
RAS_VertexFormat vertformat;
vertformat.uvSize = max_ii(1, uvLayers);
vertformat.colorSize = max_ii(1, colorLayers);

Expand Down
16 changes: 8 additions & 8 deletions source/gameengine/Converter/BL_MeshDeformer.cpp
Expand Up @@ -62,8 +62,8 @@ bool BL_MeshDeformer::Apply(RAS_MeshMaterial *UNUSED(meshmat), RAS_IDisplayArray

// For each vertex
for (unsigned int i = 0, size = array->GetVertexCount(); i < size; ++i) {
RAS_ITexVert *v = array->GetVertex(i);
const RAS_TexVertInfo& vinfo = array->GetVertexInfo(i);
RAS_IVertex *v = array->GetVertex(i);
const RAS_VertexInfo& vinfo = array->GetVertexInfo(i);
v->SetXYZ(m_bmesh->mvert[vinfo.getOrigIndex()].co);
}

Expand Down Expand Up @@ -148,14 +148,14 @@ void BL_MeshDeformer::RecalcNormals()

for (unsigned int j = 0; j < numvert; ++j) {
const unsigned int index = poly->GetVertexOffset(j);
const RAS_TexVertInfo& vinfo = array->GetVertexInfo(index);
const RAS_VertexInfo& vinfo = array->GetVertexInfo(index);
const unsigned int origindex = vinfo.getOrigIndex();

co[j] = m_transverts[origindex];
indices[j] = index;
origindices[j] = origindex;

if (!(vinfo.getFlag() & RAS_TexVertInfo::FLAT)) {
if (!(vinfo.getFlag() & RAS_VertexInfo::FLAT)) {
flat = false;
}
}
Expand All @@ -171,7 +171,7 @@ void BL_MeshDeformer::RecalcNormals()
if (flat) {
MT_Vector3 normal(pnorm);
for (unsigned int j = 0; j < numvert; ++j) {
RAS_ITexVert *vert = array->GetVertex(indices[j]);
RAS_IVertex *vert = array->GetVertex(indices[j]);

vert->SetNormal(normal);
}
Expand All @@ -186,10 +186,10 @@ void BL_MeshDeformer::RecalcNormals()
// Assign smooth vertex normals.
for (RAS_IDisplayArray *array: m_displayArrayList) {
for (unsigned int i = 0, size = array->GetVertexCount(); i < size; ++i) {
RAS_ITexVert *v = array->GetVertex(i);
const RAS_TexVertInfo& vinfo = array->GetVertexInfo(i);
RAS_IVertex *v = array->GetVertex(i);
const RAS_VertexInfo& vinfo = array->GetVertexInfo(i);

if (!(vinfo.getFlag() & RAS_TexVertInfo::FLAT))
if (!(vinfo.getFlag() & RAS_VertexInfo::FLAT))
v->SetNormal(MT_Vector3(m_transnors[vinfo.getOrigIndex()])); //.safe_normalized()
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_SkinDeformer.cpp
Expand Up @@ -320,8 +320,8 @@ void BL_SkinDeformer::UpdateTransverts()
// for each vertex
// copy the untransformed data from the original mvert
for (unsigned int i = 0, size = array->GetVertexCount(); i < size; ++i) {
RAS_ITexVert *v = array->GetVertex(i);
const RAS_TexVertInfo& vinfo = array->GetVertexInfo(i);
RAS_IVertex *v = array->GetVertex(i);
const RAS_VertexInfo& vinfo = array->GetVertexInfo(i);
v->SetXYZ(m_transverts[vinfo.getOrigIndex()]);
if (m_copyNormals)
v->SetNormal(MT_Vector3(m_transnors[vinfo.getOrigIndex()]));
Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Ketsji/KX_MeshProxy.cpp
Expand Up @@ -175,7 +175,7 @@ PyObject *KX_MeshProxy::PyGetVertex(PyObject *args, PyObject *kwds)
return nullptr;
}

RAS_ITexVert *vertex = array->GetVertex(vertexindex);
RAS_IVertex *vertex = array->GetVertex(vertexindex);

return (new KX_VertexProxy(array, vertex))->NewProxy(true);
}
Expand Down Expand Up @@ -237,7 +237,7 @@ PyObject *KX_MeshProxy::PyTransform(PyObject *args, PyObject *kwds)
ok = true;

for (unsigned int j = 0, size = array->GetVertexCount(); j < size; ++j) {
RAS_ITexVert *vert = array->GetVertex(j);
RAS_IVertex *vert = array->GetVertex(j);
vert->Transform(transform, ntransform);
}

Expand Down Expand Up @@ -307,7 +307,7 @@ PyObject *KX_MeshProxy::PyTransformUV(PyObject *args, PyObject *kwds)
ok = true;

for (unsigned int j = 0, size = array->GetVertexCount(); j < size; ++j) {
RAS_ITexVert *vert = array->GetVertex(j);
RAS_IVertex *vert = array->GetVertex(j);
if (uvindex_from != -1) {
vert->SetUV(uvindex, vert->getUV(uvindex_from));
}
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Ketsji/KX_NavMeshObject.cpp
Expand Up @@ -31,7 +31,7 @@
#include "KX_NavMeshObject.h"
#include "RAS_MeshObject.h"
#include "RAS_Polygon.h"
#include "RAS_ITexVert.h"
#include "RAS_IVertex.h"

#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Ketsji/KX_SoftBodyDeformer.cpp
Expand Up @@ -106,8 +106,8 @@ bool KX_SoftBodyDeformer::Apply(RAS_MeshMaterial *meshmat, RAS_IDisplayArray *ar
MT_Vector3 aabbMax;

for (unsigned int i = 0, size = array->GetVertexCount(); i < size; ++i) {
RAS_ITexVert *v = array->GetVertex(i);
const RAS_TexVertInfo& vinfo = origarray->GetVertexInfo(i);
RAS_IVertex *v = array->GetVertex(i);
const RAS_VertexInfo& vinfo = origarray->GetVertexInfo(i);
/* The physics converter write the soft body index only in the original
* vertex array because at this moment it doesn't know which is the
* game object. It didn't cause any issues because it's always the same
Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Ketsji/KX_VertexProxy.cpp
Expand Up @@ -33,7 +33,7 @@

#include "KX_VertexProxy.h"
#include "KX_MeshProxy.h"
#include "RAS_ITexVert.h"
#include "RAS_IVertex.h"
#include "RAS_IDisplayArray.h"

#include "KX_PyMath.h"
Expand Down Expand Up @@ -537,7 +537,7 @@ int KX_VertexProxy::pyattr_set_normal(PyObjectPlus *self_v, const struct KX_PYAT
return PY_SET_ATTR_FAIL;
}

KX_VertexProxy::KX_VertexProxy(RAS_IDisplayArray *array, RAS_ITexVert *vertex)
KX_VertexProxy::KX_VertexProxy(RAS_IDisplayArray *array, RAS_IVertex *vertex)
:m_vertex(vertex),
m_array(array)
{
Expand All @@ -547,7 +547,7 @@ KX_VertexProxy::~KX_VertexProxy()
{
}

RAS_ITexVert *KX_VertexProxy::GetVertex()
RAS_IVertex *KX_VertexProxy::GetVertex()
{
return m_vertex;
}
Expand Down
8 changes: 4 additions & 4 deletions source/gameengine/Ketsji/KX_VertexProxy.h
Expand Up @@ -36,22 +36,22 @@

#include "EXP_Value.h"

class RAS_ITexVert;
class RAS_IVertex;
class RAS_IDisplayArray;

class KX_VertexProxy : public CValue
{
Py_Header

protected:
RAS_ITexVert *m_vertex;
RAS_IVertex *m_vertex;
RAS_IDisplayArray *m_array;

public:
KX_VertexProxy(RAS_IDisplayArray *array, RAS_ITexVert *vertex);
KX_VertexProxy(RAS_IDisplayArray *array, RAS_IVertex *vertex);
virtual ~KX_VertexProxy();

RAS_ITexVert *GetVertex();
RAS_IVertex *GetVertex();
RAS_IDisplayArray *GetDisplayArray();

// stuff for cvalue related things
Expand Down
8 changes: 4 additions & 4 deletions source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
Expand Up @@ -489,8 +489,8 @@ bool CcdPhysicsController::CreateSoftbody()
RAS_IDisplayArray *array = mmat->GetDisplayArray();

for (unsigned int i = 0, size = array->GetVertexCount(); i < size; ++i) {
RAS_ITexVert *vertex = array->GetVertex(i);
RAS_TexVertInfo& vertexInfo = array->GetVertexInfo(i);
RAS_IVertex *vertex = array->GetVertex(i);
RAS_VertexInfo& vertexInfo = array->GetVertexInfo(i);
//search closest index, and store it in vertex
vertexInfo.setSoftBodyIndex(0);
btScalar maxDistSqr = 1e30;
Expand Down Expand Up @@ -2282,7 +2282,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA
* */
// Note!, gameobj can be nullptr here

/* transverts are only used for deformed RAS_Meshes, the RAS_TexVert data
/* transverts are only used for deformed RAS_Meshes, the RAS_Vertex data
* is too hard to get at, see below for details */
float(*transverts)[3] = nullptr;
int transverts_tot = 0; // with deformed meshes - should always be greater than the max orginal index, or we get crashes
Expand Down Expand Up @@ -2345,7 +2345,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA
v_orig = poly->GetVertexInfo(*fv_pt).getOrigIndex();
if (vert_tag_array[v_orig]) {
if (transverts) {
/* deformed mesh, using RAS_TexVert locations would be too troublesome
/* deformed mesh, using RAS_Vertex locations would be too troublesome
* because they are use the gameob as a hash in the material slot */
*bt++ = transverts[v_orig][0];
*bt++ = transverts[v_orig][1];
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
Expand Up @@ -44,7 +44,7 @@
#include "BL_BlenderSceneConverter.h"
#include "RAS_MeshObject.h"
#include "RAS_Polygon.h"
#include "RAS_ITexVert.h"
#include "RAS_IVertex.h"

#include "DNA_scene_types.h"
#include "DNA_world_types.h"
Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Rasterizer/CMakeLists.txt
Expand Up @@ -70,7 +70,7 @@ set(SRC
RAS_InstancingBuffer.cpp
RAS_IPolygonMaterial.cpp
RAS_Rasterizer.cpp
RAS_ITexVert.cpp
RAS_IVertex.cpp
RAS_MaterialBucket.cpp
RAS_MeshMaterial.cpp
RAS_MeshObject.cpp
Expand Down Expand Up @@ -108,7 +108,7 @@ set(SRC
RAS_ILightObject.h
RAS_InstancingBuffer.h
RAS_ISync.h
RAS_ITexVert.h
RAS_IVertex.h
RAS_MaterialBucket.h
RAS_MeshMaterial.h
RAS_MeshObject.h
Expand All @@ -122,7 +122,7 @@ set(SRC
RAS_Texture.h
RAS_TextureRenderer.h
RAS_TextUser.h
RAS_TexVert.h
RAS_Vertex.h
)

data_to_c_simple(RAS_OpenGLFilters/RAS_Blur2DFilter.glsl SRC)
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Rasterizer/RAS_BatchDisplayArray.h
Expand Up @@ -47,7 +47,7 @@ class RAS_BatchDisplayArray : public RAS_DisplayArray<Vertex>, public RAS_IBatch
using RAS_DisplayArray<Vertex>::m_indices;

public:
RAS_BatchDisplayArray(RAS_IDisplayArray::PrimitiveType type, const RAS_TexVertFormat& format)
RAS_BatchDisplayArray(RAS_IDisplayArray::PrimitiveType type, const RAS_VertexFormat& format)
:RAS_IDisplayArray(type, format),
RAS_DisplayArray<Vertex>(type, format),
RAS_IBatchDisplayArray(type, format)
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Rasterizer/RAS_BoundingBox.cpp
Expand Up @@ -165,7 +165,7 @@ void RAS_MeshBoundingBox::Update(bool force)
RAS_IDisplayArray *displayArray = m_displayArrayList[i];
// For each vertex.
for (unsigned int j = 0, size = displayArray->GetVertexCount(); j < size; ++j) {
RAS_ITexVert *vert = displayArray->GetVertex(j);
RAS_IVertex *vert = displayArray->GetVertex(j);
const MT_Vector3 vertPos = vert->xyz();

// Initialize the AABB to the first vertex position.
Expand Down
16 changes: 8 additions & 8 deletions source/gameengine/Rasterizer/RAS_DisplayArray.h
Expand Up @@ -42,7 +42,7 @@ friend class RAS_BatchDisplayArray<Vertex>;
std::vector<Vertex> m_vertexes;

public:
RAS_DisplayArray(PrimitiveType type, const RAS_TexVertFormat& format)
RAS_DisplayArray(PrimitiveType type, const RAS_VertexFormat& format)
:RAS_IDisplayArray(type, format)
{
}
Expand Down Expand Up @@ -99,17 +99,17 @@ friend class RAS_BatchDisplayArray<Vertex>;
return Vertex::ColorSize;
}

virtual RAS_ITexVert *GetVertexNoCache(const unsigned int index) const
virtual RAS_IVertex *GetVertexNoCache(const unsigned int index) const
{
return (RAS_ITexVert *)&m_vertexes[index];
return (RAS_IVertex *)&m_vertexes[index];
}

virtual const RAS_ITexVert *GetVertexPointer() const
virtual const RAS_IVertex *GetVertexPointer() const
{
return (RAS_ITexVert *)m_vertexes.data();
return (RAS_IVertex *)m_vertexes.data();
}

virtual void AddVertex(RAS_ITexVert *vert)
virtual void AddVertex(RAS_IVertex *vert)
{
m_vertexes.push_back(*((Vertex *)vert));
}
Expand All @@ -119,7 +119,7 @@ friend class RAS_BatchDisplayArray<Vertex>;
return m_vertexes.size();
}

virtual RAS_ITexVert *CreateVertex(
virtual RAS_IVertex *CreateVertex(
const MT_Vector3& xyz,
const MT_Vector2 * const uvs,
const MT_Vector4& tangent,
Expand All @@ -134,7 +134,7 @@ friend class RAS_BatchDisplayArray<Vertex>;
const unsigned int size = GetVertexCount();
m_vertexPtrs.resize(size);
for (unsigned int i = 0; i < size; ++i) {
m_vertexPtrs[i] = (RAS_ITexVert *)&m_vertexes[i];
m_vertexPtrs[i] = (RAS_IVertex *)&m_vertexes[i];
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Rasterizer/RAS_IBatchDisplayArray.cpp
Expand Up @@ -26,7 +26,7 @@

#include "RAS_BatchDisplayArray.h"

RAS_IBatchDisplayArray::RAS_IBatchDisplayArray(PrimitiveType type, const RAS_TexVertFormat &format)
RAS_IBatchDisplayArray::RAS_IBatchDisplayArray(PrimitiveType type, const RAS_VertexFormat &format)
:RAS_IDisplayArray(type, format)
{
}
Expand All @@ -37,7 +37,7 @@ RAS_IBatchDisplayArray::~RAS_IBatchDisplayArray()

#define NEW_DISPLAY_ARRAY_UV(vertformat, uv, color, primtype) \
if (vertformat.uvSize == uv && vertformat.colorSize == color) { \
return new RAS_BatchDisplayArray<RAS_TexVert<uv, color> >(primtype, vertformat); \
return new RAS_BatchDisplayArray<RAS_Vertex<uv, color> >(primtype, vertformat); \
}

#define NEW_DISPLAY_ARRAY_COLOR(vertformat, color, primtype) \
Expand All @@ -50,7 +50,7 @@ RAS_IBatchDisplayArray::~RAS_IBatchDisplayArray()
NEW_DISPLAY_ARRAY_UV(format, 7, color, type); \
NEW_DISPLAY_ARRAY_UV(format, 8, color, type);

RAS_IBatchDisplayArray *RAS_IBatchDisplayArray::ConstructArray(RAS_IDisplayArray::PrimitiveType type, const RAS_TexVertFormat &format)
RAS_IBatchDisplayArray *RAS_IBatchDisplayArray::ConstructArray(RAS_IDisplayArray::PrimitiveType type, const RAS_VertexFormat &format)
{
NEW_DISPLAY_ARRAY_COLOR(format, 1, type);
NEW_DISPLAY_ARRAY_COLOR(format, 2, type);
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Rasterizer/RAS_IBatchDisplayArray.h
Expand Up @@ -49,14 +49,14 @@ class RAS_IBatchDisplayArray : public virtual RAS_IDisplayArray
std::vector<Part> m_parts;

public:
RAS_IBatchDisplayArray(PrimitiveType type, const RAS_TexVertFormat &format);
RAS_IBatchDisplayArray(PrimitiveType type, const RAS_VertexFormat &format);
virtual ~RAS_IBatchDisplayArray();

/** Construct the display array batching corresponding of the vertex of the given format.
* \param type The type of primitives, one of the enumeration PrimitiveType.
* \param format The format of vertex to use.
*/
static RAS_IBatchDisplayArray *ConstructArray(PrimitiveType type, const RAS_TexVertFormat &format);
static RAS_IBatchDisplayArray *ConstructArray(PrimitiveType type, const RAS_VertexFormat &format);

inline void *GetPartIndexOffset(const unsigned short index)
{
Expand Down

0 comments on commit 64ad74a

Please sign in to comment.