RenderTargetGroup GetData, Shader uint support

This commit is contained in:
Simon Lübeß
2022-05-25 22:00:11 +02:00
parent 1418063d68
commit 28f1fad464
19 changed files with 354 additions and 44 deletions
+24 -2
View File
@@ -8,7 +8,7 @@ namespace GlitchyEngine.World
{
public class EcsWorld
{
const int MaxEntities = 1024;
const int MaxEntities = 16348;
internal typealias BitmaskEntry = (EcsEntity ID, BitArray ComponentMask);
internal List<BitmaskEntry> _entities = new .();
@@ -149,6 +149,28 @@ namespace GlitchyEngine.World
}
}
/// Returns whether the given entity is valid or not.
public bool IsValid(EcsEntity entity)
{
if(entity.Index > _entities.Count)
return false;
var listEntity = ref _entities[entity.Index];
return entity == listEntity.ID;
}
/// Returns the entity with the same ID and the current version. Or null, if no such entity exists.
public EcsEntity? GetCurrentVersion(EcsEntity entity)
{
if(entity.Index > _entities.Count)
return null;
var listEntity = ref _entities[entity.Index];
return listEntity.ID;
}
/**
* Assigns a component of type T to the specified entity and returns it.
*/
@@ -208,7 +230,7 @@ namespace GlitchyEngine.World
listEntity.ComponentMask[entry.Id] = false;
}
public void RemoveComponent<T>(EcsEntity entity) where T : struct, new, IDisposableComponent
{
if(entity.Index > _entities.Count)
+3 -3
View File
@@ -48,7 +48,7 @@ namespace GlitchyEngine.World
{
}
public void UpdateRuntime(GameTime gameTime, RenderTarget2D finalTarget)
public void UpdateRuntime(GameTime gameTime, RenderTargetGroup finalTarget)
{
Debug.Profiler.ProfileRendererFunction!();
@@ -111,7 +111,7 @@ namespace GlitchyEngine.World
}
}
public void UpdateEditor(GameTime gameTime, EditorCamera camera, RenderTarget2D viewportTarget, delegate void() DebugDraw3D, delegate void() DrawDebug2D)
public void UpdateEditor(GameTime gameTime, EditorCamera camera, RenderTargetGroup viewportTarget, delegate void() DebugDraw3D, delegate void() DrawDebug2D)
{
Debug.Profiler.ProfileRendererFunction!();
@@ -124,7 +124,7 @@ namespace GlitchyEngine.World
for (var (entity, transform, mesh, meshRenderer) in _ecsWorld.Enumerate<TransformComponent, MeshComponent, MeshRendererComponent>())
{
Renderer.Submit(mesh.Mesh, meshRenderer.Material, transform.WorldTransform);
Renderer.Submit(mesh.Mesh, meshRenderer.Material, entity, transform.WorldTransform);
}
for (var (entity, transform, light) in _ecsWorld.Enumerate<TransformComponent, LightComponent>())