1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef SOLID_OBJECT_DEF_H
#define SOLID_OBJECT_DEF_H
#include <string>
#include "Sim/Misc/CollisionVolume.h"
#include <System/creg/STL_Map.h>
struct S3DModel;
class LuaTable;
struct SolidObjectDecalDef {
public:
SolidObjectDecalDef();
void Parse(const LuaTable&);
public:
std::string groundDecalTypeName;
std::string trackDecalTypeName;
bool useGroundDecal;
int groundDecalType;
int groundDecalSizeX;
int groundDecalSizeY;
float groundDecalDecaySpeed;
bool leaveTrackDecals;
int trackDecalType;
float trackDecalWidth;
float trackDecalOffset;
float trackDecalStrength;
float trackDecalStretch;
};
struct SolidObjectDef {
public:
SolidObjectDef();
virtual ~SolidObjectDef() { }
S3DModel* LoadModel() const;
void PreloadModel() const;
float GetModelRadius() const;
void ParseCollisionVolume(const LuaTable& odTable);
void ParseSelectionVolume(const LuaTable& odTable);
public:
int id;
///< both sizes expressed in heightmap coordinates; M x N
///< footprint covers M*SQUARE_SIZE x N*SQUARE_SIZE elmos
int xsize;
int zsize;
float metal;
float energy;
float health;
float mass;
float crushResistance;
///< if false, object can NOT be collided with by SolidObject's
///< (but projectiles and raytraces will still interact with it)
bool collidable;
bool selectable;
bool upright;
bool reclaimable;
// must be mutable because models are lazy-loaded even for defs
mutable S3DModel* model;
CollisionVolume collisionVolume;
CollisionVolume selectionVolume;
SolidObjectDecalDef decalDef;
std::string name; // eg. "arm_flash"
std::string modelName; // eg. "arm_flash.3do" (no path prefix)
spring::unordered_map<std::string, std::string> customParams;
};
#endif
|