Rename LmrObjParams to ModelParams

Reliance on this struct should be minimized
master
kko 2013-02-02 11:58:08 -05:00
parent e44fa5e672
commit 7d4029967b
16 changed files with 20 additions and 30 deletions

View File

@ -47,7 +47,7 @@ struct cityflavourdef_t {
} cityflavour[CITYFLAVOURS];
LmrObjParams cityobj_params;
ModelParams cityobj_params;
void CityOnPlanet::PutCityBit(MTRand &rand, const matrix4x4d &rot, vector3d p1, vector3d p2, vector3d p3, vector3d p4)
{
@ -317,7 +317,7 @@ void CityOnPlanet::Render(Graphics::Renderer *r, const Camera *camera, const Spa
const Graphics::Frustum frustum = camera->GetFrustum();
//modelview seems to be always identity
memset(&cityobj_params, 0, sizeof(LmrObjParams));
memset(&cityobj_params, 0, sizeof(ModelParams));
for (std::vector<BuildingDef>::const_iterator i = m_buildings.begin();
i != m_buildings.end(); ++i) {

View File

@ -26,7 +26,7 @@ protected:
float m_aspectRatio;
Graphics::Renderer *m_renderer;
ModelBase *m_model;
LmrObjParams m_modelParams;
ModelParams m_modelParams;
std::vector<Graphics::Light> m_lights;
};

View File

@ -17,7 +17,7 @@ Intro::Intro(Graphics::Renderer *r, int width, int height)
m_ambientColor = Color(0.f);
const Color one = Color::WHITE;
const Color two = Color(0.1f, 0.1f, 0.5f, 0.f);
const Color two = Color(0.3f, 0.3f, 0.8f, 0.f);
m_lights.push_back(Light(Graphics::Light::LIGHT_DIRECTIONAL, vector3f(0.f, 0.3f, 1.f), one, one));
m_lights.push_back(Light(Graphics::Light::LIGHT_DIRECTIONAL, vector3f(0.f, -1.f, 0.f), two, Color::BLACK));
@ -29,9 +29,6 @@ Intro::Intro(Graphics::Renderer *r, int width, int height)
}
m_model->SetLabel(Lang::PIONEER);
// Model parameters
// XXX all LMR-specific
memset(&m_modelParams, 0, sizeof(LmrObjParams));
m_modelParams.linthrust[2] = -1.f;
}

View File

@ -6,7 +6,7 @@
//this file might be temporary - but don't want to fight dependency issues right now
struct LmrObjParams
struct ModelParams
{
float linthrust[3]; // 1.0 to -1.0
float angthrust[3]; // 1.0 to -1.0
@ -15,7 +15,7 @@ struct LmrObjParams
float boundingRadius; //updated by model and passed to submodels
unsigned int nodemask;
LmrObjParams()
ModelParams()
: boundingRadius(0.f)
, nodemask(0x1) //draw solids
{
@ -23,7 +23,6 @@ struct LmrObjParams
std::fill(angthrust, angthrust+3, 0.f);
}
};
typedef LmrObjParams ModelParams;
typedef LmrObjParams RenderData;
typedef ModelParams RenderData;
#endif

View File

@ -20,8 +20,8 @@ public:
ModelBase() {}
virtual ~ModelBase() { }
virtual float GetDrawClipRadius() const = 0;
virtual void Render(Graphics::Renderer *r, const matrix4x4f &trans, LmrObjParams *params) = 0;
virtual RefCountedPtr<CollMesh> CreateCollisionMesh(const LmrObjParams *p) = 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) { }

View File

@ -22,7 +22,6 @@ ModelBody::ModelBody() :
m_geom(0),
m_model(0)
{
memset(&m_params, 0, sizeof(LmrObjParams));
}
ModelBody::~ModelBody()

View File

@ -32,7 +32,7 @@ public:
Geom *GetGeom() { return m_geom; }
ModelBase *GetModel() { return m_model; }
CollMesh *GetCollMesh() { return m_collMesh.Get(); }
LmrObjParams &GetLmrObjParams() { return m_params; }
ModelParams &GetModelParams() { return m_params; }
void RebuildCollisionMesh();
void SetModel(const char *lmrModelName);
@ -47,7 +47,7 @@ private:
bool m_colliding;
RefCountedPtr<CollMesh> m_collMesh;
Geom *m_geom;
LmrObjParams m_params;
ModelParams m_params;
ModelBase *m_model;
};

View File

@ -1099,7 +1099,7 @@ bool Ship::SetWheelState(bool down)
void Ship::Render(Graphics::Renderer *renderer, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform)
{
if (IsDead()) return;
LmrObjParams &params = GetLmrObjParams();
ModelParams &params = GetModelParams();
m_shipFlavour.ApplyTo(GetModel());

View File

@ -7,7 +7,6 @@
#include "ShipType.h"
#include "Serializer.h"
struct LmrObjParams;
struct lua_State;
class ShipFlavour {

View File

@ -14,8 +14,6 @@ ShipSpinnerWidget::ShipSpinnerWidget(const ShipFlavour &flavour, float width, fl
{
m_model = Pi::FindModel(ShipType::types[flavour.id].lmrModelName.c_str());
memset(&m_params, 0, sizeof(LmrObjParams));
flavour.ApplyTo(m_model);
Color lc(1.f);

View File

@ -22,7 +22,7 @@ private:
float m_height;
ModelBase *m_model;
LmrObjParams m_params;
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
EquipSet m_equipment;

View File

@ -602,7 +602,7 @@ void SpaceStation::CalcLighting(Planet *planet, double &ambient, double &intensi
// Lighting is done by manipulating global lights or setting uniforms in atmospheric models shader
void SpaceStation::Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform)
{
LmrObjParams &params = GetLmrObjParams();
ModelParams &params = GetModelParams();
Body *b = GetFrame()->GetBody();
assert(b);

View File

@ -16,8 +16,6 @@ ShipSpinner::ShipSpinner(Context *context, const ShipFlavour &flavour) : Widget(
{
m_model = Pi::FindModel(ShipType::types[m_flavour.id].lmrModelName.c_str());
memset(&m_params, 0, sizeof(LmrObjParams));
m_flavour.ApplyTo(m_model);
Color lc(1.f);

View File

@ -30,7 +30,7 @@ private:
float m_rotX, m_rotY;
ModelBase *m_model;
LmrObjParams m_params;
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
EquipSet m_equipment;

View File

@ -86,7 +86,7 @@ Model *Model::MakeInstance() const
return m;
}
void Model::Render(const matrix4x4f &trans, LmrObjParams *params)
void Model::Render(const matrix4x4f &trans, ModelParams *params)
{
//update color parameters (materials are shared by model instances)
if (m_curPattern) {
@ -120,7 +120,7 @@ void Model::Render(const matrix4x4f &trans, LmrObjParams *params)
}
}
RefCountedPtr<CollMesh> Model::CreateCollisionMesh(const LmrObjParams *p)
RefCountedPtr<CollMesh> Model::CreateCollisionMesh(const ModelParams *)
{
CollisionVisitor cv;
m_root->Accept(cv);

View File

@ -91,9 +91,9 @@ public:
Model *MakeInstance() const;
virtual bool IsSGModel() const { return true; } //XXX transitional junk
float GetDrawClipRadius() const { return m_boundingRadius; }
void Render(Graphics::Renderer *r, const matrix4x4f &trans, LmrObjParams *params) { Render(trans, params); } // XXX only takes renderer because ModelBase requires it
void Render(const matrix4x4f &trans, LmrObjParams *params);
RefCountedPtr<CollMesh> CreateCollisionMesh(const LmrObjParams *p);
void Render(Graphics::Renderer *r, const matrix4x4f &trans, ModelParams *params) { Render(trans, params); } // XXX only takes renderer because ModelBase requires it
void Render(const matrix4x4f &trans, ModelParams *params);
RefCountedPtr<CollMesh> CreateCollisionMesh(const ModelParams *p);
CollMesh *GetCollisionMesh() const { return m_collMesh.Get(); }
RefCountedPtr<Group> GetRoot() { return m_root; }
//materials used in the nodes should be accessible from here for convenience