라이트 위치 표시
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user