ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

path.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_RESOURCES_PATH_H
00024 #define STARK_RESOURCES_PATH_H
00025 
00026 #include <common/rect.h>
00027 #include <math/vector3d.h>
00028 #include "common/str.h"
00029 
00030 #include "engines/stark/resources/object.h"
00031 
00032 namespace Stark {
00033 
00034 namespace Formats {
00035 class XRCReadStream;
00036 }
00037 
00038 namespace Resources {
00039 
00046 class Path : public Object {
00047 public:
00048     static const Type::ResourceType TYPE = Type::kPath;
00049 
00050     enum SubType {
00051         kPath2D = 1,
00052         kPath3D = 2
00053     };
00054 
00056     static Object *construct(Object *parent, byte subType, uint16 index, const Common::String &name);
00057 
00058     Path(Object *parent, byte subType, uint16 index, const Common::String &name);
00059     virtual ~Path();
00060 
00061     // Resource API
00062     virtual void readData(Formats::XRCReadStream *stream) override;
00063 
00065     virtual uint getEdgeCount() const = 0;
00066 
00072     virtual Math::Vector3d getEdgeDirection(uint edgeIndex) const;
00073 
00075     virtual float getSortKey() const;
00076 
00078     float getWeightedEdgeLength(uint edgeIndex) const;
00079 
00081     Math::Vector3d getWeightedPositionInEdge(uint edgeIndex, float positionInEdge);
00082 
00083 protected:
00084     void printData() override;
00085     float getEdgeLength(uint edgeIndex) const;
00086     virtual float getVertexWeight(uint vertexIndex) const = 0;
00087     virtual Math::Vector3d getVertexPosition(uint vertexIndex) const = 0;
00088 
00089     uint32 _field_30;
00090 
00091 };
00092 
00096 class Path2D : public Path {
00097 public:
00098     Path2D(Object *parent, byte subType, uint16 index, const Common::String &name);
00099     virtual ~Path2D();
00100 
00101     struct Vertex {
00102         float weight;
00103         Common::Point position;
00104     };
00105 
00106     // Resource API
00107     virtual void readData(Formats::XRCReadStream *stream) override;
00108 
00109     // Path API
00110     uint getEdgeCount() const override;
00111 
00112 protected:
00113     float getVertexWeight(uint vertexIndex) const override;
00114     Math::Vector3d getVertexPosition(uint vertexIndex) const override;
00115 
00116 private:
00117     // Resource API
00118     void printData() override;
00119 
00120     Common::Array<Vertex> _vertices;
00121 };
00122 
00126 class Path3D : public Path {
00127 public:
00128     Path3D(Object *parent, byte subType, uint16 index, const Common::String &name);
00129     virtual ~Path3D();
00130 
00131     struct Vertex {
00132         float weight;
00133         Math::Vector3d position;
00134     };
00135 
00136     // Resource API
00137     virtual void readData(Formats::XRCReadStream *stream) override;
00138 
00139     // Path API
00140     uint getEdgeCount() const override;
00141     float getSortKey() const override;
00142     Math::Vector3d getEdgeDirection(uint edgeIndex) const override;
00143 
00145     Math::Vector3d getVertexPosition3D(uint vertexIndex, int32 *faceIndex);
00146 
00147 protected:
00148     float getVertexWeight(uint vertexIndex) const override;
00149     Math::Vector3d getVertexPosition(uint vertexIndex) const override;
00150 
00151 private:
00152     // Resource API
00153     void printData() override;
00154 
00155     Common::Array<Vertex> _vertices;
00156     float _sortKey;
00157 };
00158 
00159 } // End of namespace Resources
00160 } // End of namespace Stark
00161 
00162 #endif // STARK_RESOURCES_PATH_H


Generated on Sat Apr 20 2019 05:03:30 for ResidualVM by doxygen 1.7.1
curved edge   curved edge