#include <floor.h>
Public Member Functions | |
Floor (Object *parent, byte subType, uint16 index, const Common::String &name) | |
void | onAllLoaded () override |
void | saveLoad (ResourceSerializer *serializer) override |
Math::Vector3d | getVertex (uint32 index) const |
int32 | findFaceContainingPoint (const Math::Vector3d &point) const |
void | computePointHeightInFace (Math::Vector3d &point, uint32 faceIndex) const |
int32 | findFaceHitByRay (const Math::Ray &ray, Math::Vector3d &intersection) const |
int32 | findFaceClosestToRay (const Math::Ray &ray, Math::Vector3d ¢er) const |
float | getDistanceFromCamera (uint32 faceIndex) const |
FloorFace * | getFace (uint32 index) const |
bool | isSegmentInside (const Math::Line3d &segment) const |
void | enableFloorField (FloorField *floorfield, bool enable) |
Public Member Functions inherited from Stark::Resources::Object | |
Type | getType () const |
byte | getSubType () const |
uint16 | getIndex () const |
Common::String | getIndexAsString () const |
Common::String | getName () const |
virtual void | saveLoadCurrent (ResourceSerializer *serializer) |
virtual void | onPostRead () |
virtual void | onEnterLocation () |
virtual void | onGameLoop () |
virtual void | onEnginePause (bool pause) |
virtual void | onExitLocation () |
virtual void | onPreDestroy () |
template<class T > | |
T * | findParent () |
Object * | findChildWithIndex (Type type, uint16 index, int subType=-1) const |
Object * | findChildWithOrder (Type type, uint16 order, int subType=-1) const |
Object * | findChildWithName (Type type, const Common::String &name, int subType=-1) const |
template<class T > | |
T * | findChild (bool mustBeUnique=true) const |
template<class T > | |
T * | findChildWithSubtype (int subType, bool mustBeUnique=true) const |
template<class T > | |
T * | findChildWithIndex (uint16 index, int subType=-1) const |
template<class T > | |
T * | findChildWithOrder (uint16 order, int subType=-1) const |
template<class T > | |
T * | findChildWithName (const Common::String &name, int subType=-1) const |
template<class T > | |
Common::Array< T * > | listChildren (int subType=-1) const |
template<class T > | |
Common::Array< T * > | listChildrenRecursive (int subType=-1) |
void | addChild (Object *child) |
virtual void | print (uint depth=0) |
template<> | |
Object * | cast (Object *resource) |
template<> | |
Object * | findParent () |
template<> | |
Common::Array< Object * > | listChildren (int subType) const |
Static Public Attributes | |
static const Type::ResourceType | TYPE = Type::kFloor |
Protected Member Functions | |
void | readData (Formats::XRCReadStream *stream) override |
void | printData () override |
void | buildEdgeList () |
void | addFaceEdgeToList (uint32 faceIndex, uint32 index1, uint32 index2) |
Protected Member Functions inherited from Stark::Resources::Object | |
Object (Object *parent, byte subType, uint16 index, const Common::String &name) | |
void | printWithDepth (uint depth, const Common::String &string) const |
void | printDescription (uint depth) const |
Protected Attributes | |
uint32 | _facesCount |
Common::Array< Math::Vector3d > | _vertices |
Common::Array< FloorFace * > | _faces |
Common::Array< FloorEdge > | _edges |
Protected Attributes inherited from Stark::Resources::Object | |
Type | _type |
byte | _subType |
uint16 | _index |
Common::String | _name |
Object * | _parent |
Common::Array< Object * > | _children |
Additional Inherited Members | |
Static Public Member Functions inherited from Stark::Resources::Object | |
template<class T > | |
static T * | cast (Object *resource) |
This resource represents the floor of a 3D layer. Characters can only walk on the floor.
The floor is made of a list of faces building a mesh.
|
overridevirtual |
Called when the resource sub-tree is entirely loaded.
Allows to load data from other nodes.
Reimplemented from Stark::Resources::Object.
|
overridevirtual |
Persist / restore the resource state
Reimplemented from Stark::Resources::Object.
Math::Vector3d Stark::Resources::Floor::getVertex | ( | uint32 | index | ) | const |
Obtain the vertex for an index
int32 Stark::Resources::Floor::findFaceContainingPoint | ( | const Math::Vector3d & | point | ) | const |
Obtain the index of the face containing the point when both the floorfield and the point are projected on a Z=0 plane.
Return -1 if no face contains the point.
void Stark::Resources::Floor::computePointHeightInFace | ( | Math::Vector3d & | point, |
uint32 | faceIndex | ||
) | const |
Fill the z coordinate of the point so that it is on the plane of a face
int32 Stark::Resources::Floor::findFaceHitByRay | ( | const Math::Ray & | ray, |
Math::Vector3d & | intersection | ||
) | const |
Check if a ray is intersecting the floor
Faces where walking is disabled are ignored.
ray | The ray |
intersection | The intersection between the ray and the floor. Only valid when the return value is positive. |
int32 Stark::Resources::Floor::findFaceClosestToRay | ( | const Math::Ray & | ray, |
Math::Vector3d & | center | ||
) | const |
Find the floor face center closest to the ray
Faces where walking is disabled are ignored.
ray | The ray |
center | The closest face center to the ray. Only valid when the return value is positive. |
float Stark::Resources::Floor::getDistanceFromCamera | ( | uint32 | faceIndex | ) | const |
Obtain the distance to the camera for a face
FloorFace* Stark::Resources::Floor::getFace | ( | uint32 | index | ) | const |
Get a floor face by its index
bool Stark::Resources::Floor::isSegmentInside | ( | const Math::Line3d & | segment | ) | const |
Check if the segment is entirely inside the floor
void Stark::Resources::Floor::enableFloorField | ( | FloorField * | floorfield, |
bool | enable | ||
) |
Allow or disallow characters to walk on some faces of the floor
|
overrideprotectedvirtual |
Deserialize the resource static data and initial state.
Reimplemented from Stark::Resources::Object.