Basic light culling but without the culling
This commit is contained in:
@@ -18,7 +18,7 @@ PrimitiveComponent::PrimitiveComponent(PMeshAsset asset)
|
||||
for (uint32 i = 0; i < assetMeshes.size(); i++)
|
||||
{
|
||||
auto& batch = staticMeshes[i];
|
||||
batch.material = assetMeshes[i]->referencedMaterial;
|
||||
batch.material = asset->referencedMaterials[i];
|
||||
batch.isBackfaceCullingDisabled = false;
|
||||
batch.isCastingShadow = true;
|
||||
batch.primitiveComponent = this;
|
||||
|
||||
@@ -19,23 +19,14 @@ Scene::Scene(Gfx::PGraphics graphics)
|
||||
lightEnv.directionalLights[0].color = Vector4(1, 1, 1, 1);
|
||||
lightEnv.directionalLights[0].direction = Vector4(1, 1, 0, 1);
|
||||
lightEnv.directionalLights[0].intensity = Vector4(1, 1, 1, 1);
|
||||
lightEnv.numDirectionalLights = 0;
|
||||
lightEnv.numDirectionalLights = 1;
|
||||
srand((unsigned int)time(NULL));
|
||||
for(uint32 i = 0; i < MAX_POINT_LIGHTS/2; ++i)
|
||||
{
|
||||
lightEnv.pointLights[i].colorRange = Vector4(frand(), frand(), frand(), frand() * 30);
|
||||
lightEnv.pointLights[i].positionWS = Vector4(frand() * 100-50, frand(), frand() * 100-50, 1);
|
||||
lightEnv.pointLights[i].positionVS = Vector4(frand() * 100-50, frand(), frand() * 100-50, 1);
|
||||
}
|
||||
lightEnv.numPointLights = MAX_POINT_LIGHTS/2;
|
||||
|
||||
BulkResourceData lightInit;
|
||||
UniformBufferCreateInfo structuredInfo;
|
||||
lightInit.size = sizeof(LightEnv);
|
||||
lightInit.data = (uint8*)&lightEnv;
|
||||
structuredInfo.resourceData = lightInit;
|
||||
structuredInfo.bDynamic = false;
|
||||
lightBuffer = graphics->createUniformBuffer(structuredInfo);
|
||||
}
|
||||
|
||||
Scene::~Scene()
|
||||
|
||||
@@ -46,14 +46,13 @@ public:
|
||||
|
||||
const Array<PPrimitiveComponent>& getPrimitives() const { return primitives; }
|
||||
const Array<MeshBatch>& getStaticMeshes() const { return staticMeshes; }
|
||||
const Gfx::PUniformBuffer& getLightBuffer() const { return lightBuffer; }
|
||||
const LightEnv& getLightBuffer() const { return lightEnv; }
|
||||
UPSceneUpdater& getSceneUpdater() { return updater; }
|
||||
private:
|
||||
Array<MeshBatch> staticMeshes;
|
||||
Array<PActor> rootActors;
|
||||
Array<PPrimitiveComponent> primitives;
|
||||
LightEnv lightEnv;
|
||||
Gfx::PUniformBuffer lightBuffer;
|
||||
Gfx::PGraphics graphics;
|
||||
UPSceneUpdater updater;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user