Remove ModelBase

master
kko 2013-02-02 10:58:41 -05:00
parent ef5b965abb
commit d789ac2a77
19 changed files with 33 additions and 66 deletions

View File

@ -22,7 +22,7 @@ bool s_cityBuildingsInitted = false;
struct citybuilding_t {
const char *modelname;
double xzradius;
ModelBase *resolvedModel;
Model *resolvedModel;
RefCountedPtr<CollMesh> collMesh;
};
@ -52,7 +52,7 @@ ModelParams cityobj_params;
void CityOnPlanet::PutCityBit(MTRand &rand, const matrix4x4d &rot, vector3d p1, vector3d p2, vector3d p3, vector3d p4)
{
double rad = (p1-p2).Length()*0.5;
ModelBase *model(0);
Model *model(0);
double modelRadXZ(0.0);
const CollMesh *cmesh(0);
vector3d cent = (p1+p2+p3+p4)*0.25;
@ -160,10 +160,9 @@ static void enumerateNewBuildings(std::vector<std::string> &filenames)
static void lookupBuildingListModels(citybuildinglist_t *list)
{
//const char *modelTagName;
std::vector<ModelBase*> models;
std::vector<Model*> models;
//get test newmodels
//get test newmodels - to be replaced with building set definitions
{
std::vector<std::string> filenames;
enumerateNewBuildings(filenames);
@ -180,7 +179,7 @@ static void lookupBuildingListModels(citybuildinglist_t *list)
list->numBuildings = models.size();
int i = 0;
for (std::vector<ModelBase*>::iterator m = models.begin(); m != models.end(); ++m, i++) {
for (std::vector<Model*>::iterator m = models.begin(); m != models.end(); ++m, i++) {
list->buildings[i].resolvedModel = *m;
list->buildings[i].collMesh = (*m)->CreateCollisionMesh(&cityobj_params);
const Aabb &aabb = list->buildings[i].collMesh->GetAabb();

View File

@ -33,7 +33,7 @@ private:
void RemoveStaticGeomsFromCollisionSpace();
struct BuildingDef {
ModelBase *model;
Model *model;
float clipRadius;
int rotation; // 0-3
vector3d pos;

View File

@ -7,8 +7,7 @@
#include "libs.h"
#include "graphics/Renderer.h"
#include "graphics/Light.h"
class ModelBase;
#include "scenegraph/Model.h"
class Cutscene {
public:
@ -25,7 +24,7 @@ protected:
Color m_ambientColor;
float m_aspectRatio;
Graphics::Renderer *m_renderer;
ModelBase *m_model;
Model *m_model;
ModelParams m_modelParams;
std::vector<Graphics::Light> m_lights;
};

View File

@ -101,7 +101,6 @@ noinst_HEADERS = \
MarketAgent.h \
MathUtil.h \
Missile.h \
ModelBase.h \
ModelBody.h \
ModelCache.h \
ModManager.h \

View File

@ -1,30 +0,0 @@
// Copyright © 2008-2013 Pioneer Developers. See AUTHORS.txt for details
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
#ifndef _MODEL_H
#define _MODEL_H
/*
* Abstract model base class.
* Will be removed with LMR
*/
#include "libs.h"
#include "CollMesh.h"
#include "LmrTypes.h"
namespace Graphics {
class Renderer;
class Texture;
}
class ModelBase {
public:
ModelBase() {}
virtual ~ModelBase() { }
virtual float GetDrawClipRadius() const = 0;
virtual void Render(Graphics::Renderer *r, const matrix4x4f &trans, ModelParams *params) = 0;
virtual RefCountedPtr<CollMesh> CreateCollisionMesh(const ModelParams *p) = 0;
virtual bool IsSGModel() const { return false; }
virtual void SetLabel(const std::string&) = 0;
virtual void SetDecalTexture(Graphics::Texture *, unsigned int index = 0) { }
};
#endif

View File

@ -6,9 +6,9 @@
#include "Body.h"
#include "vector3.h"
#include "ModelBase.h"
#include "CollMesh.h"
#include "LmrTypes.h"
#include "scenegraph/Model.h"
#include <vector>
class Geom;
namespace Graphics { class Renderer; }
@ -30,7 +30,7 @@ public:
bool IsStatic() const { return m_isStatic; }
const Aabb &GetAabb() const { return m_collMesh->GetAabb(); }
Geom *GetGeom() { return m_geom; }
ModelBase *GetModel() { return m_model; }
Model *GetModel() { return m_model; }
CollMesh *GetCollMesh() { return m_collMesh.Get(); }
ModelParams &GetModelParams() { return m_params; }
void RebuildCollisionMesh();
@ -48,7 +48,7 @@ private:
RefCountedPtr<CollMesh> m_collMesh;
Geom *m_geom;
ModelParams m_params;
ModelBase *m_model;
Model *m_model;
};
#endif /* _MODELBODY_H */

View File

@ -224,10 +224,9 @@ static void LuaInitGame() {
LuaEvent::Clear();
}
ModelBase *Pi::FindModel(const std::string &name)
Model *Pi::FindModel(const std::string &name)
{
// Try NewModel models first, then LMR
ModelBase *m = 0;
Model *m = 0;
try {
m = Pi::modelCache->FindModel(name);
} catch (ModelCache::ModelNotFoundException) {

View File

@ -23,7 +23,7 @@ class GameMenuView;
class Intro;
class LuaConsole;
class LuaNameGen;
class ModelBase;
class Model;
class ModelCache;
class Player;
class SectorView;
@ -103,7 +103,7 @@ public:
static float CalcHyperspaceFuelOut(int hyperclass, float dist, float hyperspace_range_max);
static void Message(const std::string &message, const std::string &from = "", enum MsgLevel level = MSG_NORMAL);
static std::string GetSaveDir();
static ModelBase *FindModel(const std::string&);
static Model *FindModel(const std::string&);
static const char SAVE_DIR_NAME[];

View File

@ -41,7 +41,7 @@ void ShipFlavour::MakeTrulyRandom(ShipFlavour &v, bool atmospheric)
}
}
void ShipFlavour::ApplyTo(ModelBase *m) const
void ShipFlavour::ApplyTo(Model *m) const
{
m->SetLabel(regid);
}

View File

@ -21,7 +21,7 @@ public:
ShipFlavour(ShipType::Id id);
void Save(Serializer::Writer &wr);
void Load(Serializer::Reader &rd);
void ApplyTo(ModelBase *m) const;
void ApplyTo(Model *m) const;
static void MakeTrulyRandom(ShipFlavour &v, bool atmosphereCapableOnly = false);
};

View File

@ -10,6 +10,8 @@
#include "ShipType.h"
#include "EquipSet.h"
class Model;
class ShipSpinnerWidget : public Gui::Widget {
public:
ShipSpinnerWidget(const ShipFlavour &flavour, float width, float height);
@ -21,7 +23,7 @@ private:
float m_width;
float m_height;
ModelBase *m_model;
Model *m_model;
ModelParams m_params;
// XXX m_equipment is currently not hooked up to anything,
// it's just used to pass equipment parameters to the displayed model

View File

@ -3,13 +3,13 @@
#include "SpaceStationType.h"
#include "FileSystem.h"
#include "ModelBase.h"
#include "Lua.h"
#include "LuaVector.h"
#include "LuaVector.h"
#include "Pi.h"
#include "Ship.h"
#include "StringF.h"
#include "scenegraph/Model.h"
static lua_State *s_lua;
static std::string s_currentStationFile = "";

View File

@ -8,12 +8,12 @@
//Space station definition, loaded from data/stations
class ModelBase;
class Model;
class Ship;
struct SpaceStationType {
std::string id;
ModelBase *model;
Model *model;
std::string modelName;
float angVel;
enum DOCKMETHOD { SURFACE, ORBITAL } dockMethod;

View File

@ -5,6 +5,7 @@
#include "Ship.h"
#include "Pi.h"
#include "Game.h"
#include "scenegraph/Model.h"
using namespace UI;

View File

@ -9,6 +9,8 @@
#include "graphics/Light.h"
#include "EquipSet.h"
class Model;
namespace GameUI {
class ShipSpinner : public UI::Widget {
@ -29,7 +31,7 @@ private:
float m_rotX, m_rotY;
ModelBase *m_model;
Model *m_model;
ModelParams m_params;
// XXX m_equipment is currently not hooked up to anything,
// it's just used to pass equipment parameters to the displayed model

View File

@ -18,8 +18,7 @@ public:
};
Model::Model(Graphics::Renderer *r, const std::string &name)
: ModelBase()
, m_boundingRadius(10.f)
: m_boundingRadius(10.f)
, m_renderer(r)
, m_name(name)
, m_curPattern(0)
@ -30,8 +29,7 @@ Model::Model(Graphics::Renderer *r, const std::string &name)
}
Model::Model(const Model &model)
: ModelBase()
, m_boundingRadius(model.m_boundingRadius)
: m_boundingRadius(model.m_boundingRadius)
, m_materials(model.m_materials)
, m_patterns(model.m_patterns)
, m_collMesh(model.m_collMesh) //might have to make this per-instance at some point

View File

@ -60,12 +60,12 @@
* - removing unnecessary nodes from the scene graph: pre-translate unanimated meshes etc.
*/
#include "libs.h"
#include "ModelBase.h"
#include "Animation.h"
#include "ColorMap.h"
#include "Group.h"
#include "Label3D.h"
#include "Pattern.h"
#include "LmrTypes.h"
#include "graphics/Material.h"
#include <stdexcept>
@ -82,7 +82,7 @@ typedef std::vector<std::pair<std::string, RefCountedPtr<Graphics::Material> > >
typedef std::vector<Animation*> AnimationContainer;
typedef std::vector<MatrixTransform *> TagContainer;
class Model : public ModelBase
class Model
{
public:
friend class Loader;
@ -144,4 +144,6 @@ private:
}
using SceneGraph::Model; //yep.
#endif

View File

@ -347,7 +347,6 @@
<ClInclude Include="..\..\src\MathUtil.h" />
<ClInclude Include="..\..\src\matrix4x4.h" />
<ClInclude Include="..\..\src\Missile.h" />
<ClInclude Include="..\..\src\ModelBase.h" />
<ClInclude Include="..\..\src\ModelBody.h" />
<ClInclude Include="..\..\src\ModelCache.h" />
<ClInclude Include="..\..\src\ModelViewer.h" />

View File

@ -881,9 +881,6 @@
<ClInclude Include="..\..\src\UIView.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ModelBase.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ModelViewer.h">
<Filter>src</Filter>
</ClInclude>