7 #ifndef CAFU_MAP_BEZIER_PATCH_HPP_INCLUDED
8 #define CAFU_MAP_BEZIER_PATCH_HPP_INCLUDED
10 #include "MapPrimitive.hpp"
11 #include "SurfaceInfo.hpp"
13 #include "MaterialSystem/Mesh.hpp"
14 #include "SceneGraph/BezierPatchNode.hpp"
15 #include "SceneGraph/LightMapMan.hpp"
20 namespace MatSys {
class RenderMaterialT; }
21 namespace cf {
namespace ClipSys {
class CollisionModelStaticT; } }
98 void TrafoMirror(
unsigned int NormalAxis,
float Dist,
bool LockTexCoords)
override;
103 void Save_cmap(std::ostream& OutFile,
unsigned long PatchNr,
const MapDocumentT& MapDoc)
const;
113 const Vector3fT& GetCvPos(
unsigned long x,
unsigned long y)
const {
return cv_Pos[y*cv_Width + x]; }
115 void SetCvPos(
unsigned long x,
unsigned long y,
const Vector3fT& Pos)
117 cv_Pos[y*cv_Width + x]=Pos;
123 const Vector3fT& GetCvUV(
unsigned long x,
unsigned long y)
const {
return cv_UVs[y*cv_Width + x]; }
125 void SetCvUV(
unsigned long x,
unsigned long y,
const Vector3fT& uv)
127 cv_UVs[y*cv_Width + x]=uv;
133 int GetSubdivsHorz()
const {
return SubdivsHorz; }
135 void SetSubdivsHorz(
int subdivs)
143 int GetSubdivsVert()
const {
return SubdivsVert; }
145 void SetSubdivsVert(
int subdivs)
161 void SetSize(
unsigned long width,
unsigned long height);
164 unsigned long GetWidth()
const {
return cv_Width; }
165 unsigned long GetHeight()
const {
return cv_Height; }
167 unsigned long GetRenderWidth()
const { UpdateRenderMesh();
return BPRenderMesh->Meshes.
Size()+1; }
168 unsigned long GetRenderHeight()
const { UpdateRenderMesh(); assert(BPRenderMesh->Meshes.
Size()>0);
return BPRenderMesh->Meshes[0]->Vertices.
Size()/2; }
171 Vector3fT GetRenderVertexPos(
unsigned long x,
unsigned long y)
const;
185 bool ReconstructMatFit();
186 bool ReconstructPlaneProj(
bool AltOrigin);
190 bool ReconstructSI();
192 void UpdateRenderMesh()
const;
193 void UpdateTextureSpace();
198 unsigned long cv_Width;
199 unsigned long cv_Height;
203 mutable bool NeedsUpdate;
This class provides auxiliary means for rendering a 3D view.
Definition: Renderer3D.hpp:30
This class implements the rendering into a 2D view.
Definition: Renderer2D.hpp:22
This class manages lightmaps, e.g. by "allocating" rectangular areas in larger bitmaps.
Definition: LightMapMan.hpp:25
This class represents a surface render material.
Definition: RenderMaterial.hpp:25
This class represents a CaWE "map" document.
Definition: MapDocument.hpp:45
void Transform(const Matrix4x4fT &Matrix, bool LockTexCoords) override
Why does this method not replace all the other Trafo*() methods? This method is the most generic...
Definition: MapBezierPatch.cpp:979
This class holds all information that is needed in order to compute the UV texture-space coordinates ...
Definition: SurfaceInfo.hpp:51
unsigned long Size() const
Get size of array.
Definition: Array.hpp:138
void TrafoRotate(const Vector3fT &RefPoint, const cf::math::AnglesfT &Angles, bool LockTexCoords) override
Rotates this element about the given reference point (in world-space).
Definition: MapBezierPatch.cpp:933
This class adds no functionality of its own, but only exists for proper type separation.
Definition: MapPrimitive.hpp:21
BoundingBox3fT GetBB() const
Returns the spatial bounding-box of this map element.
Definition: MapBezierPatch.cpp:593
const SurfaceInfoT & GetSurfaceInfo() const
Returns the surface info that is associated with this patch.
Definition: MapBezierPatch.hpp:158
Definition: BezierPatchNode.hpp:32
This class manages the editor materials for a game configuration.
Definition: EditorMaterialManager.hpp:20
void TrafoMove(const Vector3fT &Delta, bool LockTexCoords) override
Translates this element by the given vector (in world-space).
Definition: MapBezierPatch.cpp:923
This class represents a polymorphic 3-dimensional vector.
Definition: Misc.hpp:11
bool TraceRay(const Vector3fT &RayOrigin, const Vector3fT &RayDir, float &Fraction, unsigned long &FaceNr) const
Traces a ray against this map element, and returns whether it was hit.
Definition: MapBezierPatch.cpp:606
An instance of this class encapsulates the transform-related state of a MapElementT.
Definition: MapElement.hpp:39
void TrafoScale(const Vector3fT &RefPoint, const Vector3fT &Scale, bool LockTexCoords) override
Scales this element about the given reference point (in world-space).
Definition: MapBezierPatch.cpp:951
TrafoMementoT * GetTrafoState() const override
Returns a memento that encapsulates the transform-related state of this element.
Definition: MapBezierPatch.cpp:899
This class represents a bezier patch.
Definition: MapBezierPatch.hpp:44
bool IsTranslucent() const
Returns whether this map element is (entirely or partially) translucent.
Definition: MapBezierPatch.cpp:680
void SetSurfaceInfo(const SurfaceInfoT &SI)
Set a new SurfaceInfoT.
Definition: MapBezierPatch.cpp:809
Definition: EditorMaterial.hpp:21
This class represents a static collision model.
Definition: CollisionModel_static.hpp:25
Definition: ChildFrameViewWin2D.hpp:24
void Render3D_Basic(MatSys::RenderMaterialT *RenderMat, const wxColour &MeshColor, const int MeshAlpha) const
A helper method for Render3D(), but also useful e.g. for preview renderings by the "New Bezier Patch"...
Definition: MapBezierPatch.cpp:736
void TrafoMirror(unsigned int NormalAxis, float Dist, bool LockTexCoords) override
Mirrors this element along the given mirror plane (in world-space).
Definition: MapBezierPatch.cpp:961
bool TracePixel(const wxPoint &Pixel, int Radius, const ViewWindow2DT &ViewWin) const
This method determines if this map element is intersected/affected by the specified disc in ViewWin...
Definition: MapBezierPatch.cpp:627
void RestoreTrafoState(const TrafoMementoT *TM) override
Restores the transform-related state of this element from the given memento.
Definition: MapBezierPatch.cpp:905
MapBezierPatchT * Clone() const override
The virtual copy constructor.
Definition: MapBezierPatch.cpp:587
~MapBezierPatchT()
The destructor.
Definition: MapBezierPatch.cpp:100
Definition: Renderer.hpp:16
Definition: TypeSys.hpp:52
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79
MapBezierPatchT(EditorMaterialI *Material_, cf::SceneGraph::LightMapManT &LMM_, int SubdivsHorz_=-1, int SubdivsVert_=-1)
The default constructor. It creates an "empty" bezier patch.
Definition: MapBezierPatch.cpp:62
This is a class for parsing text.
Definition: TextParser.hpp:21