/*
 * Copyright (c) 2015 - 2024 Dr. Yuriy Kotsarenko. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 */

// This file is auto-generated. Do not edit.
using System;
using System.Numerics;
using System.Runtime.InteropServices;

namespace Afterwarp
{
  public partial struct API
  {
    internal const string AfterwarpLib = "afterwarp";

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool LibraryGetVersion(out int major, out int minor, out uint build);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void LibrarySerialCode([In] byte[] serial, int length);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SwapChainCreate(IntPtr device, IntPtr windowHandle, [In] ref Point size, 
      PixelFormat format, PixelFormat depthStencil, int multisamples, [MarshalAs(UnmanagedType.U1)] bool vsync);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SwapChainDestroy(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SwapChainGetDevice(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SwapChainGetWindowHandle(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SwapChainGetWidth(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SwapChainGetHeight(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat SwapChainGetFormat(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat SwapChainGetDepthStencil(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SwapChainGetMultisamples(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SwapChainGetVSync(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SwapChainResize(IntPtr swapChain, [In] ref Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SwapChainBegin(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SwapChainEnd(IntPtr swapChain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr DeviceCreate(IntPtr application, DeviceTechnology technology, 
      uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr DeviceCreateWrapped(IntPtr application, DeviceTechnology technology, 
      uint attributes, IntPtr platformDevice);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void DeviceDestroy(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr DeviceGetPlatformDevice(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint DeviceGetAttributes(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint DeviceGetBehavior(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint DeviceGetLegacyBits(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern DeviceTechnology DeviceGetTechnology(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern DevicePlatform DeviceGetPlatform(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint DeviceGetTechVersion(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint DeviceGetTechFeatureVersion(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void DeviceResetCache(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool DeviceClear(IntPtr device, byte clearLayers, [In] ref FloatColor clearColor, 
      float clearDepth, uint clearStencil);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool DeviceSetRenderingState(IntPtr device, [In] ref RenderingState state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void DeviceGetRenderingState(IntPtr device, out RenderingState state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool DeviceSetViewport(IntPtr device, [In] ref Rect viewport);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void DeviceGetViewport(IntPtr device, out Rect viewport);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool DeviceSetScissor(IntPtr device, [In] ref Rect scissor);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void DeviceGetScissor(IntPtr device, out Rect scissor);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void DeviceMemoryBarrier(IntPtr device, uint barrierBits);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr BufferCreate(IntPtr device, BufferDataType dataType, 
      BufferAccessType accessType, uint size, uint pitch, PixelFormat format, IntPtr initialData);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void BufferDestroy(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr BufferGetDevice(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr BufferGetPlatformHandle(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern BufferDataType BufferGetDataType(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern BufferAccessType BufferGetAccessType(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint BufferGetSize(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint BufferGetPitch(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat BufferGetFormat(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool BufferUpdate(IntPtr buffer, IntPtr data, uint offset, uint size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool BufferRetrieve(IntPtr buffer, IntPtr data, uint offset, uint size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool BufferCopy(IntPtr buffer, IntPtr bufferSource, uint offsetDest, 
      uint offsetSource, uint size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ProgramCreate(IntPtr device, [In] VertexElement[] vertexElements, 
      int vertexElementCount, [In] ProgramElement[] programElements, int programElementCount, 
      [In] ProgramVariable[] programVariables, int programVariableCount, [In] byte[] shaderVertex, 
      int shaderVertexLength, [In] byte[] shaderHull, int shaderHullLength, [In] byte[] shaderDomain, 
      int shaderDomainLength, [In] byte[] shaderGeometry, int shaderGeometryLength, [In] byte[] shaderPixel, 
      int shaderPixelLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ProgramDestroy(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ProgramGetDevice(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramUpdateByIndex(IntPtr program, int variableIndex, IntPtr variableData, 
      uint size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramUpdateByName(IntPtr program, [In] byte[] variableName, 
      IntPtr variableData, uint size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramBind(IntPtr program, IntPtr buffer, uint channel, uint offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ProgramUnbind(IntPtr program, IntPtr buffer, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ProgramResetBindings(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ProgramResetCache(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramCommit(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramBegin(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ProgramEnd(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramDraw(IntPtr program, PrimitiveTopology topology, int vertexCount, 
      int baseVertex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramDrawIndexed(IntPtr program, PrimitiveTopology topology, 
      int indexCount, int firstIndex, int baseVertex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramDrawInstances(IntPtr program, PrimitiveTopology topology, 
      int vertexCount, int instanceCount, int baseVertex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramDrawInstancesIndexed(IntPtr program, PrimitiveTopology topology, 
      int indexCount, int instanceCount, int firstIndex, int baseVertex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ProgramSetPatchVertices(IntPtr program, int patchVertices);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ComputeProgramCreate(IntPtr device, [In] ProgramElement[] programElements, 
      int programElementCount, [In] byte[] shader, int shaderLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ComputeProgramDestroy(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ComputeProgramGetDevice(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ComputeProgramBindBuffer(IntPtr program, IntPtr buffer, uint channel, 
      uint offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ComputeProgramUnbindBuffer(IntPtr program, IntPtr buffer, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ComputeProgramBindTexture(IntPtr program, IntPtr texture, 
      [In] ref ComputeBindTextureFormat bindFormat);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ComputeProgramUnbindTexture(IntPtr program, IntPtr texture, 
      [In] ref ComputeBindTextureFormat bindFormat);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ComputeProgramResetBindings(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ComputeProgramCommit(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ComputeProgramBegin(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ComputeProgramEnd(IntPtr program);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ComputeProgramDispatch(IntPtr program, int groupsX, int groupsY, int groupsZ);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SamplerCreate(IntPtr device, [In] ref SamplerState samplerState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SamplerDestroy(IntPtr sampler);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SamplerGetDevice(IntPtr sampler);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SamplerGetState(IntPtr sampler, out SamplerState samplerState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SamplerSetState(IntPtr sampler, [In] ref SamplerState samplerState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SamplerBind(IntPtr sampler, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SamplerUnbind(IntPtr sampler, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCreate(IntPtr device, [In] ref TextureParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCreateFromFile(IntPtr device, [In] byte[] fileName, 
      PixelFormat format, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCreateFromFileParallax(IntPtr device, [In] byte[] fileName, 
      PixelFormat format, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCreateFromFileNormalsAndOcclusion(IntPtr device, 
      [In] byte[] fileNameNormalMap, [In] byte[] fileNameOcclusionMap, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCreateFromFileInMemory(IntPtr device, IntPtr fileContents, 
      uint contentSize, [In] byte[] extension, PixelFormat format, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCreateFromSurface(IntPtr device, IntPtr surface, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureDestroy(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureGetDevice(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureGetPlatformHandle(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureGetParameters(IntPtr texture, out TextureParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureUpdate(IntPtr texture, IntPtr content, uint pitch, int layer, 
      [In] ref Rect rect, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureRetrieve(IntPtr texture, IntPtr content, uint pitch, int layer, 
      [In] ref Rect rect, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCopy(IntPtr texture, IntPtr source, int destLayer, 
      [In] ref Point destPos, int srcLayer, [In] ref Rect sourceRect, int destMipLevel, int srcMipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCopyFromSurface(IntPtr texture, IntPtr surface, int layer, 
      [In] ref Point destPos, [In] ref Rect sourceRect, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCopyToSurface(IntPtr texture, IntPtr surface, int layer, 
      [In] ref Point destPos, [In] ref Rect sourceRect, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureLoadFromFile(IntPtr texture, [In] byte[] fileName, int layer, 
      [In] ref Point destPos, [In] ref Rect sourceRect, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureSaveToFile(IntPtr texture, [In] byte[] fileName, int quality, 
      int layer, [In] ref Rect sourceRect, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureClear(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureClearWith(IntPtr texture, [In] ref FloatColor color, int layer, 
      int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureBind(IntPtr texture, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureUnbind(IntPtr texture, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureAttach(IntPtr texture, IntPtr attachment, int layer, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureDetach(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureBegin(IntPtr texture, int layer, int mipLevel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureEnd(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureGenerateMipMaps(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureResetCache(IntPtr texture);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SurfaceCreate(int width, int height, PixelFormat format);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SurfaceCreateFromFile([In] byte[] fileName, 
      AlphaFormatRequest formatRequest);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SurfaceCreateFromFileInMemory(IntPtr fileContents, uint contentSize, 
      [In] byte[] extension, AlphaFormatRequest formatRequest);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SurfaceDestroy(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SurfaceGetBits(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SurfaceGetPitch(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SurfaceGetBytesPerPixel(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SurfaceGetWidth(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SurfaceGetHeight(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SurfaceGetByteSize(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat SurfaceGetFormat(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceGetPremultipliedAlpha(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SurfaceSetPremultipliedAlpha(IntPtr surface, 
      [MarshalAs(UnmanagedType.U1)] bool premultipliedAlpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SurfaceGetScanline(IntPtr surface, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SurfaceGetPixelPtr(IntPtr surface, int x, int y);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceEmpty(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceResize(IntPtr surface, int width, int height, PixelFormat format);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceConvertFormat(IntPtr surface, PixelFormat format);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SurfaceGetPixel(IntPtr surface, int x, int y);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SurfaceSetPixel(IntPtr surface, int x, int y, uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SurfaceGetPixelBilinear(IntPtr surface, float x, float y);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceCopyRect(IntPtr surface, IntPtr source, [In] ref Rect sourceRect, 
      [In] ref Point destPos);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceCopyFrom(IntPtr surface, IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SurfaceClear(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceClearWith(IntPtr surface, uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceResetAlpha(IntPtr surface, [MarshalAs(UnmanagedType.U1)] bool opaque);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceHasAlphaChannel(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfacePremultiplyAlpha(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceUnpremultiplyAlpha(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceMirror(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceFlip(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceInvert(IntPtr surface);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceShrinkFrom(IntPtr surface, IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceStretchRect(IntPtr surface, IntPtr source, [In] ref RectF destRect, 
      [In] ref RectF sourceRect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceStretchRectBilinear(IntPtr surface, IntPtr source, 
      [In] ref RectF destRect, [In] ref RectF sourceRect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceMakeSignedDistanceField(IntPtr surface, IntPtr source, float spread, 
      [In] ref Point destPos, [In] ref Rect sourceRect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SurfaceSaveToFile(IntPtr surface, [In] byte[] fileName, int quality);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SurfaceSaveToFileInMemory(IntPtr surface, IntPtr fileContents, 
      uint fileContentSize, [In] byte[] extension, int quality);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr CanvasBufferCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasBufferDestroy(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int CanvasBufferGetVertexCount(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasBufferSetVertexCount(IntPtr buffer, int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int CanvasBufferGetIndexCount(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasBufferSetIndexCount(IntPtr buffer, int indexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasBufferClear(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasBufferClearAndShrink(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr CanvasBufferGetVertices(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr CanvasBufferGetColors(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr CanvasBufferGetIndices(IntPtr buffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasBufferGetExtents(IntPtr buffer, out RectF extents);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr PathBrokerCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void PathBrokerDestroy(IntPtr broker);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool PathBrokerFill(IntPtr broker, IntPtr buffer, [In] PathElement[] path, 
      int pathLength, [In] ref ColorRect colors, [MarshalAs(UnmanagedType.U1)] bool quality);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool PathBrokerStroke(IntPtr broker, IntPtr buffer, [In] PathElement[] path, 
      int pathLength, float thickness, uint color, PathJoint joints, LineCaps caps, float miterLimit, 
      float smoothStep);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void PathBrokerReset(IntPtr broker);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr CanvasCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasDestroy(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr CanvasGetDevice(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasBegin(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasEnd(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasPixels(IntPtr canvas, [In] Vector2[] positions, [In] uint[] colors, 
      int elementCount, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLines(IntPtr canvas, [In] Vector2[] vertices, [In] uint[] colors, 
      [In] int[] indices, int vertexCount, int primitiveCount, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTriangles(IntPtr canvas, [In] Vector2[] vertices, [In] uint[] colors, 
      [In] int[] indices, int vertexCount, int primitiveCount, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedTriangles(IntPtr canvas, IntPtr texture, 
      [In] Vector2[] vertices, [In] Vector2[] texCoords, [In] uint[] colors, [In] int[] indices, 
      int vertexCount, int primitiveCount, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasPixel(IntPtr canvas, [In] ref Vector2 position, uint color, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLine(IntPtr canvas, [In] ref Vector2 srcPos, [In] ref Vector2 destPos, 
      [In] ref ColorPair colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLine(IntPtr canvas, [In] ref Vector2 srcPos, 
      [In] ref Vector2 destPos, [In] ref ColorPair colors, float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLineEllipse(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 radius, int steps, uint color, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLineCircle(IntPtr canvas, [In] ref Vector2 origin, float radius, 
      int steps, uint color, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLineEllipse(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 radius, int steps, uint color, float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLineCircle(IntPtr canvas, [In] ref Vector2 origin, float radius, 
      int steps, uint color, float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLineTriangle(IntPtr canvas, [In] ref Vector2 vertex1, 
      [In] ref Vector2 vertex2, [In] ref Vector2 vertex3, uint color1, uint color2, uint color3, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLineTriangle(IntPtr canvas, [In] ref Vector2 vertex1, 
      [In] ref Vector2 vertex2, [In] ref Vector2 vertex3, uint color1, uint color2, uint color3, 
      float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLineQuad(IntPtr canvas, [In] ref Quad vertices, 
      [In] ref ColorRect colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLineQuad(IntPtr canvas, [In] ref Quad vertices, 
      [In] ref ColorRect colors, float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLineHexagon(IntPtr canvas, uint color1, uint color2, uint color3, 
      uint color4, uint color5, uint color6, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasLineHexagonGrad(IntPtr canvas, [In] ref ColorRect colors, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLineHexagon(IntPtr canvas, uint color1, uint color2, uint color3, 
      uint color4, uint color5, uint color6, float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasThickLineHexagonGrad(IntPtr canvas, [In] ref ColorRect colors, 
      float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTriangle(IntPtr canvas, [In] ref Vector2 vertex1, 
      [In] ref Vector2 vertex2, [In] ref Vector2 vertex3, uint color1, uint color2, uint color3, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasQuad(IntPtr canvas, [In] ref Quad vertices, [In] ref ColorRect colors, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFillRect(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFrameRect(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, float thickness, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFillRoundRect(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, float radius, int steps, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFrameRoundRect(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, float radius, float thickness, int steps, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFillRoundRectTop(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, float radius, int steps, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFillRoundRectBottom(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, float radius, int steps, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFillRoundRectTopInverse(IntPtr canvas, [In] ref RectF rect, 
      [In] ref ColorRect colors, float radius, int steps, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasHighlight(IntPtr canvas, [In] ref RectF rect, float cornerRadius, 
      float luma, float distance, int steps);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasHexagon(IntPtr canvas, uint color1, uint color2, uint color3, 
      uint color4, uint color5, uint color6, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasHexagonGrad(IntPtr canvas, [In] ref ColorRect colors, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasArc(IntPtr canvas, [In] ref Vector2 origin, [In] ref Vector2 radius, 
      float initAngle, float endAngle, int steps, uint colorInside, uint colorOutside, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasArcGrad(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 radius, float initAngle, float endAngle, int steps, [In] ref ColorRect colors, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasEllipse(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 radius, int steps, [In] ref ColorRect colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasRibbonGrad(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 insideRadius, [In] ref Vector2 outsideRadius, int steps, [In] ref ColorRect colors, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasRibbonTri(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 insideRadius, [In] ref Vector2 outsideRadius, int steps, [In] ref ColorPair color1, 
      [In] ref ColorPair color2, [In] ref ColorPair color3, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasRibbon(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 insideRadius, [In] ref Vector2 outsideRadius, int steps, uint color, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTapeGrad(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 insideRadius, [In] ref Vector2 outsideRadius, float initAngle, float endAngle, 
      int steps, [In] ref ColorRect colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTapeTri(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 insideRadius, [In] ref Vector2 outsideRadius, float initAngle, float endAngle, 
      int steps, [In] ref ColorPair color1, [In] ref ColorPair color2, [In] ref ColorPair color3, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTape(IntPtr canvas, [In] ref Vector2 origin, 
      [In] ref Vector2 insideRadius, [In] ref Vector2 outsideRadius, float initAngle, float endAngle, 
      int steps, uint color, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasRectWithHole(IntPtr canvas, [In] ref RectF rect, 
      [In] ref Vector2 holeOrigin, [In] ref Vector2 holeRadius, [In] ref ColorPair colors, int steps, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasDrawBuffer(IntPtr canvas, IntPtr buffer, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedTriangle(IntPtr canvas, IntPtr texture, 
      [In] ref Vector2 vertex1, [In] ref Vector2 vertex2, [In] ref Vector2 vertex3, 
      [In] ref Vector2 texCoord1, [In] ref Vector2 texCoord2, [In] ref Vector2 texCoord3, uint color1, 
      uint color2, uint color3, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedTriangleRegion(IntPtr canvas, IntPtr texture, 
      [In] ref Vector2 vertex1, [In] ref Vector2 vertex2, [In] ref Vector2 vertex3, 
      [In] ref Vector2 texCoord1, [In] ref Vector2 texCoord2, [In] ref Vector2 texCoord3, uint color1, 
      uint color2, uint color3, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedQuad(IntPtr canvas, IntPtr texture, [In] ref Quad vertices, 
      [In] ref Quad texCoords, [In] ref ColorRect colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedQuadRegion(IntPtr canvas, IntPtr texture, 
      [In] ref Quad vertices, [In] ref Quad texCoords, [In] ref ColorRect colors, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedRoundRect(IntPtr canvas, IntPtr texture, [In] ref RectF rect, 
      [In] ref Quad texCoords, [In] ref ColorRect colors, float radius, int steps, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasTexturedRoundRectRegion(IntPtr canvas, IntPtr texture, 
      [In] ref RectF rect, [In] ref Quad texCoords, [In] ref ColorRect colors, float radius, int steps, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasQuadImage(IntPtr canvas, IntPtr imageAtlas, [In] ref Quad vertices, 
      int regionIndex, [In] ref ColorRect colors, [In] ref RectF sourceRect, uint modifiers, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasSetWorld(IntPtr canvas, [In] ref Matrix4x4 world);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasGetWorld(IntPtr canvas, out Matrix4x4 world);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasSetViewProjection(IntPtr canvas, [In] ref Matrix4x4 viewProjection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasGetViewProjection(IntPtr canvas, out Matrix4x4 viewProjection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasSetTransform(IntPtr canvas, [In] ref Matrix3x2 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasGetTransform(IntPtr canvas, out Matrix3x2 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasSetSignedDistanceField(IntPtr canvas, 
      [In] ref SignedDistanceField signedDistanceField);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasGetSignedDistanceField(IntPtr canvas, 
      out SignedDistanceField signedDistanceField);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern CanvasContextState CanvasGetContextState(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasSetContextState(IntPtr canvas, CanvasContextState contextState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasSetSamplerState(IntPtr canvas, [In] ref CanvasSamplerState samplerState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasGetSamplerState(IntPtr canvas, out CanvasSamplerState samplerState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasResetSamplerState(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasSetAttributes(IntPtr canvas, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint CanvasGetAttributes(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasFlush(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasReset(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int CanvasGetBatchCount(IntPtr canvas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void CanvasGetClipRect(IntPtr canvas, out Rect clipRect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool CanvasSetClipRect(IntPtr canvas, [In] ref Rect rect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ImageAtlasCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ImageAtlasDestroy(IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ImageAtlasGetDevice(IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ImageAtlasTextureCount(IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ImageAtlasTexture(IntPtr atlas, int textureIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ImageAtlasRegionCount(IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ImageAtlasRegion(IntPtr atlas, int regionIndex, out ImageRegion region);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ImageAtlasCreateRegion(IntPtr atlas, [In] ref Rect rect, int textureIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ImageAtlasRemoveRegion(IntPtr atlas, int regionIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ImageAtlasClearRegions(IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ImageAtlasMakeRegions(IntPtr atlas, [In] ref Point patternSize, 
      [In] ref Point visibleSize, int patternCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ImageAtlasClearTextures(IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ImageAtlasRemoveTexture(IntPtr atlas, int textureIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ImageAtlasCreateTexture(IntPtr atlas, [In] ref Point size, 
      PixelFormat format, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ImageAtlasPackRegion(IntPtr atlas, [In] ref Point size, int padding);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ImageAtlasPackSurface(IntPtr atlas, IntPtr surface, [In] ref Rect sourceRect, 
      int padding);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextRendererCreate(IntPtr canvas, [In] ref Point textureSize, 
      PixelFormat pixelFormat, [MarshalAs(UnmanagedType.U1)] bool mipMapping);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererDestroy(IntPtr textRenderer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextRendererGetCanvas(IntPtr textRenderer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextRendererSetFontParameters(IntPtr textRenderer, 
      [In] ref FontParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextRendererGetFontParameters(IntPtr textRenderer, 
      out FontParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererExtent(IntPtr textRenderer, [In] byte[] text, 
      out Vector2 dimensions, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererExtentByPixels(IntPtr textRenderer, [In] byte[] text, 
      out RectF rect, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int TextRendererRects(IntPtr textRenderer, out Vector2 extent, 
      [Out] TextEntryRect[] rects, [In] byte[] text, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererDraw(IntPtr textRenderer, [In] ref Vector2 position, 
      [In] byte[] text, [In] ref ColorPair colors, float alpha, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererDrawAligned(IntPtr textRenderer, [In] ref Vector2 position, 
      [In] byte[] text, [In] ref ColorPair colors, TextAlignment horizAlign, TextAlignment vertAlign, 
      float alpha, [MarshalAs(UnmanagedType.U1)] bool alignToPixels, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererDrawCentered(IntPtr textRenderer, [In] ref Vector2 position, 
      [In] byte[] text, [In] ref ColorPair colors, float alpha, 
      [MarshalAs(UnmanagedType.U1)] bool alignToPixels, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererDrawAlignedByPixels(IntPtr textRenderer, 
      [In] ref Vector2 position, [In] byte[] text, [In] ref ColorPair colors, TextAlignment horizAlign, 
      TextAlignment vertAlign, float alpha, [MarshalAs(UnmanagedType.U1)] bool alignToPixels, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextRendererDrawCenteredByPixels(IntPtr textRenderer, 
      [In] ref Vector2 position, [In] byte[] text, [In] ref ColorPair colors, float alpha, 
      [MarshalAs(UnmanagedType.U1)] bool alignToPixels, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextModellerCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerDestroy(IntPtr textModeller);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextModellerGetDevice(IntPtr textModeller);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextModellerSetFontParameters(IntPtr textModeller, 
      [In] ref FontParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextModellerGetFontProvider(IntPtr textModeller);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerSetFontProvider(IntPtr textModeller, IntPtr provider);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerExtent(IntPtr textModeller, [In] byte[] text, 
      out Vector2 extent, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerExtentByShape(IntPtr textModeller, [In] byte[] text, 
      out RectF rect, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int TextModellerRects(IntPtr textModeller, out Vector2 extent, 
      [Out] TextEntryRect[] rects, [In] byte[] text, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDrawToCanvas(IntPtr textModeller, IntPtr canvas, 
      [In] ref Vector2 position, [In] byte[] text, [In] ref ColorPair colors, TextAlignment alignHoriz, 
      TextAlignment alignVert, [MarshalAs(UnmanagedType.U1)] bool alignByShape, IntPtr modifiers, 
      BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDrawToCanvasBuffer(IntPtr textModeller, IntPtr buffer, 
      [In] ref Vector2 position, [In] byte[] text, [In] ref ColorPair colors, TextAlignment alignHoriz, 
      TextAlignment alignVert, [MarshalAs(UnmanagedType.U1)] bool alignByShape, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDrawCurvedToCanvas(IntPtr textModeller, IntPtr canvas, 
      [In] ref Vector2 position, [In] byte[] text, float radius, float angle, [In] ref ColorPair colors, 
      IntPtr modifiers, BlendingEffect effect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDrawCurvedToCanvasBuffer(IntPtr textModeller, IntPtr buffer, 
      [In] ref Vector2 position, [In] byte[] text, float radius, float angle, [In] ref ColorPair colors, 
      IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDraw(IntPtr textModeller, [In] ref Vector3 position, 
      [In] byte[] text, float depth, [In] ref ColorPair colors, TextAlignment alignHoriz, 
      TextAlignment alignVert, TextAlignment alignDepth, [MarshalAs(UnmanagedType.U1)] bool alignByShape, 
      IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDrawCurved(IntPtr textModeller, [In] ref Vector3 position, 
      [In] byte[] text, float radius, float angle, float depth, [In] ref ColorPair colors, 
      TextAlignment alignDepth, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerDrawDepthCurved(IntPtr textModeller, [In] ref Vector3 position, 
      [In] byte[] text, float radius, float angle, float depth, [In] ref ColorPair colors, IntPtr modifiers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerClear(IntPtr textModeller);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerPrepare(IntPtr textModeller);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerRender(IntPtr textModeller, IntPtr program, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextModellerCopyToMeshBuffer(IntPtr textModeller, IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerReset(IntPtr textModeller);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerGetTransform(IntPtr textModeller, out Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextModellerSetTransform(IntPtr textModeller, [In] ref Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr GrapherCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherDestroy(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr GrapherGetDevice(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool GrapherBegin(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherEnd(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherPoints(IntPtr grapher, [In] Vector4[] vertices, [In] uint[] colors, 
      [In] float[] angles, int elementCount, PointShape shape);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherLines(IntPtr grapher, [In] Vector4[] vertices, [In] uint[] colors, 
      [In] int[] indices, int vertexCount, int indexCount, LineCaps caps);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherPoint(IntPtr grapher, [In] ref Vector3 position, uint color, 
      float size, PointShape shape, float angle);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherLine(IntPtr grapher, [In] ref Vector3 position1, 
      [In] ref Vector3 position2, uint color1, uint color2, float thickness1, float thickness2, LineCaps caps);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherArrow(IntPtr grapher, [In] ref Vector2 targetSize, 
      [In] ref Vector3 origin, [In] ref Vector3 destination, uint color, float thickness, float size, 
      LineCaps caps);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherBoundingBox(IntPtr grapher, [In] ref Matrix4x4 volume, uint color, 
      float thickness, float length, LineCaps caps);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherDottedLine(IntPtr grapher, [In] ref Vector3 position1, 
      [In] ref Vector3 position2, uint color1, uint color2, float thickness1, float thickness2, 
      float sparsity, PointShape shape, float angle);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherFlush(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherReset(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherGetTransform(IntPtr grapher, out Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GrapherSetTransform(IntPtr grapher, [In] ref Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int GrapherGetBatchCount(IntPtr grapher);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshModelCreate(IntPtr device, int vertexCount, uint vertexElementPitch, 
      int indexCount, uint channel, IntPtr initialVertexData, IntPtr initialIndexData);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshModelDestroy(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshModelRenderable(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshModelDismantle(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshModelTakeAway(IntPtr meshModel, IntPtr meshModelAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int MeshModelGetVertexCount(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int MeshModelGetIndexCount(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MeshModelGetChannel(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshModelGetVertexBuffer(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshModelGetIndexBuffer(IntPtr meshModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshModelDraw(IntPtr meshModel, IntPtr program, PrimitiveTopology topology, 
      int elementCount, int firstIndex, int baseVertex, [MarshalAs(UnmanagedType.U1)] bool postUnbind);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshModelDrawInstances(IntPtr meshModel, IntPtr program, int instanceCount, 
      PrimitiveTopology topology, int elementCount, int firstIndex, int baseVertex, 
      [MarshalAs(UnmanagedType.U1)] bool postUnbind);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshMetaTagGetParent(IntPtr tag);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagGetName(IntPtr tag, IntPtr name, ref int nameLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern byte MeshMetaTagGetType(IntPtr tag);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagGetBounds(IntPtr tag, out Vector3 boundsMin, out Vector3 boundsMax);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int MeshMetaTagGetPortionCount(IntPtr tag);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshMetaTagPortionGet(IntPtr tag, out MeshMetaTagPortion portion, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshMetaTagPortionAdd(IntPtr tag, [In] ref MeshMetaTagPortion portion);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagPortionErase(IntPtr tag, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagPortionsClear(IntPtr tag);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshMetaTagPortionsCopy(IntPtr tag, IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshMetaTagsCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagsDestroy(IntPtr tags);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int MeshMetaTagsCount(IntPtr tags);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshMetaTagsGetByIndex(IntPtr tags, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshMetaTagsGetByName(IntPtr tags, [In] byte[] name, byte type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshMetaTagsAdd(IntPtr tags, [In] byte[] name, byte type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagsErase(IntPtr tags, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagsClear(IntPtr tags);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshMetaTagsCopy(IntPtr tags, IntPtr tagsAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshMetaTagsTakeAway(IntPtr tags, IntPtr tagsAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshBufferCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferDestroy(IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshBufferGetVertices(IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int MeshBufferGetVertexCount(IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferSetVertexCount(IntPtr meshBuffer, int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshBufferGetIndices(IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int MeshBufferGetIndexCount(IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferSetIndexCount(IntPtr meshBuffer, int indexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshBufferCreateModel(IntPtr meshBuffer, IntPtr device, 
      [In] VertexElement[] vertexElements, int vertexElementCount, int firstVertex, int vertexCount, 
      int firstIndex, int indexCount, uint channel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferSuperEllipse(IntPtr meshBuffer, int longitudeSections, 
      int latitudeSections, [In] ref Vector3 origin, [In] ref Vector3 radius, float initLongitudeAngle, 
      float endLongitudeAngle, float longitudeShape, float initLatitudeAngle, float endLatitudeAngle, 
      float latitudeShape, [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, 
      [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferGeosphere(IntPtr meshBuffer, int subdivisions, 
      [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool flatNormals, 
      [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferCylinder(IntPtr meshBuffer, int radialSections, 
      int heightSections, [In] ref Vector3 origin, [In] ref Vector3 horizAxis, [In] ref Vector3 vertAxis, 
      [In] ref Vector3 heightAxis, float initAngle, float endAngle, float shape, 
      [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, float bendAngle, float lateralAngle, 
      [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferConeSimple(IntPtr meshBuffer, int sections, 
      [In] ref Vector3 origin, float radius, float height, [In] ref FloatColor color, 
      [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferDisc(IntPtr meshBuffer, int radialSections, int innerSections, 
      [In] ref Vector3 origin, [In] ref Vector3 horizAxis, [In] ref Vector3 vertAxis, [In] ref Vector3 normal, 
      float initAngle, float endAngle, float shape, float initRadius, [In] ref Vector2 initTexCoord, 
      [In] ref Vector2 endTexCoord, float lateralAngle, [In] ref FloatColor color, 
      [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferPlane(IntPtr meshBuffer, int horizSections, int vertSections, 
      [In] ref Vector3 origin, [In] ref Vector3 horizAxis, [In] ref Vector3 vertAxis, [In] ref Vector3 normal, 
      [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, [In] ref FloatColor color, 
      [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferCube(IntPtr meshBuffer, int horizSections, int vertSections, 
      int depthSections, [In] ref Vector3 origin, [In] ref Vector3 horizAxis, [In] ref Vector3 vertAxis, 
      [In] ref Vector3 depthAxis, [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, 
      [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferCubeMinimal(IntPtr meshBuffer, [In] ref Vector3 origin, 
      [In] ref Vector3 size, [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferCubeRound(IntPtr meshBuffer, [In] ref Vector3 origin, 
      [In] ref Vector3 size, float roundness, [In] ref FloatColor color, 
      [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferTorus(IntPtr meshBuffer, int outerSections, int innerSections, 
      [In] ref Vector3 origin, [In] ref Vector3 horizAxis, [In] ref Vector3 vertAxis, float initOuterAngle, 
      float endOuterAngle, float outerShape, float initInnerAngle, float endInnerAngle, float innerShape, 
      [In] ref Vector2 innerRadius, [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, 
      float lateralAngle, [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferTorusKnot(IntPtr meshBuffer, int outerSections, int innerSections, 
      [In] ref Vector3 origin, int p, int q, float initOuterAngle, float endOuterAngle, float outerRadius, 
      float initInnerAngle, float endInnerAngle, float innerShape, [In] ref Vector2 innerRadius, 
      [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, float lateralAngle, 
      [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferSupertoroid(IntPtr meshBuffer, int outerSections, 
      int innerSections, [In] ref Vector3 origin, float initOuterAngle, float endOuterAngle, 
      float outerRadius, float outerShape, float initInnerAngle, float endInnerAngle, float innerRadius, 
      float innerShape, [In] ref Vector2 initTexCoord, [In] ref Vector2 endTexCoord, 
      [In] ref FloatColor color, [MarshalAs(UnmanagedType.U1)] bool indicesClockwise);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferFrustumVolume(IntPtr meshBuffer, 
      [In] ref Matrix4x4 viewProjectionInverse, [MarshalAs(UnmanagedType.U1)] bool depthClipNegative);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferExtrusion(IntPtr meshBuffer, [In] PathElement[] path, 
      int pathLength, float depth, [In] ref Vector2 texCoords, [In] FloatColor[] colors, 
      [MarshalAs(UnmanagedType.U1)] bool quality);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferTransformVertices(IntPtr meshBuffer, int firstVertex, 
      int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferCalculateFlatNormals(IntPtr meshBuffer, float epsilon);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferCalculateNormals(IntPtr meshBuffer, int firstVertex, 
      int vertexCount, int firstIndex, int indexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferCalculateNormalsWeld(IntPtr meshBuffer, int firstVertex, 
      int vertexCount, int firstIndex, int indexCount, float weldEpsilon);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferInvertNormals(IntPtr meshBuffer, int firstVertex, int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferInvertIndexOrder(IntPtr meshBuffer, int firstIndex, int indexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferCalculateBounds(IntPtr meshBuffer, out Vector3 vertexMin, 
      out Vector3 vertexMax, int firstVertex, int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferCentralize(IntPtr meshBuffer, int firstVertex, int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferEliminateUnusedVertices(IntPtr meshBuffer, int firstVertex, 
      int vertexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferJoinDuplicateVertices(IntPtr meshBuffer, int firstVertex, 
      int vertexCount, float treshold);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferCombine(IntPtr meshBuffer, IntPtr meshBufferSource, 
      int firstVertex, int vertexCount, int firstIndex, int indexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferClear(IntPtr meshBuffer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferSetTransform(IntPtr meshBuffer, [In] ref Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBufferGetTransform(IntPtr meshBuffer, out Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MeshBufferTransferVertexElements(IntPtr meshBuffer, IntPtr buffer, 
      [In] VertexElement[] vertexElements, int vertexElementCount, int firstVertex, int vertexCount, 
      uint channel, uint semanticIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MeshBufferTransferIndexElements(IntPtr meshBuffer, IntPtr buffer, 
      uint pitch, int firstVertex, int firstIndex, int indexCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferTransferVertices(IntPtr meshBuffer, IntPtr buffer, 
      [In] VertexElement[] vertexElements, int vertexElementCount, int firstVertex, int vertexCount, 
      uint channel, uint offset, uint semanticIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferTransferIndices(IntPtr meshBuffer, IntPtr buffer, int firstVertex, 
      int firstIndex, int indexCount, uint offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshBufferVoxelize(IntPtr meshBuffer, byte levels, 
      [MarshalAs(UnmanagedType.U1)] bool colors);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferLoadFromFile(IntPtr meshBuffer, [In] byte[] fileName, 
      IntPtr materials, IntPtr tags, ref uint options, MeshLoadSaveFeedback feedback, IntPtr feedbackUser, 
      IntPtr debug, ref int debugLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferSaveToFile(IntPtr meshBuffer, [In] byte[] fileName, 
      IntPtr materials, IntPtr tags, uint options, MeshLoadSaveFeedback feedback, IntPtr feedbackUser, 
      IntPtr debug, ref int debugLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferLoadFromFileEx(IntPtr meshBuffer, IntPtr tags, 
      [In] byte[] fileName, out Vector3 minBounds, out Vector3 maxBounds, 
      [MarshalAs(UnmanagedType.U1)] bool normals, IntPtr debug, ref int debugLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshBufferSaveToFileEx(IntPtr meshBuffer, [In] byte[] fileName, 
      [In] ref uint options, IntPtr debug, ref int debugLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr GaussianBlurCreate(IntPtr device, float sigma, int samples, 
      [MarshalAs(UnmanagedType.U1)] bool hardwareFiltering);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GaussianBlurDestroy(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr GaussianBlurGetDevice(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int GaussianBlurGetFixedSamples(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int GaussianBlurGetSamples(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GaussianBlurSetSamples(IntPtr gaussianBlur, int samples);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float GaussianBlurGetSigma(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GaussianBlurSetSigma(IntPtr gaussianBlur, float sigma);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float GaussianBlurGetChroma(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GaussianBlurSetChroma(IntPtr gaussianBlur, float chroma);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool GaussianBlurGetHardwareFiltering(IntPtr gaussianBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void GaussianBlurSetHardwareFiltering(IntPtr gaussianBlur, 
      [MarshalAs(UnmanagedType.U1)] bool hardwareFiltering);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool GaussianBlurUpdate(IntPtr gaussianBlur, IntPtr destination, 
      IntPtr intermediary, IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool GaussianBlurUpdateAt(IntPtr gaussianBlur, IntPtr destination, 
      IntPtr intermediary, IntPtr source, [In] ref Point destPos, [In] ref Rect intermRect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr KawaseBlurCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void KawaseBlurDestroy(IntPtr kawaseBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr KawaseBlurGetDevice(IntPtr kawaseBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int KawaseBlurGetPasses(IntPtr kawaseBlur);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void KawaseBlurSetPasses(IntPtr kawaseBlur, int passes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void KawaseBlurGetOffset(IntPtr kawaseBlur, out Vector2 offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void KawaseBlurSetOffset(IntPtr kawaseBlur, [In] ref Vector2 offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool KawaseBlurUpdate(IntPtr kawaseBlur, IntPtr destination, IntPtr intermediary, 
      IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool KawaseBlurSinglePass(IntPtr kawaseBlur, IntPtr destination, IntPtr source, 
      [In] ref Vector2 offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ColorDitheringCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ColorDitheringDestroy(IntPtr colorDithering);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ColorDitheringGetDevice(IntPtr colorDithering);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ColorDitheringFormat ColorDitheringGetFormat(IntPtr colorDithering);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ColorDitheringSetFormat(IntPtr colorDithering, ColorDitheringFormat format);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ColorDitheringExecuteTo(IntPtr colorDithering, IntPtr destination, 
      IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ColorDitheringExecute(IntPtr colorDithering, IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SelectionHighlightCreate(IntPtr device, [In] ref Point size, 
      PixelFormat depthStencil, int samples, [MarshalAs(UnmanagedType.U1)] bool grayscale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SelectionHighlightDestroy(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SelectionHighlightGetDevice(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightSetSize(IntPtr selectionHighlight, [In] ref Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SelectionHighlightGetSize(IntPtr selectionHighlight, out Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat SelectionHighlightGetDepthStencil(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SelectionHighlightGetSamples(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightGetGrayscale(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SelectionHighlightGetParameters(IntPtr selectionHighlight, 
      out SelectionHighlightParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightSetParameters(IntPtr selectionHighlight, 
      [In] ref SelectionHighlightParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightClear(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightBegin(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SelectionHighlightEnd(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightRendering(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SelectionHighlightFilter(IntPtr selectionHighlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SelectionHighlightGetTexture(IntPtr selectionHighlight, 
      SelectionHighlightTextureType type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SelectionHighlightGetTextureCoordinates(IntPtr selectionHighlight, 
      out Quad coords);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SpatialFogCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SpatialFogDestroy(IntPtr spatialFog);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SpatialFogGetDevice(IntPtr spatialFog);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SpatialFogGetParameters(IntPtr spatialFog, out FogParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogSetParameters(IntPtr spatialFog, [In] ref FogParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SpatialFogGetView(IntPtr spatialFog, out Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogSetView(IntPtr spatialFog, [In] ref Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SpatialFogGetProjection(IntPtr spatialFog, out Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogSetProjection(IntPtr spatialFog, [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern FogFormula SpatialFogGetFormula(IntPtr spatialFog);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogSetFormula(IntPtr spatialFog, FogFormula formula);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern DepthFogDistance SpatialFogGetDepthDistance(IntPtr spatialFog);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogSetDepthDistance(IntPtr spatialFog, DepthFogDistance depthDistance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogExecute(IntPtr spatialFog, IntPtr destination, IntPtr linearDepths);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SpatialFogExecuteGlassy(IntPtr spatialFog, IntPtr destination, 
      IntPtr linearDepths);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneLightsCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsDestroy(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneLightsGetDevice(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneLightsGetCount(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneLightsGetElement(IntPtr sceneLights, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneLightsAdd(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneLightsErase(IntPtr sceneLights, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsClear(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsGetViewSize(IntPtr sceneLights, out Point viewSize);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsSetViewSize(IntPtr sceneLights, [In] ref Point viewSize);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneLightsGetClusterSize(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsSetClusterSize(IntPtr sceneLights, int clusterSize);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneLightsGetDepthSlices(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsSetDepthSlices(IntPtr sceneLights, int depthSlices);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ClustersCullingMode SceneLightsGetCullingMode(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsSetCullingMode(IntPtr sceneLights, ClustersCullingMode mode);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneLightsGetClusters(IntPtr sceneLights, out Point clusters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneLightsGetIndices(IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneLightsExecute(IntPtr sceneLights, [In] ref Matrix4x4 view, 
      [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneLightsRenderDebug(IntPtr sceneLights, 
      [MarshalAs(UnmanagedType.U1)] bool intensity);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectMaterialsCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectMaterialsDestroy(IntPtr objectMaterials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectMaterialsGetCount(IntPtr objectMaterials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectMaterialsGetElement(IntPtr objectMaterials, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectMaterialsAdd(IntPtr objectMaterials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectMaterialsErase(IntPtr objectMaterials, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectMaterialsClear(IntPtr objectMaterials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCabinetCreate(IntPtr device, [In] ref Point size, 
      TextureFidelity fidelity, int samples, PixelFormat depthStencil);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetDestroy(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCabinetGetDevice(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetGetSize(IntPtr textureCabinet, out Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetSetSize(IntPtr textureCabinet, [In] ref Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int TextureCabinetGetSamples(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat TextureCabinetGetDepthStencil(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern TextureFidelity TextureCabinetGetFidelity(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint TextureCabinetGetAttributes(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetSetAttributes(IntPtr textureCabinet, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCabinetGetTexture(IntPtr textureCabinet, TextureCabinetType type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TextureCabinetGetFinalTexture(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetClear(IntPtr textureCabinet, TextureCabinetPass pass, 
      IntPtr color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetBegin(IntPtr textureCabinet, TextureCabinetPass pass);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetEnd(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetRendering(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetFilter(IntPtr textureCabinet, TextureCabinetFilterType filter, 
      [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetResolve(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetPresent(IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetGetToneMappingBloom(IntPtr textureCabinet, 
      out ToneMappingBloom parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetSetToneMappingBloom(IntPtr textureCabinet, 
      [In] ref ToneMappingBloom parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetGetAmbientOcclusionParameters(IntPtr textureCabinet, 
      out AmbientOcclusionParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TextureCabinetSetAmbientOcclusionParameters(IntPtr textureCabinet, 
      [In] ref AmbientOcclusionParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TextureCabinetRetrieveGlassyMetrics(IntPtr textureCabinet, out uint values);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCasterGetDevice(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCasterGetPosition(IntPtr shadowCaster, out Point position);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCasterGetSize(IntPtr shadowCaster, out Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCasterGetViewProjection(IntPtr shadowCaster, 
      out Matrix4x4 viewProjection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCasterSetViewProjection(IntPtr shadowCaster, 
      [In] ref Matrix4x4 viewProjection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCasterGetAtlas(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ShadowCasterClear(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ShadowCasterBegin(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCasterEnd(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ShadowCasterFilter(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ShadowCasterRendering(IntPtr shadowCaster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCasterGetTexture(IntPtr shadowCaster, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCastingAtlasCreate(IntPtr device, [In] ref Point size, 
      TechniqueShadows technique, int samples, int padding);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCastingAtlasDestroy(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCastingAtlasGetDevice(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern TechniqueShadows ShadowCastingAtlasGetTechnique(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCastingAtlasGetParameters(IntPtr shadowCastingAtlas, 
      out ShadowParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ShadowCastingAtlasSetParameters(IntPtr shadowCastingAtlas, 
      [In] ref ShadowParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCastingAtlasGetSize(IntPtr shadowCastingAtlas, out Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ShadowCastingAtlasGetSamples(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ShadowCastingAtlasGetPadding(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCastingAtlasGetTexture(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCastingAtlasAdd(IntPtr shadowCastingAtlas, [In] ref Point size, 
      [MarshalAs(UnmanagedType.U1)] bool shared);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCastingAtlasErase(IntPtr shadowCastingAtlas, IntPtr caster);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ShadowCastingAtlasClear(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ShadowCastingAtlasGetCount(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ShadowCastingAtlasGetCaster(IntPtr shadowCastingAtlas, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ShadowCastingAtlasBorderFill(IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneCreateDepthsNormals(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneCreateModeling(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneDestroy(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetDevice(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneGetVertexElementCount(IntPtr scene, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetVertexElements(IntPtr scene, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetVertexElements(IntPtr scene, int index, 
      [In] VertexElement[] vertexElements, int vertexElementCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetVertexElementsFromTextModeller(IntPtr scene, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneGetActiveVertexElements(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetActiveVertexElements(IntPtr scene, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SceneGetAttributes(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetAttributes(IntPtr scene, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneGetWorld(IntPtr scene, out Matrix4x4 world);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneSetWorld(IntPtr scene, [In] ref Matrix4x4 world);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneGetView(IntPtr scene, out Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneSetView(IntPtr scene, [In] ref Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneGetProjection(IntPtr scene, out Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneSetProjection(IntPtr scene, [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneInstances(IntPtr scene, [In] Matrix4x4[] transforms, 
      [In] FloatColor[] colors, int count);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneGetInstancesCount(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetProgram(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneBegin(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneEnd(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneRendering(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneResetCache(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneGetMaterial(IntPtr scene, out ObjectMaterial material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetMaterial(IntPtr scene, [In] ref ObjectMaterial material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneGetToneMappingCoefficients(IntPtr scene, out Vector4 coefficients);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetToneMappingCoefficients(IntPtr scene, [In] ref Vector4 coefficients);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneGetParallaxMappingParameters(IntPtr scene, 
      out ParallaxMappingParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetParallaxMappingParameters(IntPtr scene, 
      [In] ref ParallaxMappingParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetSampler(IntPtr scene, SceneSamplerType type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetTexture(IntPtr scene, SceneTextureType type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneSetTexture(IntPtr scene, IntPtr texture, SceneTextureType type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetLights(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneSetLights(IntPtr scene, IntPtr sceneLights);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetShadowCastingAtlas(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneSetShadowCastingAtlas(IntPtr scene, IntPtr shadowCastingAtlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneGetTextureCabinet(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneSetTextureCabinet(IntPtr scene, IntPtr textureCabinet);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ScenePrepare(IntPtr scene);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr OceanSimulationCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationDestroy(IntPtr oceanSimulation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr OceanSimulationGetDevice(IntPtr oceanSimulation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetWavesParameters(IntPtr oceanSimulation, 
      out OceanWavesParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetWavesParameters(IntPtr oceanSimulation, 
      [In] ref OceanWavesParameters parameters);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr OceanSimulationGetWavesTexture(IntPtr oceanSimulation, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetSections(IntPtr oceanSimulation, out Point sections);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetSections(IntPtr oceanSimulation, [In] ref Point sections);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetView(IntPtr oceanSimulation, out Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetView(IntPtr oceanSimulation, [In] ref Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetProjection(IntPtr oceanSimulation, out Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetProjection(IntPtr oceanSimulation, 
      [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetScale(IntPtr oceanSimulation, out Vector3 scale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetScale(IntPtr oceanSimulation, [In] ref Vector3 scale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetPlane(IntPtr oceanSimulation, out Vector4 plane);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetPlane(IntPtr oceanSimulation, [In] ref Vector4 plane);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float OceanSimulationGetViewDistance(IntPtr oceanSimulation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetViewDistance(IntPtr oceanSimulation, float viewDistance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint OceanSimulationGetAttributes(IntPtr oceanSimulation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationSetAttributes(IntPtr oceanSimulation, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void OceanSimulationGetMaterial(IntPtr oceanSimulation, out OceanMaterial material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationSetMaterial(IntPtr oceanSimulation, 
      [In] ref OceanMaterial material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr OceanSimulationGetSamplerShadow(IntPtr oceanSimulation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationUpdate(IntPtr oceanSimulation, double latency);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool OceanSimulationRender(IntPtr oceanSimulation, IntPtr linearDepths, 
      IntPtr sceneLights, IntPtr atlas);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetOwner(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetID(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetName(IntPtr objectModel, IntPtr modelName, 
      ref int modelNameLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetPayload(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelSetName(IntPtr objectModel, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetDescription(IntPtr objectModel, IntPtr description, 
      ref int descriptionLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelSetDescription(IntPtr objectModel, [In] byte[] description);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetVoxel(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetVoxel(IntPtr objectModel, IntPtr meshVoxel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetMesh(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelSetMesh(IntPtr objectModel, IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetMeshName(IntPtr objectModel, IntPtr meshName, 
      ref int meshNameLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelSetMeshName(IntPtr objectModel, [In] byte[] meshName);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetParent(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelSetParent(IntPtr objectModel, IntPtr parent);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelGetChildCount(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetChild(IntPtr objectModel, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetTransform(IntPtr objectModel, ModelTransform transform, 
      out Matrix4x4 matrix);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelSetTransform(IntPtr objectModel, ModelTransform transform, 
      [In] ref Matrix4x4 matrix);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetPosition(IntPtr objectModel, out Vector3 position);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float ObjectModelGetDepthBias(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetDepthBias(IntPtr objectModel, float depthBias);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetAABB(IntPtr objectModel, out Vector3 boxMin, out Vector3 boxMax);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint ObjectModelGetAttributes(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetAttributes(IntPtr objectModel, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelGetOrderIndex(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetOrderIndex(IntPtr objectModel, int orderIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ulong ObjectModelGetLayers(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetLayers(IntPtr objectModel, ulong layers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetSize(IntPtr objectModel, out Vector3 size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetSize(IntPtr objectModel, [In] ref Vector3 size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetAlignments(IntPtr objectModel, out MeshAligns aligns);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetAlignments(IntPtr objectModel, [In] ref MeshAligns aligns);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelGetMaterial(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetMaterial(IntPtr objectModel, int material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetColor(IntPtr objectModel, out FloatColor color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetColor(IntPtr objectModel, [In] ref FloatColor color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetHighlight(IntPtr objectModel, out FloatColor highlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelSetHighlight(IntPtr objectModel, [In] ref FloatColor highlight);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelConnectLatches(IntPtr objectModel, int latchParent, int latchLocal);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelConnectLatchesByName(IntPtr objectModel, 
      [In] byte[] latchParentName, [In] byte[] latchLocalName);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetConnectedLatches(IntPtr objectModel, out int latchParent, 
      out int latchLocal);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float ObjectModelGetWaypointDistance(IntPtr objectModel, int group);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetLatchWaypointCouple(IntPtr objectModel, int group, 
      float distance, out Vector3 position, out Quaternion orientation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetLatchWaypointCoupleMatrix(IntPtr objectModel, int group, 
      float distance, out Matrix4x4 transform);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetLatchTransform(IntPtr objectModel, out Matrix4x4 transform, 
      int latchIndex, [MarshalAs(UnmanagedType.U1)] bool local);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelGetLatchTransformByName(IntPtr objectModel, 
      out Matrix4x4 transform, [In] byte[] name, [MarshalAs(UnmanagedType.U1)] bool local);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelInvalidate(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelGetNext(IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsCreate(IntPtr sceneMeshes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelsDestroy(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsGetMeshes(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelsGetObjectCount(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsGetFirst(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsAddWithID(IntPtr objectModels, IntPtr id, [In] byte[] name, 
      IntPtr payload, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsAdd(IntPtr objectModels, [In] byte[] name, IntPtr payload, 
      uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelsErase(IntPtr objectModels, IntPtr objectModel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelsClear(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsGetObjectByID(IntPtr objectModels, IntPtr id);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsGetObjectByName(IntPtr objectModels, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsPayload(IntPtr objectModels, IntPtr payload);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelsCreateView(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelsEraseView(IntPtr objectModels, IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelsClearViews(IntPtr objectModels);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelViewGetOwner(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewGetView(IntPtr objectModelView, out Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewSetView(IntPtr objectModelView, [In] ref Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewGetProjection(IntPtr objectModelView, 
      out Matrix4x4 projection, [MarshalAs(UnmanagedType.U1)] out bool depthClipNegative);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewSetProjection(IntPtr objectModelView, 
      [In] ref Matrix4x4 projection, [MarshalAs(UnmanagedType.U1)] bool depthClipNegative);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewGetViewProjection(IntPtr objectModelView, 
      out Matrix4x4 viewProjection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ulong ObjectModelViewGetLayers(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewSetLayers(IntPtr objectModelView, ulong layers);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewUpdateNeeded(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewInvalidate(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelViewGetObjectCount(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelViewGetObject(IntPtr objectModelView, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelViewUpdate(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewSort(IntPtr objectModelView, ObjectModelViewCompare compare);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ObjectModelViewSortWith(IntPtr objectModelView, 
      ObjectModelCompareFunc compareFunc, IntPtr user);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelViewSelect(IntPtr objectModelView, [In] ref Vector3 origin, 
      [In] ref Vector3 direction, out float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ObjectModelViewSelectAny(IntPtr objectModelView, [In] ref Vector3 origin, 
      [In] ref Vector3 direction, out float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelViewGetObjectsNotCulled(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelViewGetIntersectedRays(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ObjectModelViewGetIntersectedObjects(IntPtr objectModelView);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ObjectModelViewAutoDraw(IntPtr objectModelView, IntPtr scene, 
      IntPtr materials, uint options, ref int drawCalls);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr MeshVoxelCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshVoxelDestroy(IntPtr meshVoxel);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshVoxelTakeAway(IntPtr meshVoxel, IntPtr meshVoxelAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshVoxelLoadFromFile(IntPtr meshVoxel, [In] byte[] fileName, 
      [Out] int[] dimensions, out byte levels, [MarshalAs(UnmanagedType.U1)] out bool colors);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshVoxelLoadFromFileInMemory(IntPtr meshVoxel, IntPtr buffer, 
      uint bufferSize, [Out] int[] dimensions, out byte levels, [MarshalAs(UnmanagedType.U1)] out bool colors);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshVoxelSaveToFile(IntPtr meshVoxel, [In] byte[] fileName, 
      [In] int[] dimensions, byte levels, [MarshalAs(UnmanagedType.U1)] bool colors);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshVoxelExtents(IntPtr meshVoxel, out Vector3 position, out Vector3 size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshVoxelComputeParameters(IntPtr meshVoxel, [Out] int[] dimensions, 
      out byte levels, [MarshalAs(UnmanagedType.U1)] out bool colors);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshVoxelVisualize(IntPtr meshVoxel, byte levelMax, 
      MeshVoxelVisualizeFunc visualizeFunc, IntPtr user);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool MeshVoxelIntersect(IntPtr meshVoxel, [In] ref Vector3 origin, 
      [In] ref Vector3 direction, [In] ref Matrix4x4 world, [In] ref Matrix4x4 view, out float distance, 
      out int testsCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialGetName(IntPtr material, IntPtr name, ref int nameLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialGetShading(IntPtr material, 
      out SceneMeshMaterialShading shading);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialSetShading(IntPtr material, 
      [In] ref SceneMeshMaterialShading shading);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshMaterialGetTexture(IntPtr material, byte type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialSetTexture(IntPtr material, IntPtr texture, byte type);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialReleaseTextures(IntPtr material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshMaterialGetRangeCount(IntPtr material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialGetRange(IntPtr material, int index, 
      out SceneMeshMaterialRange range);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialSetRange(IntPtr material, int index, 
      [In] ref SceneMeshMaterialRange range);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshMaterialAddRange(IntPtr material, 
      [In] ref SceneMeshMaterialRange range);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialClearRanges(IntPtr material);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialCommit(IntPtr material, IntPtr device, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialCopy(IntPtr material, IntPtr source);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshMaterialsCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialsDestroy(IntPtr materials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialsSetName(IntPtr materials, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialsGetName(IntPtr materials, IntPtr name, ref int nameLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshMaterialsGetCount(IntPtr materials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshMaterialsGetMaterial(IntPtr materials, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshMaterialsAdd(IntPtr materials, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialsErase(IntPtr materials, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialsClear(IntPtr materials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialsCommit(IntPtr materials, IntPtr device, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialsCopy(IntPtr materials, IntPtr materialsAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshMaterialsTakeAway(IntPtr materials, IntPtr materialsAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshMaterialsTexturing(IntPtr materials);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshLatchesCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshLatchesDestroy(IntPtr latches);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshLatchesGetCount(IntPtr latches);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshLatchesGetLatch(IntPtr latches, int index, out SceneMeshLatch latch);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshLatchesSetLatch(IntPtr latches, int index, 
      [In] ref SceneMeshLatch latch);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshLatchesGetLatchIndex(IntPtr latches, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshLatchesAdd(IntPtr latches, [In] byte[] name, int type, int group, 
      IntPtr position, IntPtr orientation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshLatchesErase(IntPtr latches, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshLatchesClear(IntPtr latches);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshLatchesCopy(IntPtr latches, IntPtr latchesAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshLatchesTakeAway(IntPtr latches, IntPtr latchesAnother);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshLatchesLoadFromFile(IntPtr latches, [In] byte[] fileName);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshLatchesLoadFromFileInMemory(IntPtr latches, IntPtr buffer, 
      uint bufferSize);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshLatchesSaveToFile(IntPtr latches, [In] byte[] fileName);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SceneMeshLatchesGetWaypointDistance(IntPtr latches, int group);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshLatchesGetWaypointCouple(IntPtr latches, int group, float distance, 
      out Vector3 position, out Quaternion orientation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshLatchesInvalidateWaypoints(IntPtr latches);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshGetName(IntPtr sceneMesh, IntPtr meshName, ref int meshNameLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshGetPayload(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshGetModel(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshGetVoxel(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshGetMaterials(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshGetTags(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshGetLatches(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshGetBounds(IntPtr sceneMesh, out Vector3 boundsMin, 
      out Vector3 boundsMax);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SceneMeshGetScale(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshGetSize(IntPtr sceneMesh, out Vector3 size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern byte SceneMeshGetVertexElementsIndex(IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshSetVertexElementsIndex(IntPtr sceneMesh, byte vertexElementsIndex);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshSetSlice(IntPtr sceneMesh, IntPtr parent, IntPtr parentTag);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshGetSlice(IntPtr sceneMesh, out IntPtr parent, out IntPtr parentTag);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshAutoDraw(IntPtr sceneMesh, IntPtr scene, 
      [In] ref ObjectMaterial material, [In] ref FloatColor color, PrimitiveTopology topology, 
      int instanceCount, int elementCount, int firstIndex, int baseVertex, uint options, ref int drawCalls);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshAutoDrawSliced(IntPtr sceneMesh, IntPtr scene, 
      [In] ref ObjectMaterial material, [In] ref FloatColor color, PrimitiveTopology topology, 
      int instanceCount, uint options, ref int drawCalls);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesCreate(IntPtr device);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshesDestroy(IntPtr sceneMeshes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesAdd(IntPtr sceneMeshes, [In] byte[] name, IntPtr payload, 
      [In] ref Vector3 boundsMin, [In] ref Vector3 boundsMax, float scale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesAddFromBuffer(IntPtr sceneMeshes, [In] byte[] name, 
      IntPtr meshBuffer, IntPtr payload, [In] VertexElement[] vertexElements, int vertexElementCount, 
      IntPtr boundsMin, IntPtr boundsMax, uint channel, uint semanticIndex, float scale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesAddFromFile(IntPtr sceneMeshes, [In] byte[] name, 
      [In] byte[] fileName, IntPtr payload, [In] VertexElement[] vertexElements, int vertexElementCount, 
      uint channel, uint semanticIndex, ref uint options, float scale, MeshLoadSaveFeedback feedback, 
      IntPtr feedbackUser, IntPtr debug, ref int debugLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool SceneMeshesSlice(IntPtr sceneMeshes, IntPtr parent, byte type, 
      [In] byte[] prefix);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesGetDevice(IntPtr sceneMeshes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int SceneMeshesGetCount(IntPtr sceneMeshes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesGetMeshByIndex(IntPtr sceneMeshes, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesGetMeshByName(IntPtr sceneMeshes, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr SceneMeshesPayload(IntPtr sceneMeshes, IntPtr payload);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshesErase(IntPtr sceneMeshes, IntPtr sceneMesh);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void SceneMeshesClear(IntPtr sceneMeshes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ApplicationCreate(ref ApplicationConfiguration configuration);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationDestroy(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationSetEvents(IntPtr application, [In] ref ApplicationEvents events, 
      IntPtr user);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ApplicationGetWindowHandle(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationSetTitle(IntPtr application, [In] byte[] title);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationGetTitle(IntPtr application, IntPtr title, ref int titleLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationSetIconTitle(IntPtr application, [In] byte[] iconTitle);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationGetIconTitle(IntPtr application, IntPtr iconTitle, 
      ref int iconTitleLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationGetExecutablePath(IntPtr application, IntPtr path, 
      ref int pathLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationGetWindowRect(IntPtr application, out Rect rect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationSetWindowRect(IntPtr application, [In] ref Rect rect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationGetClientRect(IntPtr application, out Rect rect);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationSetClientSize(IntPtr application, [In] ref Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationGetMinimalSize(IntPtr application, out Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationSetMinimalSize(IntPtr application, [In] ref Point size);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double ApplicationGetWindowScale(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationInvalidate(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern Key ApplicationTranslateVirtualKey(IntPtr application, int virtualKey);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ApplicationConvertPortableKey(IntPtr application, Key key);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationExecute(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ApplicationTerminate(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ApplicationWindowState ApplicationGetWindowState(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationSetWindowState(IntPtr application, 
      ApplicationWindowState windowState);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationReadTextFromClipboard(IntPtr application, IntPtr text, 
      ref int textSize);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationWriteTextToClipboard(IntPtr application, [In] byte[] text);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern AppCursor ApplicationGetCursor(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationSetCursor(IntPtr application, AppCursor cursor);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationCaptureMouseInput(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationReleaseMouseInput(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationMouseInputCaptured(IntPtr application);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationSetIcons(IntPtr application, IntPtr surfaces, int count);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationSetIconsFromFiles(IntPtr application, IntPtr fileNames, 
      int fileNameCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ApplicationFileChooserDialog(IntPtr application, IntPtr filePath, 
      ref int filePathLength, FileChooserDialog dialog, [In] byte[] filters, [In] byte[] caption, 
      [In] byte[] accept, [In] byte[] reject);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr ActorCameraCreate([In] ref Vector3 position, [In] ref Vector3 rotation, 
      float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraDestroy(IntPtr camera);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetForward(IntPtr camera, out Vector3 forward);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetRight(IntPtr camera, out Vector3 right);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetCeiling(IntPtr camera, out Vector3 ceiling);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetPosition(IntPtr camera, out Vector3 position);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ActorCameraSetPosition(IntPtr camera, [In] ref Vector3 position);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetRotation(IntPtr camera, out Vector4 rotation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ActorCameraSetRotation(IntPtr camera, [In] ref Vector4 rotation);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float ActorCameraGetDistance(IntPtr camera);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraSetDistance(IntPtr camera, float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetQuaternion(IntPtr camera, out Quaternion quaternion);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ActorCameraSetQuaternion(IntPtr camera, [In] ref Quaternion quaternion);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetView(IntPtr camera, out Matrix4x4 view);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraZoom(IntPtr camera, [In] ref Vector2 position, 
      [In] ref Vector2 size, [In] ref Matrix4x4 projection, float delta);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraZoomOrtho(IntPtr camera, [In] ref Vector2 position, 
      [In] ref Vector2 size, float distance, float adjustedDistance, [In] ref Matrix4x4 projection, 
      [In] ref Matrix4x4 adjustedProjection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraGetConstraints(IntPtr camera, out CameraConstraints constraints);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void ActorCameraSetConstraints(IntPtr camera, 
      [In] ref CameraConstraints constraints);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool ActorCameraCommand(IntPtr camera, CameraCommand command, 
      [In] ref Vector3 position, [In] ref Vector2 size, [In] ref Vector3 sense, [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr TimerCreate();

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TimerDestroy(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double TimerGetSpeed(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TimerSetSpeed(IntPtr timer, double speed);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TimerNextSlice(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool TimerUpdateNextSlice(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TimerUpdate(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TimerReset(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float TimerGetFrameRate(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ulong TimerGetLatency(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long TimerGetTimeSlice(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long TimerGetSkippedTimeSlices(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void TimerTrimSkippedTimeSlices(IntPtr timer, long slicesToTrim);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int TimerExtractTokens(IntPtr timer);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetCreate(IntPtr manager, [In] byte[] className, 
      [In] byte[] instanceName, IntPtr payload);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetManagerCreate(IntPtr application, IntPtr textRenderer, 
      [In] byte[] instanceName, IntPtr payload, PixelFormat format, int multisamples, uint attributes);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetDestroy(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetGetManager(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetGetPayload(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetGetParent(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetSetParent(IntPtr widget, IntPtr parent);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetLocalToScreen(IntPtr widget, out Vector2 screenPos, 
      [In] ref Vector2 localPos);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetScreenToLocal(IntPtr widget, out Vector2 localPos, 
      [In] ref Vector2 screenPos);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetBringToFront(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetSendToBack(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetInvalidate(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetAccomodate(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetUpdate(IntPtr widget, double latency);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetAcceptMouse(IntPtr widget, MouseEvent _event, MouseButton button, 
      [In] ref Vector2 position);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetAcceptKey(IntPtr widget, KeyEvent _event, Key key, uint charCode);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int WidgetGetChildCount(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetGetChildByIndex(IntPtr widget, int index);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int WidgetGetChildIndex(IntPtr widget, IntPtr child);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetFindAt(IntPtr widget, [In] ref Vector2 position);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetInvokeEvent(IntPtr widget, [In] byte[] eventName);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetSetExternalEvent(IntPtr widget, WidgetExternalEvent _event, IntPtr user);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void WidgetGetExternalEvent(IntPtr widget, out WidgetExternalEvent _event, 
      IntPtr user);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetSetProperty(IntPtr widget, [In] byte[] propertyName, 
      WidgetPropertyType valueType, IntPtr value, [MarshalAs(UnmanagedType.U1)] bool invokeChanged);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetGetProperty(IntPtr widget, [In] byte[] propertyName, 
      WidgetPropertyType valueType, IntPtr value);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetGetPropertyAsString(IntPtr widget, [In] byte[] propertyName, 
      IntPtr value, ref int valueLength);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int WidgetGetPropertyCount(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetPropertyIdentify(IntPtr widget, ref WidgetProperty property);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetManagerGetApplication(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetManagerGetTextRenderer(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetManagerGetWidgetByName(IntPtr widget, [In] byte[] name);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetManagerGetWidgetByPayload(IntPtr widget, IntPtr payload);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool WidgetManagerPresent(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern IntPtr WidgetManagerGetTexture(IntPtr widget, WidgetManagerTextureType textureType);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int WidgetManagerBatchCount(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern PixelFormat WidgetManagerGetFormat(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int WidgetManagerGetMultisamples(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint WidgetManagerGetAttributes(IntPtr widget);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void RandomSequenceInit(out ulong state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void RandomSequenceInitBySeed(out ulong state, ulong seed);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint RandomSequenceGenerate(ref ulong state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ulong RandomSequenceGenerate64(ref ulong state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float RandomSequenceGenerateFloat(ref ulong state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double RandomSequenceGenerateDouble(ref ulong state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int RandomSequenceGenerateRanged(ref ulong state, int range);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float RandomSequenceGenerateGaussian(ref ulong state);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void RayCreate(out Vector3 origin, out Vector3 direction, 
      [In] ref Vector2 position, [In] ref Vector2 surfaceSize, [In] ref Matrix4x4 viewInverse, 
      [In] ref Matrix4x4 projection);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool RayIntersectTriangle([In] ref Vector3 origin, [In] ref Vector3 direction, 
      [In] ref Vector3 vertex1, [In] ref Vector3 vertex2, [In] ref Vector3 vertex3, 
      [MarshalAs(UnmanagedType.U1)] bool backFacing, out Vector2 intersection, out float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool RayIntersectCubeVolume([In] ref Vector3 origin, [In] ref Vector3 direction, 
      [In] ref Matrix4x4 world, out float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool RayIntersectPlane([In] ref Vector3 origin, [In] ref Vector3 direction, 
      [In] ref Vector3 planePoint, [In] ref Vector3 planeNormal, out Vector3 intersection, out float distance);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    [return: MarshalAs(UnmanagedType.U1)]
    internal static extern bool PixelFormatValid(PixelFormat format);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint PixelFormatBits(PixelFormat format);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void PixelFormatConvert(IntPtr dest, IntPtr source, PixelFormat destFormat, 
      PixelFormat sourceFormat);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void PixelFormatConvertArray(IntPtr dest, IntPtr source, PixelFormat destFormat, 
      PixelFormat sourceFormat, uint destPitch, uint sourcePitch, int width, int height);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColor(uint color, int alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorF(uint color, float alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorWithGray(uint color, int gray, int alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorWithGrayF(uint color, float gray, float alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorRGB(int red, int green, int blue, int alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorRGBF(float red, float green, float blue, float alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorGray(int gray, int alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorGrayF(float gray, float alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorAlpha(int alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MakeColorAlphaF(float alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int GetColorAlpha(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float GetColorAlphaF(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint PremultiplyAlpha(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint UnpremultiplyAlpha(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint DisplaceRB(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint InvertColor(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint AddColors(uint color1, uint color2);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint SubtractColors(uint color1, uint color2);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint MultiplyColors(uint color1, uint color2);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint AverageColors(uint color1, uint color2);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint AverageFourColors(uint color1, uint color2, uint color3, uint color4);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint AverageSixColors(uint color1, uint color2, uint color3, uint color4, 
      uint color5, uint color6);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint BlendColors(uint color1, uint color2, int alpha);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint BlendFourColors(uint topLeft, uint topRight, uint bottomRight, 
      uint bottomLeft, int alphaX, int alphaY, [MarshalAs(UnmanagedType.U1)] bool horizontal);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint ComposeColors(uint source, uint dest);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ColorToGray(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int ColorToGray16(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float ColorToGrayF(uint color);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float Lerp(float value1, float value2, float theta);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float Cubic(float predValue1, float value1, float value2, float succValue2, 
      float theta);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float CatmullRom(float predValue1, float value1, float value2, float succValue2, 
      float theta);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float Hermite(float predValue1, float value1, float value2, float succValue2, 
      float theta, float tension, float bias);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SmoothStep(float value1, float value2, float theta);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SmootherStep(float value1, float value2, float theta);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SineTransform(float value);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SineAccelerate(float value);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SineDecelerate(float value);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SineCycle(float value);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float SineTwoCycle(float value);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float BiasTransform(float value, float bias);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern float GainTransform(float value, float gain);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBoundsToMatrixModel(out Matrix4x4 model, [In] ref Vector3 minBounds, 
      [In] ref Vector3 maxBounds, [In] ref MeshAligns aligns, float scale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBoundsToMatrixVolume(out Matrix4x4 volume, [In] ref Vector3 minBounds, 
      [In] ref Vector3 maxBounds, [In] ref MeshAligns aligns, float scale);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBoundsTagOffset([In] ref Vector3 meshMinBounds, 
      [In] ref Vector3 meshMaxBounds, [In] ref Vector3 tagMinBounds, [In] ref Vector3 tagMaxBounds, 
      out Vector3 offset);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void MeshBoundsToMatrixVolumeTag([In] ref Vector3 meshMinBounds, 
      [In] ref Vector3 meshMaxBounds, [In] ref Vector3 tagMinBounds, [In] ref Vector3 tagMaxBounds, 
      out Matrix4x4 volume, float sizeBias);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void VolumeCalculateNearFarPlanes([In] ref Matrix4x4 worldView, 
      out float nearPlane, out float farPlane);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void VolumeCalculateVisibleFrame([In] ref Matrix4x4 worldViewProjection, 
      [In] ref Vector2 surfaceSize, out RectF visibleFrame);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern uint VertexElementsEstimatePitch(uint channel, 
      [In] VertexElement[] vertexElements, int vertexElementCount);

    [DllImport(AfterwarpLib, CallingConvention = CallingConvention.Cdecl)]
    internal static extern ulong GetSystemTicks();

  } // public class API
} // namespace Afterwarp