27 namespace Hydrax{
namespace Module
55 , mVerticesChoppyBuffer(0)
64 , mVerticesChoppyBuffer(0)
260 mMesh->
getSubMesh()->vertexData =
new Ogre::VertexData();
261 mMesh->
getSubMesh()->vertexData->vertexStart = 0;
262 mMesh->
getSubMesh()->vertexData->vertexCount = numVertices;
264 Ogre::VertexDeclaration* vdecl = mMesh->
getSubMesh()->vertexData->vertexDeclaration;
265 Ogre::VertexBufferBinding* vbind = mMesh->
getSubMesh()->vertexData->vertexBufferBinding;
273 vdecl->addElement(0, 0, Ogre::VET_FLOAT3, Ogre::VES_POSITION);
274 offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3);
275 vdecl->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_NORMAL);
280 Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
286 vdecl->addElement(0, 0, Ogre::VET_FLOAT3, Ogre::VES_POSITION);
291 Ogre::HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
298 unsigned int *indexbuffer =
new unsigned int[numEle];
302 indexbuffer[k*3+2] = 0;
303 indexbuffer[k*3+1] = k+1;
307 indexbuffer[k*3] = k+2;
311 indexbuffer[k*3] = 1;
346 Ogre::HardwareBufferManager::getSingleton().createIndexBuffer(
347 Ogre::HardwareIndexBuffer::IT_32BIT,
349 Ogre::HardwareBuffer::HBU_STATIC,
true);
357 delete []indexbuffer;
361 mMesh->
getSubMesh()->indexData->indexStart = 0;
362 mMesh->
getSubMesh()->indexData->indexCount = numEle;
536 Ogre::Vector3 vec1, vec2, normal;
543 vec2 = Ogre::Vector3(
544 Vertices[1].
x-Vertices[1+Steps_4*2].
x,
545 Vertices[1].
y-Vertices[1+Steps_4*2].
y,
546 Vertices[1].
z-Vertices[1+Steps_4*2].
z);
548 vec1 = Ogre::Vector3(
549 Vertices[1+Steps_4].
x - Vertices[1+Steps_4*3].
x,
550 Vertices[1+Steps_4].
y - Vertices[1+Steps_4*3].
y,
551 Vertices[1+Steps_4].
z - Vertices[1+Steps_4*3].
z);
553 normal = vec2.crossProduct(vec1);
555 Vertices[0].
nx = normal.x;
556 Vertices[0].
ny = normal.y;
557 Vertices[0].
nz = normal.z;
562 vec2 = Ogre::Vector3(
563 Vertices[
x + 2].
x-Vertices[
x].
x,
564 Vertices[
x + 2].
y-Vertices[
x].
y,
565 Vertices[
x + 2].
z-Vertices[
x].
z);
567 vec1 = Ogre::Vector3(
572 normal = vec2.crossProduct(vec1);
574 Vertices[1+
x].
nx = normal.x;
575 Vertices[1+
x].
ny = normal.y;
576 Vertices[1+
x].
nz = normal.z;
584 vec2 = Ogre::Vector3(
589 vec1 = Ogre::Vector3(
594 normal = vec2.crossProduct(vec1);
620 Ogre::Vector2 Current, NearStep, CircleStep,
632 Proportion = Ogre::Vector2(
634 (Current-NearStep).length(),
636 (Current-CircleStep).length());
641 Perp = Dir.perpendicular();
643 if (Dir.x < 0) Dir.x = -Dir.x;
644 if (Dir.y < 0) Dir.y = -Dir.y;
646 if (Perp.x < 0) Perp.x = -Perp.x;
647 if (Perp.y < 0) Perp.y = -Perp.y;
649 Norm = Ogre::Vector3(
654 Norm2 = Ogre::Vector2(
Norm.x,
Norm.z) *
655 ( (Dir * Proportion.x) +
656 (Perp * Proportion.y)) *