root/cafu/trunk/CaWE/MapFace.hpp

Revision 457, 4.6 KB (checked in by Carsten, 4 months ago)

Using UltraEdit's multi-line search-and-replace-in-files feature, replaced


^#ifndef _(CAFU|CF|CFS|CA)_(.*)_$
^#define _\1_\2_$

with

#ifndef CAFU_\2_INCLUDED
#define CAFU_\2_INCLUDED

and


^#ifndef _(.*)_HPP_$
^#define _\1_HPP_$

with

#ifndef CAFU_\1_HPP_INCLUDED
#define CAFU_\1_HPP_INCLUDED

Closes #91.

Line 
1/*
2=================================================================================
3This file is part of Cafu, the open-source game engine and graphics engine
4for multiplayer, cross-platform, real-time 3D action.
5Copyright (C) 2002-2012 Carsten Fuchs Software.
6
7Cafu is free software: you can redistribute it and/or modify it under the terms
8of the GNU General Public License as published by the Free Software Foundation,
9either version 3 of the License, or (at your option) any later version.
10
11Cafu is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with Cafu. If not, see <http://www.gnu.org/licenses/>.
17
18For support and more information about Cafu, visit us at <http://www.cafu.de>.
19=================================================================================
20*/
21
22#ifndef CAFU_MAP_FACE_HPP_INCLUDED
23#define CAFU_MAP_FACE_HPP_INCLUDED
24
25#include "SurfaceInfo.hpp"
26
27#include "Math3D/BoundingBox.hpp"
28#include "Math3D/Plane3.hpp"
29
30#include <ostream>
31
32
33class EditorMatManT;
34class EditorMaterialI;
35class MapBrushT;
36class Renderer3DT;
37namespace MatSys { class RenderMaterialT; }
38class wxColour;
39
40
41class MapFaceT
42{
43    public:
44
45    MapFaceT(EditorMaterialI* Material=NULL);
46    MapFaceT(EditorMaterialI* Material, const Plane3fT& Plane, const Vector3fT* PlanePoints, bool FaceAligned);
47
48    // Named constructors for loading faces from map files.
49    static MapFaceT Create_cmap(TextParserT& TP, EditorMatManT& MatMan);
50    static MapFaceT Create_D3_map(TextParserT& TP, const Vector3fT& Origin, EditorMatManT& MatMan);
51    static MapFaceT Create_HL1_map(TextParserT& TP, EditorMatManT& MatMan);
52    static MapFaceT Create_HL2_vmf(TextParserT& TP, EditorMatManT& MatMan);
53
54
55    void Save_cmap(std::ostream& OutFile) const;
56    void Render3DBasic(MatSys::RenderMaterialT* RenderMat, const wxColour& MeshColor, const int MeshAlpha) const;
57    void Render3D(Renderer3DT& Renderer, const MapBrushT* ParentBrush) const;
58
59    void SetMaterial(EditorMaterialI* Material);
60    EditorMaterialI* GetMaterial() const { return m_Material; }
61
62    void SetSurfaceInfo(const SurfaceInfoT& SI);
63    const SurfaceInfoT& GetSurfaceInfo() const { return m_SurfaceInfo; }
64
65    const Plane3T<float>&    GetPlane         () const { return m_Plane;          }
66    const ArrayT<Vector3fT>& GetPlanePoints   () const { return m_PlanePoints;    }
67    const ArrayT<Vector3fT>& GetVertices      () const { return m_Vertices;       }
68 // const ArrayT<TexCoordT>& GetTextureCoords () const { return m_TextureCoords;  }     // Currently unused.
69 // const ArrayT<TexCoordT>& GetLightmapCoords() const { return m_LightmapCoords; }     // Currently unused.
70
71    // "Advanced" query methods, all constant.
72    bool IsUVSpaceFaceAligned() const;    ///< Determines whether the uv-space of this face is  face-aligned. The uv-space of this face is  face-aligned when both UAxis and VAxis are orthogonal to m_Plane.Normal.
73    bool IsUVSpaceWorldAligned() const;   ///< Determines whether the uv-space of this face is world-aligned. The uv-space of this face is world-aligned when both UAxis and VAxis are in the same principal plane.
74
75
76    private:
77
78    friend class MapBrushT;
79    friend class EditSurfacePropsDialogT;   // The EditSurfacePropsDialogT is granted access, among others, to our m_IsSelected member (which is for use by the EditSurfacePropsDialogT only).
80
81    void      UpdateTextureSpace();     ///< Uses the m_SurfaceInfo to re-calculate, for each vertex, the texture coords, the lightmap coords, the tangents and the bi-tangents.
82    Vector3fT GetCenter() const;
83
84    EditorMaterialI*  m_Material;       ///< The material that is applied to this face as specified in m_SurfaceInfo.
85    SurfaceInfoT      m_SurfaceInfo;    ///< The surface info that specifies how the m_Material is applied to this face.
86    Plane3T<float>    m_Plane;
87    ArrayT<Vector3fT> m_PlanePoints;    ///< The three points that define the m_Plane.
88    ArrayT<Vector3fT> m_Vertices;       ///< The vertices of the polygon that this face contributes to its brush.
89    ArrayT<TexCoordT> m_TextureCoords;  ///< An array of texture  coordinates, one per face point.
90    ArrayT<TexCoordT> m_LightmapCoords; ///< An array of lightmap coordinates, one per face point.
91    ArrayT<Vector3fT> m_Tangents;
92    ArrayT<Vector3fT> m_BiTangents;
93    bool              m_IsSelected;     ///< Is this face selected? (For use by the "Edit Surface Properties" dialog only!)
94};
95
96#endif
Note: See TracBrowser for help on using the browser.