diff --git a/Projects/Skylicht/Collision/Source/Decal/CDecalsRenderer.cpp b/Projects/Skylicht/Collision/Source/Decal/CDecalsRenderer.cpp index 82912858c..06ed8ef37 100644 --- a/Projects/Skylicht/Collision/Source/Decal/CDecalsRenderer.cpp +++ b/Projects/Skylicht/Collision/Source/Decal/CDecalsRenderer.cpp @@ -147,7 +147,7 @@ namespace Skylicht r1.rotationFromTo(core::vector3df(0.0f, 1.0f, 0.0f), decal->Normal); core::quaternion r2; - r2.fromAngleAxis(-decal->TextureRotation * core::DEGTORAD, core::vector3df(0.0f, 1.0f, 0.0f)); + r2.fromAngleAxis(decal->TextureRotation * core::DEGTORAD, core::vector3df(0.0f, 1.0f, 0.0f)); core::quaternion q = r2 * r1; @@ -178,17 +178,21 @@ namespace Skylicht uvMatrix.transformVect(uvTriangle.pointB); uvMatrix.transformVect(uvTriangle.pointC); - // Fill vertices and indices { video::SColor color(255, 255, 255, 255); for (u32 p = 0; p < 3; p++) { - core::vector3df uvPos = uvTriangle.pointA * uvScale + uvOffset; - core::vector3df pos = triangle.pointA; + core::vector3df uvPos; + core::vector3df pos; - if (p == 1) + if (p == 0) + { + uvPos = uvTriangle.pointA * uvScale + uvOffset; + pos = triangle.pointA; + } + else if (p == 1) { uvPos = uvTriangle.pointB * uvScale + uvOffset; pos = triangle.pointB; diff --git a/Samples/Collision/Source/CViewDemo.cpp b/Samples/Collision/Source/CViewDemo.cpp index 8feca2dfd..937680e91 100644 --- a/Samples/Collision/Source/CViewDemo.cpp +++ b/Samples/Collision/Source/CViewDemo.cpp @@ -59,7 +59,7 @@ bool CViewDemo::OnEvent(const SEvent& event) m_mouseX = (float)event.MouseInput.X; m_mouseY = (float)event.MouseInput.Y; - if (event.MouseInput.isLeftPressed()) + if (event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP) { // press if (m_currentTest == 2) @@ -116,7 +116,7 @@ void CViewDemo::onUpdate() box.MaxEdge = intersection + halfBox; sceneDebug->addBoudingBox(box, SColor(255, 0, 255, 0)); - // query + // query triangles core::array listTris; core::array listNodes; @@ -133,7 +133,7 @@ void CViewDemo::onUpdate() core::vector3df normal = triangle.getNormal(); normal.normalize(); - // draw bbox query + // draw decal projection box core::aabbox3df box; core::vector3df halfBox = core::vector3df(m_decalSizeX * 0.5f, m_decalSizeY * 0.5f, m_decalSizeZ * 0.5f); box.MinEdge = -halfBox; @@ -143,7 +143,7 @@ void CViewDemo::onUpdate() r1.rotationFromTo(core::vector3df(0.0f, 1.0f, 0.0f), normal); core::quaternion r2; - r2.fromAngleAxis(-m_decalRotation * core::DEGTORAD, core::vector3df(0.0f, 1.0f, 0.0f)); + r2.fromAngleAxis(m_decalRotation * core::DEGTORAD, core::vector3df(0.0f, 1.0f, 0.0f)); core::quaternion q = r2 * r1;