Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
GeometryBlock.h
Go to the documentation of this file.
1/*
2--------------------------------------------------------------------------------
3This source file is part of SkyX.
4Visit http://www.paradise-studios.net/products/skyx/
5
6Copyright (C) 2009-2012 Xavier Vergu�n Gonz�lez <xavyiy@gmail.com>
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt.
21--------------------------------------------------------------------------------
22*/
23
24#ifndef _SkyX_VClouds_GeometryBlock_H_
25#define _SkyX_VClouds_GeometryBlock_H_
26
27#include "Prerequisites.h"
28
29namespace SkyX { namespace VClouds{
30
31 class VClouds;
32
34 {
35 public:
38 struct VERTEX
39 { // Position
40 float x,y,z,
41 // 3D Coords
42 xc, yc, zc,
43 // Noise coords
44 u, v,
45 // Opacity
47 };
48
64 const float& Height, const Ogre::Radian& Alpha, const Ogre::Radian& Beta,
65 const float& Radius, const Ogre::Radian& Phi, const int& Na,
66 const int& Nb, const int& Nc, const int& A,
67 const int& B, const int& C, const int& Position);
68
72
75 void create();
76
79 void remove();
80
86 void updateGeometry(Ogre::Camera* c, const Ogre::Vector3& displacement, const Ogre::Vector3& distance);
87
91 inline const bool& isCreated() const
92 {
93 return mCreated;
94 }
95
99 inline Ogre::MeshPtr getMesh()
100 {
101 return mMesh;
102 }
103
107 inline Ogre::SubMesh* getSubMesh()
108 {
109 return mSubMesh;
110 }
111
115 inline Ogre::Entity* getEntity()
116 {
117 return mEntity;
118 }
119
123 inline Ogre::HardwareVertexBufferSharedPtr &getHardwareVertexBuffer()
124 {
125 return mVertexBuffer;
126 }
127
131 inline Ogre::HardwareIndexBufferSharedPtr &getHardwareIndexBuffer()
132 {
133 return mIndexBuffer;
134 }
135
139 inline void setWorldOffset(const Ogre::Vector2& WorldOffset)
140 {
141 mWorldOffset = WorldOffset;
142 }
143
148 const bool isInFrustum(Ogre::Camera *c) const;
149
150 private:
154 const Ogre::AxisAlignedBox _buildAABox(const float& fd) const;
155
158 void _calculateDataSize();
159
162 void _createGeometry();
163
166 void _updateGeometry();
167
171 void _updateZoneCSlice(const int& n);
172
176 void _updateZoneBSlice(const int& n);
177
181 void _updateZoneASlice(const int& n);
182
188 void _setVertexData(const int& index, const Ogre::Vector3& p, const float& o);
189
192
194 Ogre::MeshPtr mMesh;
196 Ogre::SubMesh *mSubMesh;
198 Ogre::Entity *mEntity;
199
201 Ogre::HardwareVertexBufferSharedPtr mVertexBuffer;
203 Ogre::HardwareIndexBufferSharedPtr mIndexBuffer;
204
207
212
214 float mHeight;
216 Ogre::Radian mAlpha, mBeta;
218 float mRadius;
220 Ogre::Radian mPhi;
222 int mNa, mNb, mNc;
224 float mA, mB, mC;
227
229 Ogre::Vector2 mV2Cos;
230 Ogre::Vector2 mV2Sin;
232 float mBetaSin;
234
236 Ogre::Vector3 mDisplacement;
238 Ogre::Vector2 mWorldOffset;
239
243 Ogre::Camera* mCamera;
244
246 Ogre::Vector3 mDistance;
247
250 };
251
252
253}}
254
255#endif
Ogre::HardwareIndexBufferSharedPtr & getHardwareIndexBuffer()
Get hardware index buffer reference.
Ogre::MeshPtr mMesh
Ogre::MeshPtr.
int mNa
Number of slices per geometry zone.
Ogre::HardwareIndexBufferSharedPtr mIndexBuffer
Index buffer.
Ogre::SubMesh * getSubMesh()
Get sub mesh.
const bool & isCreated() const
Has been create() already called?
Ogre::SubMesh * mSubMesh
Ogre::Submesh pointer.
int mNumberOfTriangles
Current number of triangles.
Ogre::HardwareVertexBufferSharedPtr & getHardwareVertexBuffer()
Get hardware vertex buffer reference.
Ogre::Entity * mEntity
Ogre::Entity pointer.
Ogre::Radian mPhi
Acimutal angle.
float mA
A, B and C radius.
float mLastFallingDistance
Last falling distance.
void updateGeometry(Ogre::Camera *c, const Ogre::Vector3 &displacement, const Ogre::Vector3 &distance)
Update geometry.
VERTEX * mVertices
Vertices pointer.
Ogre::Vector2 mV2Cos
Precomputed Cos/Sin vectors.
void _updateZoneASlice(const int &n)
Update zone A slice.
Ogre::Radian mAlpha
Angles.
void _calculateDataSize()
Calculate data size.
void _updateZoneBSlice(const int &n)
Update zone B slice.
void setWorldOffset(const Ogre::Vector2 &WorldOffset)
Set world offset.
bool mCreated
Has been create() already called?
Ogre::MeshPtr getMesh()
Get mesh.
float mBetaSin
PI - Beta, PI - Alpha Sin.
Ogre::Camera * mCamera
Current rendering camera.
const bool isInFrustum(Ogre::Camera *c) const
Is the geometry block inside the camera frustum?
void _setVertexData(const int &index, const Ogre::Vector3 &p, const float &o)
Set vertex data.
VClouds * mVClouds
VClouds pointer.
void _createGeometry()
Create geometry.
const Ogre::AxisAlignedBox _buildAABox(const float &fd) const
Build axis aligned box.
Ogre::Vector2 mWorldOffset
World coords offset.
int mPosition
Number of block(Position)
Ogre::HardwareVertexBufferSharedPtr mVertexBuffer
Vertex buffer.
Ogre::Vector3 mDistance
Current distance.
Ogre::Vector3 mDisplacement
Displacement.
Ogre::Entity * getEntity()
Get entity.
void _updateGeometry()
Update geometry.
void _updateZoneCSlice(const int &n)
Update zone C slice.