Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/vcpkg_restore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@ jobs:

- name: Install nethost
run: vcpkg install nethost:x64-windows-release

- name: Install scintilla
run: vcpkg install scintilla:x64-windows-release

- name: Install lexilla
run: vcpkg install lexilla:x64-windows-release

8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,11 @@ desktop.ini
out/
3DRadSpace/Data/RecentProjects.txt
3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCa07792
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCa05476
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCa10992
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCb05476
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCb10992
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCc05476
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCd05476
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCe05476
/3DRadSpace/3DRadSpace_Editor_WindowsDX11/RCf05476
7 changes: 6 additions & 1 deletion 3DRadSpace/3DRadSpace.slnx
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<Solution />
<Solution>
<Configurations>
<Platform Name="x64" />
</Configurations>
<Project Path="Dummy/Dummy.vcxproj" Id="d87f5240-7a4a-fb1f-f513-330b76252c7e" />
</Solution>
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ using namespace Engine3DRadSpace::Math;
void AngelScriptWrapper_MessageCallback(const asSMessageInfo* msg, void* param)
{
if(msg->type == asMSGTYPE_WARNING)
SetLastWarning(std::format("({}, {}) : Warning {}", msg->section, msg->row, msg->col, msg->message));
PrintWarning(std::format("({}, {}) : Warning {}", msg->section, msg->row, msg->col, msg->message));
else if(msg->type == asMSGTYPE_INFORMATION)
SetLastMessage(std::format("({}, {}) : Information {}", msg->section, msg->row, msg->col, msg->message));
PrintMessage(std::format("({}, {}) : Information {}", msg->section, msg->row, msg->col, msg->message));
if(msg->type == asMSGTYPE_ERROR)
SetLastWarning(std::format("({}, {}) : Error {}", msg->section, msg->row, msg->col, msg->message));
PrintWarning(std::format("({}, {}) : Error {}", msg->section, msg->row, msg->col, msg->message));
}

static void v2ctor_def(Vector2* self)
Expand Down
3 changes: 3 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/3DRadSpace_CSharp.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="3DRadSpace_CSharp.csproj" />
</Solution>
12 changes: 11 additions & 1 deletion 3DRadSpace/3DRadSpace_CSharp/Audio/Sound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@ public class Sound : IDisposable

IntPtr _sound;
bool _disposed;
bool _ownsHandle;

public Sound(AudioEngine audio, string path)
{
_sound = create(audio, path);
_disposed = false;
_ownsHandle = true;
}

public Sound(IntPtr ptrSound)
{
_sound = ptrSound;
_disposed = false;
_ownsHandle = true;
}

internal Sound(IntPtr ptrSound, bool ownsHandle)
{
_sound = ptrSound;
_disposed = false;
_ownsHandle = ownsHandle;
}

public nint Handle
Expand All @@ -43,7 +53,7 @@ protected virtual void Dispose(bool disposing)
return;
}

if (_sound != 0)
if (_sound != 0 && _ownsHandle)
{
destroy(_sound);
_sound = 0;
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Audio/SoundInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public SoundInstance(IntPtr ptrSI) : base(ptrSI, destroy)
{
}

internal SoundInstance(IntPtr ptrSI, bool ownsHandle) : base(ptrSI, ownsHandle ? destroy : null)
{
}

public float Pitch
{
get => getPitch(_handle);
Expand Down
6 changes: 5 additions & 1 deletion 3DRadSpace/3DRadSpace_CSharp/Graphics/Effect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public Effect(IntPtr handle) : base(handle, _destroy)
{
}

internal Effect(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public void SetAll()
{
_setAll(_handle);
Expand Down Expand Up @@ -99,6 +103,6 @@ public void SetSampler(ISamplerState samplerState, int idx, int shaderID)

public IShader GetShader(int shaderID)
{
return new InstIShader(_getShader(_handle, shaderID));
return new InstIShader(_getShader(_handle, shaderID), ownsHandle: false);
}
}
4 changes: 2 additions & 2 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/EffectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public void AddEffect(string name, Effect effect)

public Effect GetEffect(string name)
{
return new Effect(_getEffect(_handle, name));
return new Effect(_getEffect(_handle, name), ownsHandle: false);
}

public IShader GetShader(string name)
{
return new InstIShader(_getShader(_handle, name));
return new InstIShader(_getShader(_handle, name), ownsHandle: false);
}
}
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstGPUBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public InstGPUBuffer(IntPtr handle) : base(handle)
{
}

protected InstGPUBuffer(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public void EndRead()
{
_end(_handle);
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstGPUMultiBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public InstGPUMultiBuffer(IntPtr handle) : base(handle)
{
}

protected InstGPUMultiBuffer(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public void EndRead(ulong subresource)
{
_endRead(_handle, subresource);
Expand Down
6 changes: 5 additions & 1 deletion 3DRadSpace/3DRadSpace_CSharp/Graphics/InstGPUResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ protected InstGPUResource(IntPtr handle) : base(handle, _destroy)
{
}

public IGraphicsDevice GraphicsDevice => new InstIGraphicsDevice(_device(_handle));
protected InstGPUResource(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public IGraphicsDevice GraphicsDevice => new InstIGraphicsDevice(_device(_handle), ownsHandle: false);

public IntPtr GPUHandle => _natHandle(_handle);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ public InstIDepthStencilBuffer(IntPtr handle) : base(handle)
{
}

internal InstIDepthStencilBuffer(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public IntPtr GetDepthTextureHandle()
{
return _depthHandle(_handle);
}
public ITexture2D GetDepthTexture()
{
return new InstITexture2D(_depthTexture(_handle));
return new InstITexture2D(_depthTexture(_handle), ownsHandle: false);
}

public ITexture2D CloneDepthTexture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public InstIDepthStencilState(IntPtr handle) : base(handle)
{
}

internal InstIDepthStencilState(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public uint StencilRef()
{
return _ref(_handle);
Expand Down
14 changes: 9 additions & 5 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstIGraphicsDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ public InstIGraphicsDevice(IntPtr handle) : base(handle, _destroy)
{
}

internal InstIGraphicsDevice(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public string BackendName()
{
return _backendName(_handle);
Expand Down Expand Up @@ -484,27 +488,27 @@ public IVertexBuffer CreateVertexBuffer(nint data, ulong structSize, ulong numVe

public IRenderTarget GetBackBuffer()
{
return new InstIRenderTarget(_getbackBuffer(_handle));
return new InstIRenderTarget(_getbackBuffer(_handle), ownsHandle: false);
}

public ITexture2D GetBackBufferTexture()
{
return new InstITexture2D(_getbackBuffer(_handle));
return new InstITexture2D(_getbackBuffer(_handle), ownsHandle: false);
}

public IDepthStencilBuffer GetDepthBuffer()
{
return new InstIDepthStencilBuffer(_getDepthBuffer(_handle));
return new InstIDepthStencilBuffer(_getDepthBuffer(_handle), ownsHandle: false);
}

public IDepthStencilState GetDepthStencilState()
{
return new InstIDepthStencilState(_getdepthStencilState(_handle));
return new InstIDepthStencilState(_getdepthStencilState(_handle), ownsHandle: false);
}

public IRasterizerState GetRasterizerState()
{
return new InstIRasterizerState(_getRasterizerState(_handle));
return new InstIRasterizerState(_getRasterizerState(_handle), ownsHandle: false);
}

public Point GetResolution()
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstIIndexBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public InstIIndexBuffer(IntPtr handle) : base(handle)
{
}

internal InstIIndexBuffer(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public void Set(uint index)
{
_set(_handle, index);
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstIRasterizerState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ public class InstIRasterizerState : InstGPUResource, IRasterizerState
public InstIRasterizerState(IntPtr handle) : base(handle)
{
}

internal InstIRasterizerState(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}
}
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstIRenderTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public InstIRenderTarget(IntPtr handle) : base(handle, _destroy)
{
}

internal InstIRenderTarget(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public IntPtr RenderTargetHandle
{
get
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstIShader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public InstIShader(IntPtr handle) : base(handle, _destroy)

}

internal InstIShader(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public string EntryName
{
get => Marshal.PtrToStringAnsi(_entryName(_handle));
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstITexture2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public InstITexture2D(IntPtr handle) : base(handle)
{
}

internal InstITexture2D(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public Point Size
{
get
Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/InstIVertexBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public InstIVertexBuffer(IntPtr handle) : base(handle)
{
}

internal InstIVertexBuffer(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle)
{
}

public ulong TotalSize
{
get => _totalSize(_handle);
Expand Down
6 changes: 3 additions & 3 deletions 3DRadSpace/3DRadSpace_CSharp/Graphics/ModelMeshPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ public BoundingSphere BoundingSphere

public IVertexBuffer VertexBuffer
{
get => new InstIVertexBuffer(_vbuff(_handle));
get => new InstIVertexBuffer(_vbuff(_handle), ownsHandle: false);
}

public IIndexBuffer IndexBuffer
{
get => new InstIIndexBuffer(_ibuff(_handle));
get => new InstIIndexBuffer(_ibuff(_handle), ownsHandle: false);
}

public Effect Shaders
{
get => new Effect(_getEffect(_handle));
get => new Effect(_getEffect(_handle), ownsHandle: false);
set => _setEffect(_handle, value.Handle);
}

Expand Down
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/InstIGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public InstIGame(IntPtr handle) : base(handle, _destroy)
{
}

internal InstIGame(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public void Exit()
{
_exit(_handle);
Expand Down
6 changes: 5 additions & 1 deletion 3DRadSpace/3DRadSpace_CSharp/InstIService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ public abstract class InstIService : NatPtrWrapper
{
[DllImport("3DRadSpace.FFI.dll", EntryPoint = "E3DRSP_IService_Destroy")]
extern static void _destroy(IntPtr handle);

protected InstIService(IntPtr handle) : base(handle, _destroy)
{
}

protected InstIService(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}
}
4 changes: 4 additions & 0 deletions 3DRadSpace/3DRadSpace_CSharp/InstIUpdateable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ internal InstIUpdateable(IntPtr handle) : base(handle, _destroy)
{
}

protected InstIUpdateable(IntPtr handle, bool ownsHandle) : base(handle, ownsHandle ? _destroy : null)
{
}

public void Update()
{
_update(_handle);
Expand Down
Loading
Loading