-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The camera is updated now with the display settings, retrieving the correct screen size.
- Loading branch information
1 parent
f7cdc6f
commit faedb3d
Showing
9 changed files
with
287 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
using Evergine.Common.Graphics; | ||
using Evergine.Common.Graphics.Raytracing; | ||
using Evergine.Mathematics; | ||
|
||
namespace Evergine.Mocks | ||
{ | ||
internal class MockCommandBuffer : CommandBuffer | ||
{ | ||
public override string Name { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } | ||
|
||
protected override GraphicsContext GraphicsContext => throw new NotImplementedException(); | ||
|
||
public override void Begin() | ||
{ | ||
} | ||
|
||
public override void BeginDebugMarker(string label) | ||
{ | ||
} | ||
|
||
public override void BeginQuery(QueryHeap heap, uint index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override BottomLevelAS BuildRaytracingAccelerationStructure(BottomLevelASDescription blas) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override TopLevelAS BuildRaytracingAccelerationStructure(TopLevelASDescription tlas) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Commit() | ||
{ | ||
} | ||
|
||
public override void Dispatch(uint groupCountX, uint groupCountY, uint groupCountZ) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DispatchIndirect(Common.Graphics.Buffer argBuffer, uint offset) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DispatchRays(DispatchRaysDescription description) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Dispose() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Draw(uint vertexCount, uint startVertexLocation = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DrawIndexed(uint indexCount, uint startIndexLocation = 0, uint baseVertexLocation = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DrawIndexedInstanced(uint indexCountPerInstance, uint instanceCount, uint startIndexLocation = 0, uint baseVertexLocation = 0, uint startInstanceLocation = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DrawIndexedInstancedIndirect(Common.Graphics.Buffer argBuffer, uint offset, uint drawCount, uint stride) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DrawInstanced(uint vertexCountPerInstance, uint instanceCount, uint startVertexLocation = 0, uint startInstanceLocation = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void DrawInstancedIndirect(Common.Graphics.Buffer argBuffer, uint offset, uint drawCount, uint stride) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void EndDebugMarker() | ||
{ | ||
} | ||
|
||
public override void EndQuery(QueryHeap heap, uint index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void GenerateMipmaps(Texture texture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void InsertDebugMarker(string label) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Reset() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void ResourceBarrierUnorderedAccessView(Common.Graphics.Buffer buffer) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void ResourceBarrierUnorderedAccessView(Texture texture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void SetIndexBuffer(Common.Graphics.Buffer buffer, IndexFormat format = IndexFormat.UInt16, uint offset = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void SetResourceSet(ResourceSet resourceSet, uint index = 0, uint[] constantBufferOffsets = null!) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void SetScissorRectangles(Rectangle[] rectangles) | ||
{ | ||
} | ||
|
||
public override void SetVertexBuffer(uint slot, Common.Graphics.Buffer buffer, uint offset) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void SetVertexBuffers(Common.Graphics.Buffer[] buffers, int[] offsets) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void SetViewports(Viewport[] viewports) | ||
{ | ||
} | ||
|
||
public override void UpdateRaytracingAccelerationStructure(ref TopLevelAS tlas, TopLevelASDescription newDescription) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void WriteTimestamp(QueryHeap heap, uint index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void BeginRenderPassInternal(ref RenderPassDescription description) | ||
{ | ||
} | ||
|
||
protected override void Blit(Texture source, uint sourceX, uint sourceY, uint sourceZ, uint sourceMipLevel, uint sourceBasedArrayLayer, Texture destination, uint destinationX, uint destinationY, uint destinationZ, uint destinationMipLevel, uint destinationBasedArrayLayer, uint layerCount) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void CopyBufferDataToInternal(Common.Graphics.Buffer origin, Common.Graphics.Buffer destination, uint sizeInBytes, uint sourceOffset = 0, uint destinationOffset = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void CopyTextureDataToInternal(Texture source, uint sourceX, uint sourceY, uint sourceZ, uint sourceMipLevel, uint sourceBasedArrayLayer, Texture destination, uint destinationX, uint destinationY, uint destinationZ, uint destinationMipLevel, uint destinationBasedArrayLayer, uint width, uint height, uint depth, uint layerCount) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void EndInternal() | ||
{ | ||
} | ||
|
||
protected override void EndRenderPassInternal() | ||
{ | ||
} | ||
|
||
protected override void SetComputePipelineStateInternal(ComputePipelineState pipeline) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void SetGraphicsPipelineStateInternal(GraphicsPipelineState pipeline) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void SetRaytracingPipelineStateInternal(RaytracingPipelineState pipeline) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
protected override void UpdateBufferDataInternal(Common.Graphics.Buffer buffer, IntPtr source, uint sourceSizeInBytes, uint destinationOffsetInBytes = 0) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Evergine.Common.Graphics; | ||
|
||
namespace Evergine.Mocks | ||
{ | ||
internal class MockFrameBuffer : FrameBuffer | ||
{ | ||
public override string Name | ||
{ | ||
get => throw new NotImplementedException(); | ||
set => throw new NotImplementedException(); | ||
} | ||
|
||
public override bool RequireFlipProjection => false; | ||
|
||
public MockFrameBuffer(FrameBufferAttachment? depthTarget, FrameBufferAttachment[] colorTargets) | ||
{ | ||
this.DepthStencilTarget = depthTarget; | ||
this.ColorTargets = colorTargets; | ||
|
||
if (depthTarget.HasValue) | ||
{ | ||
var textureDescription = depthTarget.Value.Texture.Description; | ||
this.Width = textureDescription.Width; | ||
this.Height = textureDescription.Height; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Evergine.Framework; | ||
using Evergine.Framework.Graphics; | ||
using Evergine.Mocks; | ||
using System; | ||
using Xunit; | ||
|
||
namespace Sample.Tests | ||
{ | ||
public class Camera3dShould | ||
{ | ||
private readonly Camera3D camera3d; | ||
|
||
private readonly MockWindowsSystem windowsSystem; | ||
|
||
public Camera3dShould() | ||
{ | ||
this.camera3d = new Camera3D(); | ||
var entity = new Entity() | ||
.AddComponent(new Transform3D()) | ||
.AddComponent(this.camera3d); | ||
var scene = new MockScene(); | ||
scene.Add(entity); | ||
var application = new MyApplication(); | ||
this.windowsSystem = MockWindowsSystem.Create(application, scene); | ||
} | ||
|
||
[Fact] | ||
public void ProvideValidAspectRatio() | ||
{ | ||
// Arrange | ||
|
||
// Act | ||
this.windowsSystem.RunOneLoop(TimeSpan.FromSeconds(1d / 60)); | ||
|
||
// Assert | ||
Assert.NotEqual(-1, this.camera3d.AspectRatio); | ||
} | ||
} | ||
} |