PixelLightAPI  .
MeshCreatorCube.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: MeshCreatorCube.h                              *
00003  *
00004  *  Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/)
00005  *
00006  *  This file is part of PixelLight.
00007  *
00008  *  PixelLight is free software: you can redistribute it and/or modify
00009  *  it under the terms of the GNU Lesser General Public License as published by
00010  *  the Free Software Foundation, either version 3 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  PixelLight is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  *  GNU Lesser General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU Lesser General Public License
00019  *  along with PixelLight. If not, see <http://www.gnu.org/licenses/>.
00020 \*********************************************************/
00021 
00022 
00023 #ifndef __PLMESH_MESHCREATOR_CUBE_H__
00024 #define __PLMESH_MESHCREATOR_CUBE_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include <PLMath/Vector3.h>
00032 #include "PLMesh/Creator/MeshCreator.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Forward declarations                                  ]
00037 //[-------------------------------------------------------]
00038 namespace PLRenderer {
00039     class VertexBuffer;
00040 }
00041 
00042 
00043 //[-------------------------------------------------------]
00044 //[ Namespace                                             ]
00045 //[-------------------------------------------------------]
00046 namespace PLMesh {
00047 
00048 
00049 //[-------------------------------------------------------]
00050 //[ Classes                                               ]
00051 //[-------------------------------------------------------]
00052 /**
00053 *  @brief
00054 *    Cube mesh creator class
00055 *
00056 *  @note
00057 *    - If texture coordinates are generated each side has its own vertices
00058 *    - Order of the materials of MultiMaterials is true:
00059 *      x-positive (0), x-negative (1), y-positive (2),
00060 *      y-negative (3), z-positive (4), z-negative (5)
00061 */
00062 class MeshCreatorCube : public MeshCreator {
00063 
00064 
00065     //[-------------------------------------------------------]
00066     //[ RTTI interface                                        ]
00067     //[-------------------------------------------------------]
00068     pl_class(PLMESH_RTTI_EXPORT, MeshCreatorCube, "PLMesh", PLMesh::MeshCreator, "Cube mesh creator class")
00069         // Attributes
00070         pl_attribute(Dimension,         PLMath::Vector3,    PLMath::Vector3(0.5f, 0.5f, 0.5f),  ReadWrite,  DirectValue,    "Cube dimension into positive/negative direction around the center",    "")
00071         pl_attribute(MultiMaterials,    bool,               false,                              ReadWrite,  DirectValue,    "Should each side has it's own material?",                              "")
00072         pl_attribute(Offset,            PLMath::Vector3,    PLMath::Vector3(0.0f, 0.0f, 0.0f),  ReadWrite,  DirectValue,    "Offset to center",                                                     "")
00073         // Constructors
00074         pl_constructor_0(DefaultConstructor,    "Default constructor",  "")
00075     pl_class_end
00076 
00077 
00078     //[-------------------------------------------------------]
00079     //[ Public functions                                      ]
00080     //[-------------------------------------------------------]
00081     public:
00082         /**
00083         *  @brief
00084         *    Default constructor
00085         */
00086         PLMESH_API MeshCreatorCube();
00087 
00088         /**
00089         *  @brief
00090         *    Destructor
00091         */
00092         PLMESH_API virtual ~MeshCreatorCube();
00093 
00094 
00095     //[-------------------------------------------------------]
00096     //[ Private functions                                     ]
00097     //[-------------------------------------------------------]
00098     private:
00099         /**
00100         *  @brief
00101         *    Sets the four normal vectors of a cube side
00102         *
00103         *  @param[in] cVertexBuffer
00104         *    Vertex buffer to use
00105         *  @param[in] nSide
00106         *    Cube side
00107         *  @param[in] fX
00108         *    X component of the normal vector
00109         *  @param[in] fY
00110         *    Y component of the normal vector
00111         *  @param[in] fZ
00112         *    Z component of the normal vector
00113         */
00114         void SetNormals(PLRenderer::VertexBuffer &cVertexBuffer, PLCore::uint32 nSide, float fX, float fY, float fZ) const;
00115 
00116 
00117     //[-------------------------------------------------------]
00118     //[ Private virtual MeshCreator functions                 ]
00119     //[-------------------------------------------------------]
00120     private:
00121         virtual Mesh *Create(Mesh &cMesh, PLCore::uint32 nLODLevel = 0, bool bStatic = true) const override;
00122 
00123 
00124 };
00125 
00126 
00127 //[-------------------------------------------------------]
00128 //[ Namespace                                             ]
00129 //[-------------------------------------------------------]
00130 } // PLMesh
00131 
00132 
00133 #endif // __PLMESH_MESHCREATOR_CUBE_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:57
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported