[Orxonox-commit 7470] r12076 - code/branches/shader_HS18/src/libraries/tools
wiesep at orxonox.net
wiesep at orxonox.net
Wed Nov 7 10:21:44 CET 2018
Author: wiesep
Date: 2018-11-07 10:21:44 +0100 (Wed, 07 Nov 2018)
New Revision: 12076
Modified:
code/branches/shader_HS18/src/libraries/tools/Mesh.cc
Log:
Added tangent vector generating
Modified: code/branches/shader_HS18/src/libraries/tools/Mesh.cc
===================================================================
--- code/branches/shader_HS18/src/libraries/tools/Mesh.cc 2018-11-07 09:21:08 UTC (rev 12075)
+++ code/branches/shader_HS18/src/libraries/tools/Mesh.cc 2018-11-07 09:21:44 UTC (rev 12076)
@@ -34,6 +34,7 @@
#include <OgreEntity.h>
#include <OgreSubEntity.h>
#include <OgreSceneManager.h>
+#include <OgreHardwareVertexBuffer.h>
#include "util/Convert.h"
#include "core/GameMode.h"
@@ -63,6 +64,7 @@
if (this->entity_)
this->scenemanager_->destroyEntity(this->entity_);
+
if (GameMode::showsGraphics())
{
try
@@ -69,6 +71,17 @@
{
this->entity_ = this->scenemanager_->createEntity("Mesh" + multi_cast<std::string>(Mesh::meshCounter_s++), meshsource);
this->entity_->setCastShadows(this->bCastShadows_);
+
+
+ unsigned short src, dest;
+ if (!this->entity_->getMesh()->suggestTangentVectorBuildParams(Ogre::VertexElementSemantic::VES_TANGENT, src, dest))
+ {
+ orxout() << "Generate Tanget for \"" << meshsource << '"' << endl;
+ this->entity_->getMesh()->buildTangentVectors(Ogre::VertexElementSemantic::VES_TANGENT, src, dest);
+ // this version cleans mirrored and rotated UVs but requires quality models
+ // mesh->buildTangentVectors(VES_TANGENT, src, dest, true, true);
+ }
+
}
catch (...)
{
More information about the Orxonox-commit
mailing list