Remove some LMR-isms
parent
85a4acf318
commit
78435c0e40
|
@ -63,5 +63,5 @@ bool CargoBody::OnCollision(Object *b, Uint32 flags, double relVel)
|
|||
void CargoBody::Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform)
|
||||
{
|
||||
GetModel()->SetLabel(Equip::types[m_type].name);
|
||||
RenderLmrModel(r, viewCoords, viewTransform);
|
||||
RenderModel(r, viewCoords, viewTransform);
|
||||
}
|
||||
|
|
|
@ -318,7 +318,6 @@ void CityOnPlanet::Render(Graphics::Renderer *r, const Camera *camera, const Spa
|
|||
//modelview seems to be always identity
|
||||
|
||||
memset(&cityobj_params, 0, sizeof(LmrObjParams));
|
||||
cityobj_params.time = Pi::game->GetTime();
|
||||
|
||||
for (std::vector<BuildingDef>::const_iterator i = m_buildings.begin();
|
||||
i != m_buildings.end(); ++i) {
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "graphics/Renderer.h"
|
||||
#include "graphics/Light.h"
|
||||
|
||||
class ModelBase;
|
||||
|
||||
class Cutscene {
|
||||
public:
|
||||
Cutscene(Graphics::Renderer *r, int width, int height)
|
||||
|
|
|
@ -32,27 +32,7 @@ Intro::Intro(Graphics::Renderer *r, int width, int height)
|
|||
// Model parameters
|
||||
// XXX all LMR-specific
|
||||
memset(&m_modelParams, 0, sizeof(LmrObjParams));
|
||||
m_modelParams.animationNamespace = "ShipAnimation";
|
||||
m_modelParams.flightState = Ship::FLYING;
|
||||
m_modelParams.linthrust[2] = -1.f;
|
||||
m_modelParams.animValues[1] = 1.f;
|
||||
|
||||
LmrMaterial matA = { { .2f, .2f, .5f, 1.0f }, { 1, 1, 1 }, { 0, 0, 0 }, 100.0 };
|
||||
LmrMaterial matB = { { 0.5f, 0.5f, 0.5f, 1.0f }, { 0, 0, 0 }, { 0, 0, 0 }, 0 };
|
||||
LmrMaterial matC = { { 0.8f, 0.8f, 0.8f, 1.0f }, { 0, 0, 0 }, { 0, 0, 0 }, 0 };
|
||||
m_modelParams.pMat[0] = matA;
|
||||
m_modelParams.pMat[1] = matB;
|
||||
m_modelParams.pMat[2] = matC;
|
||||
|
||||
// Some equipment (in case the model can show them)
|
||||
m_equipment.Add(Equip::ECM_ADVANCED, 1);
|
||||
m_equipment.Add(Equip::HYPERCLOUD_ANALYZER, 1);
|
||||
m_equipment.Add(Equip::ATMOSPHERIC_SHIELDING, 1);
|
||||
m_equipment.Add(Equip::FUEL_SCOOP, 1);
|
||||
m_equipment.Add(Equip::SCANNER, 1);
|
||||
m_equipment.Add(Equip::RADAR_MAPPER, 1);
|
||||
m_equipment.Add(Equip::MISSILE_NAVAL, 4);
|
||||
m_modelParams.equipment = &m_equipment;
|
||||
}
|
||||
|
||||
Intro::~Intro()
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef _LMRTYPES_H
|
||||
#define _LMRTYPES_H
|
||||
|
||||
class EquipSet;
|
||||
|
||||
//this file might be temporary - but don't want to fight dependency issues right now
|
||||
struct LmrMaterial {
|
||||
float diffuse[4];
|
||||
|
@ -17,21 +15,8 @@ struct LmrMaterial {
|
|||
|
||||
struct LmrObjParams
|
||||
{
|
||||
enum { LMR_ANIMATION_MAX = 10 };
|
||||
|
||||
const char *animationNamespace; // the namespace to look up animation names in, from LuaConstants
|
||||
|
||||
double time;
|
||||
int animStages[LMR_ANIMATION_MAX];
|
||||
double animValues[LMR_ANIMATION_MAX];
|
||||
const char *label; // ignored, use model->SetLabel
|
||||
const EquipSet *equipment; // for ships
|
||||
int flightState;
|
||||
|
||||
float linthrust[3]; // 1.0 to -1.0
|
||||
float angthrust[3]; // 1.0 to -1.0
|
||||
//vector3f linthrust;
|
||||
//vector3f angthrust;
|
||||
|
||||
struct LmrMaterial pMat[3];
|
||||
|
||||
|
|
|
@ -143,12 +143,7 @@ void ModelBody::SetFrame(Frame *f)
|
|||
}
|
||||
}
|
||||
|
||||
void ModelBody::SetLmrTimeParams()
|
||||
{
|
||||
m_params.time = Pi::game->GetTime();
|
||||
}
|
||||
|
||||
void ModelBody::RenderLmrModel(Graphics::Renderer *r, const vector3d &viewCoords, const matrix4x4d &viewTransform)
|
||||
void ModelBody::RenderModel(Graphics::Renderer *r, const vector3d &viewCoords, const matrix4x4d &viewTransform)
|
||||
{
|
||||
matrix4x4d m2 = GetInterpOrient();
|
||||
m2.SetTranslate(GetInterpPosition());
|
||||
|
@ -161,7 +156,6 @@ void ModelBody::RenderLmrModel(Graphics::Renderer *r, const vector3d &viewCoords
|
|||
trans[14] = viewCoords.z;
|
||||
trans[15] = 1.0f;
|
||||
|
||||
m_params.label = GetLabel().c_str();
|
||||
m_model->Render(r, trans, &m_params);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
|
|
@ -33,12 +33,11 @@ public:
|
|||
ModelBase *GetModel() { return m_model; }
|
||||
CollMesh *GetCollMesh() { return m_collMesh.Get(); }
|
||||
LmrObjParams &GetLmrObjParams() { return m_params; }
|
||||
void SetLmrTimeParams();
|
||||
void RebuildCollisionMesh();
|
||||
|
||||
void SetModel(const char *lmrModelName);
|
||||
|
||||
void RenderLmrModel(Graphics::Renderer *r, const vector3d &viewCoords, const matrix4x4d &viewTransform);
|
||||
void RenderModel(Graphics::Renderer *r, const vector3d &viewCoords, const matrix4x4d &viewTransform);
|
||||
|
||||
protected:
|
||||
virtual void Save(Serializer::Writer &wr, Space *space);
|
||||
|
|
14
src/Ship.cpp
14
src/Ship.cpp
|
@ -154,17 +154,16 @@ void Ship::Init()
|
|||
// XXX the animation namespace must match that in LuaConstants
|
||||
// note: this must be set before generating the collision mesh
|
||||
// (which happens in SetModel()) and before rendering
|
||||
GetLmrObjParams().animationNamespace = "ShipAnimation";
|
||||
GetLmrObjParams().equipment = &m_equipment;
|
||||
|
||||
const ShipType &stype = GetShipType();
|
||||
|
||||
// Dirty hack: Always use gear-down mesh for collision detection
|
||||
// necessary because some ships have non-docking meshes too large for docking
|
||||
float temp = GetLmrObjParams().animValues[ANIM_WHEEL_STATE];
|
||||
GetLmrObjParams().animValues[ANIM_WHEEL_STATE] = 1.0f;
|
||||
//XXX nope, cannot do this anymore
|
||||
//float temp = GetLmrObjParams().animValues[ANIM_WHEEL_STATE];
|
||||
//GetLmrObjParams().animValues[ANIM_WHEEL_STATE] = 1.0f;
|
||||
SetModel(stype.lmrModelName.c_str());
|
||||
GetLmrObjParams().animValues[ANIM_WHEEL_STATE] = temp;
|
||||
//GetLmrObjParams().animValues[ANIM_WHEEL_STATE] = temp;
|
||||
|
||||
SetMassDistributionFromModel();
|
||||
UpdateStats();
|
||||
|
@ -1105,20 +1104,17 @@ void Ship::Render(Graphics::Renderer *renderer, const Camera *camera, const vect
|
|||
m_shipFlavour.ApplyTo(¶ms);
|
||||
m_shipFlavour.ApplyTo(GetModel());
|
||||
|
||||
SetLmrTimeParams();
|
||||
params.angthrust[0] = float(-m_angThrusters.x);
|
||||
params.angthrust[1] = float(-m_angThrusters.y);
|
||||
params.angthrust[2] = float(-m_angThrusters.z);
|
||||
params.linthrust[0] = float(m_thrusters.x);
|
||||
params.linthrust[1] = float(m_thrusters.y);
|
||||
params.linthrust[2] = float(m_thrusters.z);
|
||||
params.animValues[ANIM_WHEEL_STATE] = m_wheelState;
|
||||
params.flightState = m_flightState;
|
||||
if (m_landingGearAnimation)
|
||||
m_landingGearAnimation->SetProgress(m_wheelState);
|
||||
|
||||
//strncpy(params.pText[0], GetLabel().c_str(), sizeof(params.pText));
|
||||
RenderLmrModel(renderer, viewCoords, viewTransform);
|
||||
RenderModel(renderer, viewCoords, viewTransform);
|
||||
|
||||
// draw shield recharge bubble
|
||||
if (m_stats.shield_mass_left < m_stats.shield_mass) {
|
||||
|
|
|
@ -15,10 +15,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));
|
||||
m_params.animationNamespace = "ShipAnimation";
|
||||
m_params.equipment = &m_equipment;
|
||||
m_params.animValues[Ship::ANIM_WHEEL_STATE] = 1.0;
|
||||
m_params.flightState = Ship::FLYING;
|
||||
|
||||
flavour.ApplyTo(&m_params);
|
||||
flavour.ApplyTo(m_model);
|
||||
|
@ -35,8 +31,6 @@ void ShipSpinnerWidget::Draw()
|
|||
float pos[2];
|
||||
GetAbsolutePosition(pos);
|
||||
|
||||
m_params.time = Pi::game->GetTime();
|
||||
|
||||
float guiscale[2];
|
||||
Gui::Screen::GetCoords2Pixels(guiscale);
|
||||
static float rot1, rot2;
|
||||
|
|
|
@ -146,11 +146,6 @@ void SpaceStation::InitStation()
|
|||
if (ground) m_type = &SpaceStationType::surfaceStationTypes[ rand.Int32(SpaceStationType::surfaceStationTypes.size()) ];
|
||||
else m_type = &SpaceStationType::orbitalStationTypes[ rand.Int32(SpaceStationType::orbitalStationTypes.size()) ];
|
||||
|
||||
LmrObjParams ¶ms = GetLmrObjParams();
|
||||
params.animStages[ANIM_DOCKING_BAY_1] = 1;
|
||||
params.animValues[ANIM_DOCKING_BAY_1] = 1.0;
|
||||
// XXX the animation namespace must match that in LuaConstants
|
||||
params.animationNamespace = "SpaceStationAnimation";
|
||||
SetStatic(ground); // orbital stations are dynamic now
|
||||
SetModel(m_type->modelName.c_str());
|
||||
|
||||
|
@ -608,20 +603,13 @@ void SpaceStation::CalcLighting(Planet *planet, double &ambient, double &intensi
|
|||
void SpaceStation::Render(Graphics::Renderer *r, const Camera *camera, const vector3d &viewCoords, const matrix4x4d &viewTransform)
|
||||
{
|
||||
LmrObjParams ¶ms = GetLmrObjParams();
|
||||
params.label = GetLabel().c_str();
|
||||
SetLmrTimeParams();
|
||||
|
||||
for (int i=0; i<MAX_DOCKING_PORTS; i++) {
|
||||
params.animStages[ANIM_DOCKING_BAY_1 + i] = m_shipDocking[i].stage;
|
||||
params.animValues[ANIM_DOCKING_BAY_1 + i] = m_shipDocking[i].stagePos;
|
||||
}
|
||||
|
||||
Body *b = GetFrame()->GetBody();
|
||||
assert(b);
|
||||
|
||||
if (!b->IsType(Object::PLANET)) {
|
||||
// orbital spaceport -- don't make city turds or change lighting based on atmosphere
|
||||
RenderLmrModel(r, viewCoords, viewTransform);
|
||||
RenderModel(r, viewCoords, viewTransform);
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -668,7 +656,7 @@ void SpaceStation::Render(Graphics::Renderer *r, const Camera *camera, const vec
|
|||
m_adjacentCity->Render(r, camera, this, viewCoords, viewTransform);
|
||||
}
|
||||
|
||||
RenderLmrModel(r, viewCoords, viewTransform);
|
||||
RenderModel(r, viewCoords, viewTransform);
|
||||
|
||||
// restore old lights & ambient
|
||||
r->SetLights(origLights.size(), &origLights[0]);
|
||||
|
|
|
@ -15,16 +15,6 @@ Tombstone::Tombstone(Graphics::Renderer *r, int width, int height)
|
|||
m_lights.push_back(Graphics::Light(Graphics::Light::LIGHT_DIRECTIONAL, vector3f(0.f, 1.f, 1.f), lc, lc));
|
||||
|
||||
m_model = Pi::FindModel("tombstone");
|
||||
|
||||
// Model parameters
|
||||
memset(&m_modelParams, 0, sizeof(LmrObjParams));
|
||||
LmrMaterial matA = { { 1.0f, 1.0f, 1.0f, 1.0f }, { 0, 0, 0 }, { 0, 0, 0 }, 0 };
|
||||
LmrMaterial matB = { { 0.8f, 0.6f, 0.5f, 1.0f }, { 0, 0, 0 }, { 0, 0, 0 }, 0 };
|
||||
LmrMaterial matC = { { 0.5f, 0.5f, 0.5f, 1.0f }, { 0, 0, 0 }, { 0, 0, 0 }, 0 };
|
||||
m_modelParams.pMat[0] = matA;
|
||||
m_modelParams.pMat[1] = matB;
|
||||
m_modelParams.pMat[2] = matC;
|
||||
m_modelParams.label = Lang::TOMBSTONE_EPITAPH;
|
||||
}
|
||||
|
||||
void Tombstone::Draw(float _time)
|
||||
|
|
|
@ -17,10 +17,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_params.animationNamespace = "ShipAnimation";
|
||||
m_params.equipment = &m_equipment;
|
||||
m_params.animValues[Ship::ANIM_WHEEL_STATE] = 1.0;
|
||||
m_params.flightState = Ship::FLYING;
|
||||
|
||||
m_flavour.ApplyTo(&m_params);
|
||||
m_flavour.ApplyTo(m_model);
|
||||
|
@ -42,8 +38,6 @@ void ShipSpinner::Layout()
|
|||
|
||||
void ShipSpinner::Update()
|
||||
{
|
||||
m_params.time = double(SDL_GetTicks()) * 0.001;
|
||||
|
||||
if (!(m_rightMouseButton && IsMouseActive())) {
|
||||
m_rotX += .5*Pi::GetFrameTime();
|
||||
m_rotY += Pi::GetFrameTime();
|
||||
|
|
Loading…
Reference in New Issue