From ddbe89615d5aa63baa66501ac5707c214df5c0ba Mon Sep 17 00:00:00 2001 From: tymmkang Date: Sun, 8 Mar 2026 12:21:33 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=ED=8A=B8=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/MainScene.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/MainScene.cpp b/Source/MainScene.cpp index 9422774..e9dab68 100644 --- a/Source/MainScene.cpp +++ b/Source/MainScene.cpp @@ -92,10 +92,27 @@ bool MainScene::init() // Add Lights // Directional Light: Like sunlight, creating shadows/depth - auto dirLight = DirectionLight::create(Vec3(-1.0f, -1.0f, -0.5f), Color3B::WHITE); + Vec3 lightDir(-1.0f, -1.0f, -0.5f); + auto dirLight = DirectionLight::create(lightDir, Color3B::WHITE); dirLight->setCameraMask((unsigned short)CameraFlag::USER1); this->addChild(dirLight); + // Visual marker for the Directional Light source + auto lightMarker = MeshRenderer::create("cube.obj"); + if (lightMarker) + { + // Normalize direction and place the marker 20 units away from the center + Vec3 normalizedDir = lightDir; + normalizedDir.normalize(); + Vec3 markerPos = gridCenter - (normalizedDir * 20.0f); + + lightMarker->setPosition3D(markerPos); + lightMarker->setScale(0.5f); + lightMarker->setColor(Color3B::YELLOW); + lightMarker->setCameraMask((unsigned short)CameraFlag::USER1); + this->addChild(lightMarker); + } + // Ambient Light: To ensure dark sides are still somewhat visible auto ambLight = AmbientLight::create(Color3B(80, 80, 80)); ambLight->setCameraMask((unsigned short)CameraFlag::USER1);