Skip to content

Commit

Permalink
UPBGE: Rename RAS_MeshObject to RAS_Mesh.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Dec 22, 2017
1 parent 3aa9b76 commit a3957d7
Show file tree
Hide file tree
Showing 71 changed files with 237 additions and 237 deletions.
18 changes: 9 additions & 9 deletions source/gameengine/Converter/BL_BlenderConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "KX_Scene.h"
#include "KX_GameObject.h"
#include "KX_WorldInfo.h"
#include "RAS_MeshObject.h"
#include "RAS_Mesh.h"
#include "RAS_BucketManager.h"
#include "KX_PhysicsEngineEnums.h"
#include "KX_KetsjiEngine.h"
Expand Down Expand Up @@ -118,7 +118,7 @@ void BL_BlenderConverter::SceneSlot::Merge(const BL_BlenderSceneConverter& conve
for (KX_BlenderMaterial *mat : converter.m_materials) {
m_materials.emplace_back(mat);
}
for (RAS_MeshObject *meshobj : converter.m_meshobjects) {
for (RAS_Mesh *meshobj : converter.m_meshobjects) {
m_meshobjects.emplace_back(meshobj);
}
for (BL_ConvertObjectInfo *info : converter.m_objectInfos) {
Expand Down Expand Up @@ -474,7 +474,7 @@ KX_LibLoadStatus *BL_BlenderConverter::LinkBlendFile(BlendHandle *blendlib, cons
if (options & LIB_LOAD_VERBOSE) {
CM_Debug("mesh name: " << mesh->name + 2);
}
RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, nullptr, scene_merge, sceneConverter);
RAS_Mesh *meshobj = BL_ConvertMesh((Mesh *)mesh, nullptr, scene_merge, sceneConverter);
scene_merge->GetLogicManager()->RegisterMeshName(meshobj->GetName(), meshobj);
}

Expand Down Expand Up @@ -608,7 +608,7 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie)
// in case the mesh might be refered to later
std::map<std::string, void *> &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap();
for (std::map<std::string, void *>::iterator it = mapStringToMeshes.begin(), end = mapStringToMeshes.end(); it != end;) {
RAS_MeshObject *meshobj = (RAS_MeshObject *)it->second;
RAS_Mesh *meshobj = (RAS_Mesh *)it->second;
if (meshobj && IS_TAGGED(meshobj->GetMesh())) {
it = mapStringToMeshes.erase(it);
}
Expand Down Expand Up @@ -655,7 +655,7 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie)
gameobj->RemoveTaggedActions();
// free the mesh, we could be referecing a linked one!

for (RAS_MeshObject *meshobj : gameobj->GetMeshList()) {
for (RAS_Mesh *meshobj : gameobj->GetMeshList()) {
if (IS_TAGGED(meshobj->GetMesh())) {
gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */
break;
Expand Down Expand Up @@ -690,8 +690,8 @@ bool BL_BlenderConverter::FreeBlendFile(Main *maggie)
KX_Scene *scene = sit->first;
SceneSlot& sceneSlot = sit->second;

for (UniquePtrList<RAS_MeshObject>::iterator it = sceneSlot.m_meshobjects.begin(); it != sceneSlot.m_meshobjects.end(); ) {
RAS_MeshObject *mesh = (*it).get();
for (UniquePtrList<RAS_Mesh>::iterator it = sceneSlot.m_meshobjects.begin(); it != sceneSlot.m_meshobjects.end(); ) {
RAS_Mesh *mesh = (*it).get();
if (IS_TAGGED(mesh->GetMesh())) {
it = sceneSlot.m_meshobjects.erase(it);
}
Expand Down Expand Up @@ -758,7 +758,7 @@ void BL_BlenderConverter::MergeScene(KX_Scene *to, KX_Scene *from)

/** This function merges a mesh from the current scene into another main
* it does not convert */
RAS_MeshObject *BL_BlenderConverter::ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name)
RAS_Mesh *BL_BlenderConverter::ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name)
{
// Find a mesh in the current main */
ID *me = static_cast<ID *>(BLI_findstring(&m_maggie->mesh, name.c_str(), offsetof(ID, name) + 2));
Expand Down Expand Up @@ -832,7 +832,7 @@ RAS_MeshObject *BL_BlenderConverter::ConvertMeshSpecial(KX_Scene *kx_scene, Main

BL_BlenderSceneConverter sceneConverter(kx_scene);

RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)me, nullptr, kx_scene, sceneConverter);
RAS_Mesh *meshobj = BL_ConvertMesh((Mesh *)me, nullptr, kx_scene, sceneConverter);
kx_scene->GetLogicManager()->RegisterMeshName(meshobj->GetName(), meshobj);

// Finalize material and mesh conversion.
Expand Down
8 changes: 4 additions & 4 deletions source/gameengine/Converter/BL_BlenderConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#ifdef _MSC_VER // MSVC doesn't support incomplete type in std::unique_ptr.
# include "KX_BlenderMaterial.h"
# include "RAS_MeshObject.h"
# include "RAS_Mesh.h"
# include "BL_ConvertObjectInfo.h"
# include "BL_BlenderScalarInterpolator.h"
#endif
Expand All @@ -53,7 +53,7 @@ class KX_BlenderMaterial;
class BL_InterpolatorList;
class SCA_IActuator;
class SCA_IController;
class RAS_MeshObject;
class RAS_Mesh;
struct Main;
struct BlendHandle;
struct Mesh;
Expand All @@ -74,7 +74,7 @@ class BL_BlenderConverter
{
public:
UniquePtrList<KX_BlenderMaterial> m_materials;
UniquePtrList<RAS_MeshObject> m_meshobjects;
UniquePtrList<RAS_Mesh> m_meshobjects;
UniquePtrList<BL_InterpolatorList> m_interpolators;
UniquePtrList<BL_ConvertObjectInfo> m_objectInfos;

Expand Down Expand Up @@ -148,7 +148,7 @@ class BL_BlenderConverter
bool FreeBlendFile(Main *maggie);
bool FreeBlendFile(const std::string& path);

RAS_MeshObject *ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name);
RAS_Mesh *ConvertMeshSpecial(KX_Scene *kx_scene, Main *maggie, const std::string& name);

void MergeScene(KX_Scene *to, KX_Scene *from);

Expand Down
36 changes: 18 additions & 18 deletions source/gameengine/Converter/BL_BlenderDataConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# include "CcdGraphicController.h"
#endif

#include "RAS_MeshObject.h"
#include "RAS_Mesh.h"
#include "RAS_Rasterizer.h"
#include "RAS_ILightObject.h"

Expand Down Expand Up @@ -343,13 +343,13 @@ SCA_IInputDevice::SCA_EnumInputs BL_ConvertKeyCode(int key_code)
return gReverseKeyTranslateTable[key_code];
}

static void BL_GetUvRgba(const RAS_MeshObject::LayersInfo& layersInfo, std::vector<MLoopUV *>& uvLayers,
static void BL_GetUvRgba(const RAS_Mesh::LayersInfo& layersInfo, std::vector<MLoopUV *>& uvLayers,
std::vector<MLoopCol *>& colorLayers, unsigned int loop, float uvs[RAS_Texture::MaxUnits][2],
unsigned int rgba[RAS_Vertex::MAX_UNIT])
{
// No need to initialize layers to zero as all the converted layer are all the layers needed.

for (const RAS_MeshObject::Layer& layer : layersInfo.colorLayers) {
for (const RAS_Mesh::Layer& layer : layersInfo.colorLayers) {
const unsigned short index = layer.index;
const MLoopCol& col = colorLayers[index][loop];

Expand All @@ -364,7 +364,7 @@ static void BL_GetUvRgba(const RAS_MeshObject::LayersInfo& layersInfo, std::vect
rgba[index] = con.val;
}

for (const RAS_MeshObject::Layer& layer : layersInfo.uvLayers) {
for (const RAS_Mesh::Layer& layer : layersInfo.uvLayers) {
const unsigned short index = layer.index;
const MLoopUV& uv = uvLayers[index][loop];
copy_v2_v2(uvs[index], uv.uv);
Expand Down Expand Up @@ -408,9 +408,9 @@ static RAS_MaterialBucket *BL_ConvertMaterial(Material *ma, int lightlayer, KX_S
}

/* blenderobj can be nullptr, make sure its checked for */
RAS_MeshObject *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL_BlenderSceneConverter& converter)
RAS_Mesh *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL_BlenderSceneConverter& converter)
{
RAS_MeshObject *meshobj;
RAS_Mesh *meshobj;
const int lightlayer = blenderobj ? blenderobj->lay : (1 << 20) - 1; // all layers if no object.

// Without checking names, we get some reuse we don't want that can cause
Expand All @@ -433,7 +433,7 @@ RAS_MeshObject *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL
const unsigned short uvCount = CustomData_number_of_layers(&dm->loopData, CD_MLOOPUV);
const unsigned short colorCount = CustomData_number_of_layers(&dm->loopData, CD_MLOOPCOL);

RAS_MeshObject::LayersInfo layersInfo;
RAS_Mesh::LayersInfo layersInfo;
layersInfo.activeUv = (activeUv == -1) ? 0 : activeUv;
layersInfo.activeColor = (activeColor == -1) ? 0 : activeColor;

Expand All @@ -453,7 +453,7 @@ RAS_MeshObject *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL
vertformat.uvSize = max_ii(1, uvCount);
vertformat.colorSize = max_ii(1, colorCount);

meshobj = new RAS_MeshObject(me, layersInfo);
meshobj = new RAS_Mesh(me, layersInfo);

const unsigned short totmat = max_ii(me->totcol, 1);
std::vector<BL_MeshMaterial> mats(totmat);
Expand Down Expand Up @@ -489,7 +489,7 @@ RAS_MeshObject *BL_ConvertMesh(Mesh *me, Object *blenderobj, KX_Scene *scene, BL
}

void BL_ConvertDerivedMeshToArray(DerivedMesh *dm, Mesh *me, const std::vector<BL_MeshMaterial>& mats,
const RAS_MeshObject::LayersInfo& layersInfo)
const RAS_Mesh::LayersInfo& layersInfo)
{
const MVert *mverts = dm->getVertArray(dm);
const int totverts = dm->getNumVerts(dm);
Expand Down Expand Up @@ -517,11 +517,11 @@ void BL_ConvertDerivedMeshToArray(DerivedMesh *dm, Mesh *me, const std::vector<B
// List of MLoopCol per color layer index.
std::vector<MLoopCol *> colorLayers(layersInfo.uvLayers.size());

for (const RAS_MeshObject::Layer& layer : layersInfo.uvLayers) {
for (const RAS_Mesh::Layer& layer : layersInfo.uvLayers) {
const unsigned short index = layer.index;
uvLayers[index] = (MLoopUV *)CustomData_get_layer_n(&dm->loopData, CD_MLOOPUV, index);
}
for (const RAS_MeshObject::Layer& layer : layersInfo.colorLayers) {
for (const RAS_Mesh::Layer& layer : layersInfo.colorLayers) {
const unsigned short index = layer.index;
colorLayers[index] = (MLoopCol *)CustomData_get_layer_n(&dm->loopData, CD_MLOOPCOL, index);
}
Expand Down Expand Up @@ -640,7 +640,7 @@ static void BL_CreateGraphicObjectNew(KX_GameObject *gameobj, KX_Scene *kxscene,
}
}

static void BL_CreatePhysicsObjectNew(KX_GameObject *gameobj, Object *blenderobject, RAS_MeshObject *meshobj,
static void BL_CreatePhysicsObjectNew(KX_GameObject *gameobj, Object *blenderobject, RAS_Mesh *meshobj,
KX_Scene *kxscene, int activeLayerBitInfo, BL_BlenderSceneConverter& converter, bool processCompoundChildren)

{
Expand Down Expand Up @@ -864,7 +864,7 @@ static KX_GameObject *BL_GameObjectFromBlenderObject(Object *ob, KX_Scene *kxsce
case OB_MESH:
{
Mesh *mesh = static_cast<Mesh *>(ob->data);
RAS_MeshObject *meshobj = BL_ConvertMesh(mesh, ob, kxscene, converter);
RAS_Mesh *meshobj = BL_ConvertMesh(mesh, ob, kxscene, converter);

// needed for python scripting
kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(), meshobj);
Expand Down Expand Up @@ -1144,7 +1144,7 @@ static void bl_ConvertBlenderObject_Single(BL_BlenderSceneConverter& converter,

// Needed for group duplication.
logicmgr->RegisterGameObj(blenderobject, gameobj);
for (RAS_MeshObject *meshobj : gameobj->GetMeshList()) {
for (RAS_Mesh *meshobj : gameobj->GetMeshList()) {
logicmgr->RegisterGameMeshName(meshobj->GetName(), blenderobject);
}

Expand Down Expand Up @@ -1538,8 +1538,8 @@ void BL_ConvertBlenderObjects(struct Main *maggie,
for (KX_GameObject *gameobj : sumolist) {
Object *blenderobject = gameobj->GetBlenderObject();

const std::vector<RAS_MeshObject *>& meshes = gameobj->GetMeshList();
RAS_MeshObject *meshobj = (meshes.empty()) ? nullptr : meshes.front();
const std::vector<RAS_Mesh *>& meshes = gameobj->GetMeshList();
RAS_Mesh *meshobj = (meshes.empty()) ? nullptr : meshes.front();

int layerMask = (groupobj.find(blenderobject) == groupobj.end()) ? activeLayerBitInfo : 0;
BL_CreatePhysicsObjectNew(gameobj, blenderobject, meshobj, kxscene, layerMask, converter, processCompoundChildren);
Expand All @@ -1548,7 +1548,7 @@ void BL_ConvertBlenderObjects(struct Main *maggie,

// Look at every material texture and ask to create realtime cube map.
for (KX_GameObject *gameobj : sumolist) {
for (RAS_MeshObject *mesh : gameobj->GetMeshList()) {
for (RAS_Mesh *mesh : gameobj->GetMeshList()) {
for (RAS_MeshMaterial *meshmat : mesh->GetMeshMaterialList()) {
RAS_IPolyMaterial *polymat = meshmat->GetBucket()->GetPolyMaterial();

Expand Down Expand Up @@ -1584,7 +1584,7 @@ void BL_ConvertBlenderObjects(struct Main *maggie,
Mesh *predifinedBoundMesh = blenderobject->gamePredefinedBound;

if (predifinedBoundMesh) {
RAS_MeshObject *meshobj = converter.FindGameMesh(predifinedBoundMesh);
RAS_Mesh *meshobj = converter.FindGameMesh(predifinedBoundMesh);
// In case of mesh taken in a other scene.
if (!meshobj) {
continue;
Expand Down
6 changes: 3 additions & 3 deletions source/gameengine/Converter/BL_BlenderDataConversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef __BL_BLENDERDATACONVERSION_H__
#define __BL_BLENDERDATACONVERSION_H__

#include "RAS_MeshObject.h"
#include "RAS_Mesh.h"
#include "KX_PhysicsEngineEnums.h"
#include "SCA_IInputDevice.h"

Expand All @@ -55,9 +55,9 @@ struct BL_MeshMaterial {
bool wire;
};

RAS_MeshObject *BL_ConvertMesh(Mesh *mesh, Object *lightobj, KX_Scene *scene, BL_BlenderSceneConverter& converter);
RAS_Mesh *BL_ConvertMesh(Mesh *mesh, Object *lightobj, KX_Scene *scene, BL_BlenderSceneConverter& converter);
void BL_ConvertDerivedMeshToArray(DerivedMesh *dm, Mesh *me, const std::vector<BL_MeshMaterial>& mats,
const RAS_MeshObject::LayersInfo& layersInfo);
const RAS_Mesh::LayersInfo& layersInfo);

void BL_ConvertBlenderObjects(Main *maggie, KX_Scene *kxscene, KX_KetsjiEngine *ketsjiEngine, e_PhysicsEngine physics_engine,
RAS_Rasterizer *rendertools, RAS_ICanvas *canvas, BL_BlenderSceneConverter& sceneconverter,
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_BlenderSceneConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ KX_GameObject *BL_BlenderSceneConverter::FindGameObject(Object *for_blenderobjec
return m_map_blender_to_gameobject[for_blenderobject];
}

void BL_BlenderSceneConverter::RegisterGameMesh(RAS_MeshObject *gamemesh, Mesh *for_blendermesh)
void BL_BlenderSceneConverter::RegisterGameMesh(RAS_Mesh *gamemesh, Mesh *for_blendermesh)
{
if (for_blendermesh) { // dynamically loaded meshes we don't want to keep lookups for
m_map_mesh_to_gamemesh[for_blendermesh] = gamemesh;
}
m_meshobjects.push_back(gamemesh);
}

RAS_MeshObject *BL_BlenderSceneConverter::FindGameMesh(Mesh *for_blendermesh)
RAS_Mesh *BL_BlenderSceneConverter::FindGameMesh(Mesh *for_blendermesh)
{
return m_map_mesh_to_gamemesh[for_blendermesh];
}
Expand Down
10 changes: 5 additions & 5 deletions source/gameengine/Converter/BL_BlenderSceneConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

class SCA_IActuator;
class SCA_IController;
class RAS_MeshObject;
class RAS_Mesh;
class KX_BlenderMaterial;
class BL_BlenderConverter;
class BL_ConvertObjectInfo;
Expand All @@ -63,12 +63,12 @@ class BL_BlenderSceneConverter
KX_Scene *m_scene;

std::vector<KX_BlenderMaterial *> m_materials;
std::vector<RAS_MeshObject *> m_meshobjects;
std::vector<RAS_Mesh *> m_meshobjects;
std::vector<BL_ConvertObjectInfo *> m_objectInfos;

std::map<Object *, BL_ConvertObjectInfo *> m_blenderToObjectInfos;
std::map<Object *, KX_GameObject *> m_map_blender_to_gameobject;
std::map<Mesh *, RAS_MeshObject *> m_map_mesh_to_gamemesh;
std::map<Mesh *, RAS_Mesh *> m_map_mesh_to_gamemesh;
std::map<Material *, KX_BlenderMaterial *> m_map_mesh_to_polyaterial;
std::map<bActuator *, SCA_IActuator *> m_map_blender_to_gameactuator;
std::map<bController *, SCA_IController *> m_map_blender_to_gamecontroller;
Expand All @@ -88,8 +88,8 @@ class BL_BlenderSceneConverter
void UnregisterGameObject(KX_GameObject *gameobject);
KX_GameObject *FindGameObject(Object *for_blenderobject);

void RegisterGameMesh(RAS_MeshObject *gamemesh, Mesh *for_blendermesh);
RAS_MeshObject *FindGameMesh(Mesh *for_blendermesh);
void RegisterGameMesh(RAS_Mesh *gamemesh, Mesh *for_blendermesh);
RAS_Mesh *FindGameMesh(Mesh *for_blendermesh);

void RegisterMaterial(KX_BlenderMaterial *blmat, Material *mat);
KX_BlenderMaterial *FindMaterial(Material *mat);
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Converter/BL_ConvertActuators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void BL_ConvertActuators(const char* maggiename,
break;
case ACT_EDOB_REPLACE_MESH:
{
RAS_MeshObject *tmpmesh = converter.FindGameMesh(editobact->me);
RAS_Mesh *tmpmesh = converter.FindGameMesh(editobact->me);

if (!tmpmesh) {
CM_Warning("object \"" << objectname << "\" from ReplaceMesh actuator \"" << uniquename
Expand Down
2 changes: 1 addition & 1 deletion source/gameengine/Converter/BL_ConvertSensors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#include "RAS_IPolygonMaterial.h"
// Sensors
#include "KX_GameObject.h"
#include "RAS_MeshObject.h"
#include "RAS_Mesh.h"
#include "SCA_KeyboardSensor.h"
#include "SCA_MouseSensor.h"
#include "SCA_AlwaysSensor.h"
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_DeformableGameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "KX_SoftBodyDeformer.h"

#include "RAS_MeshObject.h"
#include "RAS_Mesh.h"

#include "CM_Message.h"

Expand Down Expand Up @@ -135,7 +135,7 @@ void BL_DeformableGameObject::LoadDeformer()
return;
}

RAS_MeshObject *meshobj = m_meshes.front();
RAS_Mesh *meshobj = m_meshes.front();
Mesh *mesh = meshobj->GetMesh();

if (!mesh) {
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_MeshDeformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "BL_DeformableGameObject.h"
#include "BL_MeshDeformer.h"
#include "RAS_BoundingBoxManager.h"
#include "RAS_MeshObject.h"
#include "RAS_Mesh.h"
#include "RAS_MeshUser.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
Expand Down Expand Up @@ -71,7 +71,7 @@ void BL_MeshDeformer::Apply(RAS_IDisplayArray *UNUSED(array))
}
}

BL_MeshDeformer::BL_MeshDeformer(BL_DeformableGameObject *gameobj, Object *obj, RAS_MeshObject *meshobj)
BL_MeshDeformer::BL_MeshDeformer(BL_DeformableGameObject *gameobj, Object *obj, RAS_Mesh *meshobj)
:RAS_Deformer(meshobj),
m_bmesh((Mesh *)(obj->data)),
m_objMesh(obj),
Expand Down
4 changes: 2 additions & 2 deletions source/gameengine/Converter/BL_MeshDeformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
struct Object;
struct Mesh;
class BL_DeformableGameObject;
class RAS_MeshObject;
class RAS_Mesh;
class RAS_IPolyMaterial;

class BL_MeshDeformer : public RAS_Deformer
Expand All @@ -54,7 +54,7 @@ class BL_MeshDeformer : public RAS_Deformer
void RecalcNormals();
virtual void Relink(std::map<SCA_IObject *, SCA_IObject *>& map);

BL_MeshDeformer(BL_DeformableGameObject *gameobj, Object *obj, RAS_MeshObject *meshobj);
BL_MeshDeformer(BL_DeformableGameObject *gameobj, Object *obj, RAS_Mesh *meshobj);
virtual ~BL_MeshDeformer();
virtual void Apply(RAS_IDisplayArray *array);
virtual bool Update()
Expand Down
Loading

0 comments on commit a3957d7

Please sign in to comment.