many thing
This commit is contained in:
@@ -96,6 +96,11 @@
|
||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||
<DefineConstants>LINUX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Graphics\**" />
|
||||
<EmbeddedResource Remove="Graphics\**" />
|
||||
<None Remove="Graphics\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove=".nuspec" />
|
||||
<None Remove="StgSharp.Common.deps.json" />
|
||||
@@ -115,10 +120,6 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Graphics\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
||||
</Target>
|
||||
|
||||
@@ -1,207 +1,187 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="Image"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="Image.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public class Image : IImageProvider
|
||||
{
|
||||
|
||||
private byte[] _data;
|
||||
private ImageInfo _rawInfo;
|
||||
private int _pixelUpdateCount = 0;
|
||||
|
||||
internal unsafe Image()
|
||||
{
|
||||
_rawInfo = new ImageInfo();
|
||||
}
|
||||
|
||||
internal Image(
|
||||
ImageInfo information
|
||||
)
|
||||
{
|
||||
_rawInfo = information;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public class Image : IImageProvider
|
||||
{
|
||||
|
||||
private byte[] _data;
|
||||
private ImageInfo _rawInfo;
|
||||
private int _pixelUpdateCount = 0;
|
||||
|
||||
internal unsafe Image()
|
||||
{
|
||||
_rawInfo = new ImageInfo();
|
||||
}
|
||||
|
||||
internal Image(ImageInfo information)
|
||||
{
|
||||
_rawInfo = information;
|
||||
_data = [];
|
||||
|
||||
// int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel;
|
||||
}
|
||||
|
||||
public (int width, int height) Size
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => (_rawInfo.Width, _rawInfo.Height);
|
||||
}
|
||||
|
||||
public byte[] PixelBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((_data.Length == 0) || (_data == null))
|
||||
{
|
||||
GetBytes();
|
||||
return _data!;
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public (int width, int height) Size
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => (_rawInfo.Width, _rawInfo.Height);
|
||||
}
|
||||
|
||||
public byte[] PixelBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((_data.Length == 0) || (_data == null))
|
||||
{
|
||||
GetBytes();
|
||||
return _data!;
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
}
|
||||
|
||||
public ImageChannel Channel => _rawInfo.Channel;
|
||||
|
||||
/// <summary>
|
||||
/// Hash code of time pixels updated last time.
|
||||
/// <summary>
|
||||
/// Hash code of time pixels updated last time.
|
||||
/// </summary>
|
||||
public int PixelUpdateCount
|
||||
{
|
||||
get => _pixelUpdateCount;
|
||||
internal set => _pixelUpdateCount = value;
|
||||
}
|
||||
|
||||
public int ChannelCount => _rawInfo.ChannelCount;
|
||||
|
||||
public int Height
|
||||
{
|
||||
get => _rawInfo.Height;
|
||||
internal set => _rawInfo.Height = value;
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get => _rawInfo.Width;
|
||||
internal set => _rawInfo.Width = value;
|
||||
}
|
||||
|
||||
public int PixelSize => ImageInfo.GetPixelSize(_rawInfo.pixelLayout, _rawInfo.Channel);
|
||||
|
||||
public PixelChannelLayout PixelLayout
|
||||
{
|
||||
get => _rawInfo.pixelLayout;
|
||||
private set => _rawInfo.pixelLayout = value;
|
||||
}
|
||||
|
||||
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.PixelImage;
|
||||
|
||||
internal ref byte[] Data => ref _data;
|
||||
|
||||
public void FromBytes(
|
||||
byte[] stream
|
||||
) { }
|
||||
|
||||
public static unsafe Image FromFile(
|
||||
string route,
|
||||
ImageLoader loader
|
||||
)
|
||||
{
|
||||
Image ret = new Image();
|
||||
fixed (ImageInfo* iptr = &ret._rawInfo) {
|
||||
GraphicFramework.InternalLoadImage(route, iptr, loader);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Image FromMemory(
|
||||
(int width, int height) size,
|
||||
ImageChannel channel,
|
||||
byte[] stream
|
||||
)
|
||||
{
|
||||
ImageInfo _info = new ImageInfo
|
||||
{
|
||||
Height = size.height,
|
||||
Width = size.width,
|
||||
Channel = channel,
|
||||
StreamPtr = IntPtr.Zero
|
||||
};
|
||||
Image ret = new Image(_info);
|
||||
ret.PixelLayout = PixelChannelLayout.Byte;
|
||||
ret._data = stream;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Image FromMemory(
|
||||
(int width, int height) size,
|
||||
ImageChannel channel,
|
||||
PixelChannelLayout layout,
|
||||
byte[] stream
|
||||
)
|
||||
{
|
||||
ImageInfo _info = new ImageInfo
|
||||
{
|
||||
Height = size.height,
|
||||
Width = size.width,
|
||||
Channel = channel,
|
||||
StreamPtr = IntPtr.Zero
|
||||
};
|
||||
Image ret = new Image(_info);
|
||||
ret.PixelLayout = layout;
|
||||
ret._data = stream;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public unsafe byte[] GetBytes()
|
||||
{
|
||||
if (_data.Length == 0)
|
||||
{
|
||||
int size = Width * Height * ImageInfo.GetPixelSize(PixelLayout, Channel);
|
||||
_data = new Span<byte>((byte*)_rawInfo.StreamPtr, size).ToArray();
|
||||
fixed (ImageInfo* pptr = &_rawInfo) {
|
||||
GraphicFramework.InternalUnloadImage(pptr);
|
||||
}
|
||||
_rawInfo.StreamPtr = IntPtr.Zero;
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
|
||||
public Image ProvideImage()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal static Image FromMemory(
|
||||
ImageInfo info,
|
||||
byte[] data,
|
||||
int operationCount
|
||||
)
|
||||
{
|
||||
return new Image
|
||||
{
|
||||
_rawInfo = info,
|
||||
_data = data,
|
||||
_pixelUpdateCount = operationCount
|
||||
};
|
||||
}
|
||||
|
||||
byte[] ISSDSerializable.GetBytes()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
public int PixelUpdateCount
|
||||
{
|
||||
get => _pixelUpdateCount;
|
||||
internal set => _pixelUpdateCount = value;
|
||||
}
|
||||
|
||||
public int ChannelCount => _rawInfo.ChannelCount;
|
||||
|
||||
public int Height
|
||||
{
|
||||
get => _rawInfo.Height;
|
||||
internal set => _rawInfo.Height = value;
|
||||
}
|
||||
|
||||
public int Width
|
||||
{
|
||||
get => _rawInfo.Width;
|
||||
internal set => _rawInfo.Width = value;
|
||||
}
|
||||
|
||||
public int PixelSize => ImageInfo.GetPixelSize(_rawInfo.pixelLayout, _rawInfo.Channel);
|
||||
|
||||
public PixelChannelLayout PixelLayout
|
||||
{
|
||||
get => _rawInfo.pixelLayout;
|
||||
private set => _rawInfo.pixelLayout = value;
|
||||
}
|
||||
|
||||
internal ref byte[] Data => ref _data;
|
||||
|
||||
public void FromBytes(byte[] stream) { }
|
||||
|
||||
public static unsafe Image FromFile(string route, ImageLoader loader)
|
||||
{
|
||||
Image ret = new Image();
|
||||
fixed (ImageInfo* iptr = &ret._rawInfo) {
|
||||
GraphicFramework.InternalLoadImage(route, iptr, loader);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Image FromMemory((int width, int height) size, ImageChannel channel, byte[] stream)
|
||||
{
|
||||
ImageInfo _info = new ImageInfo
|
||||
{
|
||||
Height = size.height,
|
||||
Width = size.width,
|
||||
Channel = channel,
|
||||
StreamPtr = IntPtr.Zero
|
||||
};
|
||||
Image ret = new Image(_info);
|
||||
ret.PixelLayout = PixelChannelLayout.Byte;
|
||||
ret._data = stream;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Image FromMemory(
|
||||
(int width, int height) size,
|
||||
ImageChannel channel,
|
||||
PixelChannelLayout layout,
|
||||
byte[] stream)
|
||||
{
|
||||
ImageInfo _info = new ImageInfo
|
||||
{
|
||||
Height = size.height,
|
||||
Width = size.width,
|
||||
Channel = channel,
|
||||
StreamPtr = IntPtr.Zero
|
||||
};
|
||||
Image ret = new Image(_info);
|
||||
ret.PixelLayout = layout;
|
||||
ret._data = stream;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public unsafe byte[] GetBytes()
|
||||
{
|
||||
if (_data.Length == 0)
|
||||
{
|
||||
int size = Width * Height * ImageInfo.GetPixelSize(PixelLayout, Channel);
|
||||
_data = new Span<byte>((byte*)_rawInfo.StreamPtr, size).ToArray();
|
||||
fixed (ImageInfo* pptr = &_rawInfo) {
|
||||
GraphicFramework.InternalUnloadImage(pptr);
|
||||
}
|
||||
_rawInfo.StreamPtr = IntPtr.Zero;
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
|
||||
public Image ProvideImage()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
internal static Image FromMemory(ImageInfo info, byte[] data, int operationCount)
|
||||
{
|
||||
return new Image
|
||||
{
|
||||
_rawInfo = info,
|
||||
_data = data,
|
||||
_pixelUpdateCount = operationCount
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="gl.cs"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the “Software”), to deal in the Software without restriction,
|
||||
// including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
// and to permit persons to whom the Software is furnished to do so,
|
||||
// subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and
|
||||
// this permission notice shall be included in all copies
|
||||
// or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
using StgSharp.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal static partial class GraphicFramework
|
||||
{
|
||||
|
||||
internal static uint[] GLtype = new uint[16];
|
||||
|
||||
static GraphicFramework()
|
||||
{
|
||||
GLtype[(int)TypeCode.Single] = glConst.FLOAT;
|
||||
GLtype[(int)TypeCode.Int32] = glConst.INT;
|
||||
GLtype[(int)TypeCode.UInt32] = glConst.UNSIGNED_INT;
|
||||
GLtype[(int)TypeCode.Int16] = glConst.SHORT;
|
||||
GLtype[(int)TypeCode.UInt16] = glConst.UNSIGNED_SHORT;
|
||||
GLtype[(int)TypeCode.SByte] = glConst.BYTE;
|
||||
GLtype[(int)TypeCode.Byte] = glConst.UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "glCheckShaderStat")]
|
||||
[UnmanagedCallConv(CallConvs = [ typeof(CallConvCdecl) ])]
|
||||
#pragma warning disable CA5392
|
||||
internal static partial int glCheckShaderStatus(
|
||||
ref OpenglContext context,
|
||||
uint shaderHandle,
|
||||
int key,
|
||||
ref IntPtr logPtr);
|
||||
#pragma warning restore CA5392
|
||||
|
||||
|
||||
#region ssgc api define
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "initGL")]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
internal static partial void InternalInitGL(int majorVersion, int minorVersion);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "loadGlfuncDefault", StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
internal static partial IntPtr InternalLoadGlFuncDefault(string name);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "linkShaderProgram")]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
internal static unsafe partial uint InternalLinkShaderProgram(OpenglContext* context, uint shaderProgram);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "readLog")]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
internal static unsafe partial IntPtr InternalReadSSCLog();
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "loadImageData", StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
internal static unsafe partial void InternalLoadImage(string fileName, ImageInfo* output, ImageLoader loader);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "unloadImageData")]
|
||||
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
|
||||
internal static unsafe partial void InternalUnloadImage(ImageInfo* output);
|
||||
|
||||
#endregion ssgc api define
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="IGeometry"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -43,9 +43,8 @@ namespace StgSharp.Geometries
|
||||
public Point this[int index] { get; set; }
|
||||
|
||||
#pragma warning disable CA1819
|
||||
public Vec4[] VertexStream
|
||||
public Vec4[] VertexStream { get; }
|
||||
#pragma warning restore CA1819
|
||||
{ get; }
|
||||
|
||||
public CoordinationBase Coordination { get; }
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.Mathematics", "Stg
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.RegularAnalysis", "StgSharp.RegularAnalysis\StgSharp.RegularAnalysis.csproj", "{46339874-C6B8-4361-997E-2E30387E51F9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgsSharp.Graphics", "StgsSharp.Graphics\StgsSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.Graphics", "StgSharp.Graphics\StgSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// file="gl"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Internal
|
||||
{
|
||||
internal static partial class GraphicFramework
|
||||
{
|
||||
|
||||
internal static uint[] GLtype = new uint[16];
|
||||
|
||||
static GraphicFramework()
|
||||
{
|
||||
GLtype[(int)TypeCode.Single] = glConst.FLOAT;
|
||||
GLtype[(int)TypeCode.Int32] = glConst.INT;
|
||||
GLtype[(int)TypeCode.UInt32] = glConst.UNSIGNED_INT;
|
||||
GLtype[(int)TypeCode.Int16] = glConst.SHORT;
|
||||
GLtype[(int)TypeCode.UInt16] = glConst.UNSIGNED_SHORT;
|
||||
GLtype[(int)TypeCode.SByte] = glConst.BYTE;
|
||||
GLtype[(int)TypeCode.Byte] = glConst.UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "glCheckShaderStat")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
#pragma warning disable CA5392
|
||||
internal static partial int glCheckShaderStatus(
|
||||
ref OpenglContext context,
|
||||
uint shaderHandle,
|
||||
int key,
|
||||
ref IntPtr logPtr
|
||||
);
|
||||
#pragma warning restore CA5392
|
||||
|
||||
|
||||
#region ssgc api define
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "initGL")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static partial void InternalInitGL(
|
||||
int majorVersion,
|
||||
int minorVersion
|
||||
);
|
||||
|
||||
[LibraryImport(
|
||||
Native.LibName,
|
||||
EntryPoint = "loadGlfuncDefault",
|
||||
StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static partial IntPtr InternalLoadGlFuncDefault(
|
||||
string name
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "linkShaderProgram")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial uint InternalLinkShaderProgram(
|
||||
OpenglContext* context,
|
||||
uint shaderProgram
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "readLog")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial IntPtr InternalReadSSCLog();
|
||||
|
||||
[LibraryImport(
|
||||
Native.LibName,
|
||||
EntryPoint = "loadImageData",
|
||||
StringMarshalling = StringMarshalling.Utf8)]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial void InternalLoadImage(
|
||||
string fileName,
|
||||
ImageInfo* output,
|
||||
ImageLoader loader
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "unloadImageData")]
|
||||
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
|
||||
internal static unsafe partial void InternalUnloadImage(
|
||||
ImageInfo* output
|
||||
);
|
||||
|
||||
#endregion ssgc api define
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user