INNER CODE UNIT · C++
skyEntity
meta4d-me/CatDogEngine · Engine/Source/Editor/EditorApp.cpp:326
engine::Entity skyEntity = pWorld->CreateEntity();
m_pSceneWorld->SetSkyEntity(skyEntity);
auto& nameComponent = pWorld->CreateComponent<engine::NameComponent>(skyEntity);
nameComponent.SetName("Sky");
auto& skyComponent = pWorld->CreateComponent<engine::SkyComponent>(skyEntity);
if (IsAtmosphericScatteringEnable())
{
skyComponent.SetSunDirection(cd::Direction(-0.1f, -0.9f, 0.5f));
skyComponent.SetHeightOffset(1.0f);
skyComponent.SetShadowLength(0.1f);
skyComponent.SetAtmophericScatteringEnable(true);
}
cd::VertexFormat vertexFormat;
vertexFormat.AddVertexAttributeLayout(cd::VertexAttributeType::Position, cd::AttributeValueType::Float, 3);
m_pRenderContext->CreateVertexLayout(engine::StringCrc("PosistionOnly"), vertexFormat.GetVertexAttributeLayouts());