33 , mMesh(static_cast<
Ogre::Mesh*>(0))
42 , mUnderHorizonCircles(12)
43 , mUnderHorizonFading(true)
44 , mUnderHorizonFadingExponent(0.75)
45 , mUnderHorizonFadingMultiplier(2)
46 , mRadiusMultiplier(0.95f)
47 , mMaterialName(
"_NULL_")
67 Ogre::MeshManager::getSingleton().remove(
"SkyXMesh");
90 mMesh = Ogre::MeshManager::getSingleton().createManual(
"SkyXMesh",
91 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
99 mMesh->buildEdgeList();
107 mEntity->setCastShadows(
false);
133 float r, uvr, c, s, h;
134 float currentPhiAngle, currentTethaAngle;
140 currentTethaAngle = Ogre::Math::PI/2 - AngleStep*(
y+1);
142 r = Ogre::Math::Cos(currentTethaAngle);
143 h = Ogre::Math::Sin(currentTethaAngle);
149 currentPhiAngle = Ogre::Math::TWO_PI *
x /
mSteps;
151 c = Ogre::Math::Cos(currentPhiAngle) * r;
152 s = Ogre::Math::Sin(currentPhiAngle) * r;
174 currentTethaAngle = Ogre::Math::PI/2 - AngleStep*(
y+1);
176 r = Ogre::Math::Cos(currentTethaAngle);
177 h = Ogre::Math::Sin(currentTethaAngle);
185 currentPhiAngle = Ogre::Math::TWO_PI *
x /
mSteps;
187 c = Ogre::Math::Cos(currentPhiAngle) * r;
188 s = Ogre::Math::Sin(currentPhiAngle) * r;
213 Ogre::AxisAlignedBox meshBounds =
214 Ogre::AxisAlignedBox(-Radius, 0, -Radius,
215 Radius, Radius, Radius);
217 mMesh->_setBounds(meshBounds);
227 mSubMesh->vertexData =
new Ogre::VertexData();
228 mSubMesh->vertexData->vertexStart = 0;
229 mSubMesh->vertexData->vertexCount = numVertices;
231 Ogre::VertexDeclaration* vdecl =
mSubMesh->vertexData->vertexDeclaration;
232 Ogre::VertexBufferBinding* vbind =
mSubMesh->vertexData->vertexBufferBinding;
235 vdecl->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_POSITION);
236 offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);
237 vdecl->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES, 0);
238 offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);
239 vdecl->addElement(0, offset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 1);
240 offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT2);
241 vdecl->addElement(0, offset, Ogre::VET_FLOAT1, Ogre::VES_TEXTURE_COORDINATES, 2);
244 createVertexBuffer(
sizeof(
VERTEX),
246 Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
250 unsigned short *indexbuffer =
new unsigned short[numEle];
252 for (
int k = 0; k <
mSteps; k++)
254 indexbuffer[k*3] = 0;
255 indexbuffer[k*3+1] = k+1;
259 indexbuffer[k*3+2] = k+2;
263 indexbuffer[k*3+2] = 1;
267 unsigned short *twoface;
300 Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(
301 Ogre::HardwareIndexBuffer::IT_16BIT,
303 Ogre::HardwareBuffer::HBU_STATIC,
true);
311 delete []indexbuffer;
315 mSubMesh->indexData->indexStart = 0;
316 mSubMesh->indexData->indexCount = numEle;
334 void MeshManager::setUnderHorizonParams(
const int& UnderHorizonCircles,
const bool& UnderHorizonFading,
const Ogre::Real& UnderHorizonFadingExponent,
const Ogre::Real& UnderHorizonFadingMultiplier)
356 mEntity->setMaterialName(MaterialName);
362 float cameraFarClipDistance = c->getFarClipDistance();
364 if (!cameraFarClipDistance)