SO3Engine
|
SO3RayCast.cpp
Go to the documentation of this file.
135 Ogre::VertexData* vertex_data = submesh->useSharedVertices ? mesh->sharedVertexData : submesh->vertexData;
180 Ogre::uint32* pLong = static_cast<Ogre::uint32*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
188 Ogre::uint16* pShort = static_cast<Ogre::uint16*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
200SRaycastResult SRaycast::Cast(SCamera* camera, const float& relativePosX, const float& relativePosY, Ogre::SubEntity* subEntity, bool getUvCoordonate)
202 SRaycastResult results = Cast(camera->GetOgreCameraPointer(), relativePosX, relativePosY, subEntity, getUvCoordonate);
208SRaycastResult SRaycast::Cast(Ogre::Camera* camera, const float& relativePosX, const float& relativePosY, Ogre::SubEntity* subEntity, bool getUvCoordonate)
223 results.material = results.scene->GetMaterial(results.entity->GetGroupName(), subEntity->getMaterial()->getName());
261 Ogre::uint32* pLong = static_cast<Ogre::uint32*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
267 Ogre::uint16* pShort = static_cast<Ogre::uint16*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
288 vertex_data = submesh->useSharedVertices ? parentEntity->_getSkelAnimVertexData() : subEntity->_getSkelAnimVertexData();
289 else if (!useSoftwareBlendingVertices && useSoftwareMorphingVertices && parentEntity->_isAnimated() && (parentEntity->getMesh()->getPoseList().size() == 0))
290 vertex_data = submesh->useSharedVertices ? parentEntity->_getSoftwareVertexAnimVertexData() : subEntity->_getSoftwareVertexAnimVertexData();
292 vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
294 const Ogre::VertexElement* posElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
295 Ogre::HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());
298 unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
336 // Get hit point uv coordinates, see the end of this page for an explanation: http://www.blackpawn.com/texts/pointinpoly/default.html
339 Ogre::VertexData* vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
340 const Ogre::VertexElement* vertex_element = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES);
347 Ogre::HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(vertex_element->getSource());
348 unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
350 vertex_element->baseVertexPointerToElement(vertex + indices[closestVerticeIndex] * vbuf->getVertexSize(), &pReal1);
351 vertex_element->baseVertexPointerToElement(vertex + indices[closestVerticeIndex + 1] * vbuf->getVertexSize(), &pReal2);
397SRaycastResult SRaycast::Cast(SScene* sm, Ogre::Vector3 pos, Ogre::Vector3 dir, Ogre::Real maxdist, bool getUvCoordonate)
419 if (((closestDist >= 0.0f) && (closestDist < queryResult[qr_idx].distance)) || closestDist >= maxdist)
427 if ((queryResult[qr_idx].movable != NULL) && (queryResult[qr_idx].movable->getMovableType().compare("Entity") == 0))
500 results.material = sm->GetMaterial(results.entity->GetGroupName(), subEntity->getMaterial()->getName());
524 std::pair<bool, Ogre::Real> hit = Ogre::Math::intersects(ray, vertices[indices[j]], vertices[indices[j + 1]], vertices[indices[j + 2]], true, false);
543 // Get hit point uv coordinates, see the end of this page for an explanation: http://www.blackpawn.com/texts/pointinpoly/default.html
546 Ogre::VertexData* vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
547 const Ogre::VertexElement* vertex_element1 = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES);
554 Ogre::HardwareVertexBufferSharedPtr vbuf1 = vertex_data->vertexBufferBinding->getBuffer(vertex_element1->getSource());
555 unsigned char* vertex1 = static_cast<unsigned char*>(vbuf1->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
560 const Ogre::VertexElement* vertex_element2 = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES);
561 Ogre::HardwareVertexBufferSharedPtr vbuf2 = vertex_data->vertexBufferBinding->getBuffer(vertex_element2->getSource());
562 unsigned char* vertex2 = static_cast<unsigned char*>(vbuf2->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
567 const Ogre::VertexElement* vertex_element3 = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES);
568 Ogre::HardwareVertexBufferSharedPtr vbuf3 = vertex_data->vertexBufferBinding->getBuffer(vertex_element3->getSource());
614void SRaycast::GetSubEntityInformation(Ogre::SubEntity* subEntity, size_t &vertex_count, Ogre::Vector3* &vertices, size_t &index_count, unsigned long* &indices)
645 vertex_data = submesh->useSharedVertices ? parentEntity->_getSkelAnimVertexData() : subEntity->_getSkelAnimVertexData();
646 else if(!useSoftwareBlendingVertices && useSoftwareMorphingVertices && parentEntity->_isAnimated() && (parentEntity->getMesh()->getPoseList().size() == 0))
647 vertex_data = submesh->useSharedVertices ? parentEntity->_getSoftwareVertexAnimVertexData() : subEntity->_getSoftwareVertexAnimVertexData();
649 vertex_data = submesh->useSharedVertices ? submesh->parent->sharedVertexData : submesh->vertexData;
651 const Ogre::VertexElement* posElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
652 Ogre::HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(posElem->getSource());
655 unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
671 Ogre::uint32* pLong = static_cast<Ogre::uint32*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
674 Ogre::uint32* pLong = static_cast<Ogre::uint32*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
680 Ogre::uint16* pShort = static_cast<Ogre::uint16*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
Definition SO3Camera.h:43
static SRaycastResult Cast(SCamera *camera, const float &relativePosX, const float &relativePosY, Ogre::SubEntity *subEntity, bool getUvCoordonate=false)
Definition SO3RayCast.cpp:200
static void GetMeshInformation(const Ogre::MeshPtr mesh, size_t &vertex_count, Ogre::Vector3 *&vertices, size_t &index_count, unsigned long *&indices, const Ogre::Vector3 &position, const Ogre::Quaternion &orient, const Ogre::Vector3 &scale)
Definition SO3RayCast.cpp:86
Definition SO3RayCast.h:41
Definition SO3Scene.h:125
SMaterial * GetMaterial(const std::string &groupName, const std::string &materialName, bool searchOtherGroups=true)
Definition SO3Scene.cpp:1099
Definition SO3DataScol.h:38
Generated by 1.9.8