Skip to content

Commit

Permalink
feat: #98 Fix transform bake mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamhong committed Jul 28, 2020
1 parent d0e4955 commit 6d86bc3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Projects/Skylicht/Engine/Source/Culling/CCullingSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ namespace Skylicht
CWorldInverseTransformData **invTransforms = m_invTransforms.pointer();

IRenderPipeline *rp = entityManager->getRenderPipeline();
if (rp == NULL)
return;

core::matrix4 invTrans;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace Skylicht
/*
static int t = 0;
static bool test = true;
if (CDeferredRP::isEnableRenderIndirect() == true && test == true)
if (test == true)
{
char filename[512];
sprintf(filename, "test_%d.png", t);
Expand Down
12 changes: 11 additions & 1 deletion Samples/Lightmapping/Source/CViewBakeLightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ void CViewBakeLightmap::onInit()
// set default 128px for quality
CLightmapper::getInstance()->initBaker(128);

// force update and render to compute transform (1 frame)
{
context->getScene()->update();
context->getRenderPipeline()->render(
NULL,
context->getActiveCamera(),
context->getScene()->getEntityManager(),
core::recti(0, 0, 0, 0));
}

// get all render mesh in zone
m_renderMesh = zone->getComponentsInChild<CRenderMesh>(false);
for (CRenderMesh *renderMesh : m_renderMesh)
Expand Down Expand Up @@ -235,7 +245,7 @@ void CViewBakeLightmap::onUpdate()
vertices[v3].Tangent
};

for (int i = 0; i < 4; i++)
for (int i = 0; i < 3; i++)
{
transform.transformVect(positions[i]);
transform.rotateVect(normals[i]);
Expand Down

0 comments on commit 6d86bc3

Please sign in to comment.