ScummVM API documentation
Stark::Resources::Floor Class Reference

#include <floor.h>

Inheritance diagram for Stark::Resources::Floor:
Stark::Resources::Object

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 &center) const
 
float getDistanceFromCamera (uint32 faceIndex) const
 
FloorFacegetFace (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 ()
 
ObjectfindChildWithIndex (Type type, uint16 index, int subType=-1) const
 
ObjectfindChildWithOrder (Type type, uint16 order, int subType=-1) const
 
ObjectfindChildWithName (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<>
Objectcast (Object *resource)
 
template<>
ObjectfindParent ()
 
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)
 

Detailed Description

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.

Member Function Documentation

◆ onAllLoaded()

void Stark::Resources::Floor::onAllLoaded ( )
overridevirtual

Called when the resource sub-tree is entirely loaded.

Allows to load data from other nodes.

Reimplemented from Stark::Resources::Object.

◆ saveLoad()

void Stark::Resources::Floor::saveLoad ( ResourceSerializer serializer)
overridevirtual

Persist / restore the resource state

Reimplemented from Stark::Resources::Object.

◆ getVertex()

Math::Vector3d Stark::Resources::Floor::getVertex ( uint32  index) const

Obtain the vertex for an index

◆ findFaceContainingPoint()

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.

◆ computePointHeightInFace()

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

◆ findFaceHitByRay()

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.

Parameters
rayThe ray
intersectionThe intersection between the ray and the floor. Only valid when the return value is positive.
Returns
-1 if no face contains the point, the hit face index otherwise

◆ findFaceClosestToRay()

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.

Parameters
rayThe ray
centerThe closest face center to the ray. Only valid when the return value is positive.
Returns
-1 if no face was found, the face index with its center closest to the ray otherwise

◆ getDistanceFromCamera()

float Stark::Resources::Floor::getDistanceFromCamera ( uint32  faceIndex) const

Obtain the distance to the camera for a face

◆ getFace()

FloorFace* Stark::Resources::Floor::getFace ( uint32  index) const

Get a floor face by its index

◆ isSegmentInside()

bool Stark::Resources::Floor::isSegmentInside ( const Math::Line3d &  segment) const

Check if the segment is entirely inside the floor

◆ enableFloorField()

void Stark::Resources::Floor::enableFloorField ( FloorField floorfield,
bool  enable 
)

Allow or disallow characters to walk on some faces of the floor

◆ readData()

void Stark::Resources::Floor::readData ( Formats::XRCReadStream stream)
overrideprotectedvirtual

Deserialize the resource static data and initial state.

Reimplemented from Stark::Resources::Object.


The documentation for this class was generated from the following file: