Git Product home page Git Product logo

derelict3's People

Contributors

bioinfornatics avatar cybershadow avatar dav1dde avatar edmccard avatar francoischabot avatar jebbs avatar jgottula avatar john-colvin avatar koltesdigital avatar lmbarros avatar martinmajewski avatar mat8913 avatar mdparker avatar mleise avatar nlguillemot avatar nvolcz avatar oaalto avatar opisano avatar p0nce avatar pixelmias avatar rikkimax avatar s-ludwig avatar simendsjo avatar skilion avatar smvilar avatar thelionsroar avatar vova616 avatar vsn4ik avatar vuaru avatar zachreizner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

derelict3's Issues

DerelictGLFW3 update

It seems that the function glfwGetJoystickPos removed from glfw3, while the function glfwGetJoystickAxes added. Check it out please.

Internal function loading syntax

Just a suggestion, with mixins function loading could look like this:

bindFunctions(
    "FT_Init_FreeType",
    "FT_Done_FreeType",
    "FT_New_Face",
    ...
);

SDL2.dll broken link

Hi, the link to the SDL2.dll in the download section in the README.markdown is broken.

Can you also put a link to the SDL2.lib?

Thanks :)

luaL_newlibtable nrec value

lua/macros.d: L111

void luaL_newlibtable(lua_State* L, luaL_Reg* l) {
lua_createtable(L, 0, l.sizeof / l[0].sizeof - 1);
}

on x86_64:

l.sizeof == 8
l[0].sizeof == 16
l.sizeof / l[0].sizeof == 0 //integer division
l.sizeof / l[0].sizeof - 1 == ulong.max

I'm no Lua expert, but i'm pretty sure that's not the value we want to pass, especially to a function that expects an int.

OpenGL 3.2 on OS X Lion

Lion (finally) supports OpenGL 3.2, but it doesn't seem to be working with Derelict3. I made a stack overflow question, basically stating that when I try DerelictGL3.reload() it only sets the OpenGL to version 2.1.

One of the answerers suggested I look at OpenGL Profiles (Mac OS X v10.7) for more information. I would attempt editing cgl.d to try to fix the problem, but I'm not sure where to start. Any ideas? Or would you be able to assist with this?

errors compiling with dmd 2.061 (beta)

I got this error compiling to 32-bit with the last dmd 2.061 beta on Linux:

derelict/lua/types.d(58): Error: struct derelict.lua.types.lua_State unknown size
derelict/lua/types.d(58): Error: struct derelict.lua.types.lua_State no size yet for forward reference

No problem when compiling to 64-bit.

assimp3

Your assimp bindings was missing some functions. As I only has assimp3 available in the package manager (and this worked mostly with your binding), I went through the exports of the dll and binded every function. BUT.. It doesn't quite work.. I really have no idea what I'm doing with the binding - I just followed what assimp2 was doing. Here are the files if you care to take over.

assimp.d

/*

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

*/
module derelict.assimp3.assimp;

public
{
    import derelict.assimp3.types;
    import derelict.assimp3.functions;
}

private
{
    import derelict.util.loader;
    import derelict.util.system;

    static if(Derelict_OS_Windows)
    {
        static if (size_t.sizeof == 4)
            enum libNames = "assimp.dll, Assimp32.dll";
        else static if (size_t.sizeof == 8)
            enum libNames = "assimp.dll, Assimp64.dll";
        else
            static assert(0);
    }
    else static if(Derelict_OS_Mac)
        enum libNames = "libassimp.dylib";
    else static if(Derelict_OS_Posix)
        enum libNames = "libassimp.so, libassimp.so.3, libassimp.so.3.0.0";
    else
        static assert(0, "Need to implement ASSIMP libNames for this operating system.");
}

class DerelictASSIMP3Loader : SharedLibLoader
{

    protected
    {
        override void loadSymbols()
        {
            bindFunc(cast(void**)&aiApplyPostProcessing, "aiApplyPostProcessing");
            bindFunc(cast(void**)&aiAttachLogStream, "aiAttachLogStream");
            bindFunc(cast(void**)&aiCopyScene, "aiCopyScene");
            bindFunc(cast(void**)&aiCreatePropertyStore, "aiCreatePropertyStore");
            bindFunc(cast(void**)&aiCreateQuaternionFromMatrix, "aiCreateQuaternionFromMatrix");
            bindFunc(cast(void**)&aiDecomposeMatrix, "aiDecomposeMatrix");
            bindFunc(cast(void**)&aiDetachAllLogStreams, "aiDetachAllLogStreams");
            bindFunc(cast(void**)&aiDetachLogStream, "aiDetachLogStream");
            bindFunc(cast(void**)&aiEnableVerboseLogging, "aiEnableVerboseLogging");
            bindFunc(cast(void**)&aiExportScene, "aiExportScene");
            bindFunc(cast(void**)&aiExportSceneEx, "aiExportSceneEx");
            bindFunc(cast(void**)&aiExportSceneToBlob, "aiExportSceneToBlob");
            bindFunc(cast(void**)&aiGetCompileFlags, "aiGetCompileFlags");
            bindFunc(cast(void**)&aiGetErrorString, "aiGetErrorString");
            bindFunc(cast(void**)&aiGetExportFormatCount, "aiGetExportFormatCount");
            bindFunc(cast(void**)&aiGetExportFormatDescription, "aiGetExportFormatDescription");
            bindFunc(cast(void**)&aiGetExtensionList, "aiGetExtensionList");
            bindFunc(cast(void**)&aiGetLegalString, "aiGetLegalString");
            bindFunc(cast(void**)&aiGetMaterialColor, "aiGetMaterialColor");
            bindFunc(cast(void**)&aiGetMaterialFloatArray, "aiGetMaterialFloatArray");
            bindFunc(cast(void**)&aiGetMaterialIntegerArray, "aiGetMaterialIntegerArray");
            bindFunc(cast(void**)&aiGetMaterialProperty, "aiGetMaterialProperty");
            bindFunc(cast(void**)&aiGetMaterialString, "aiGetMaterialString");
            bindFunc(cast(void**)&aiGetMaterialTexture, "aiGetMaterialTexture");
            bindFunc(cast(void**)&aiGetMaterialTextureCount, "aiGetMaterialTextureCount");
            bindFunc(cast(void**)&aiGetMemoryRequirements, "aiGetMemoryRequirements");
            bindFunc(cast(void**)&aiGetPredefinedLogStream, "aiGetPredefinedLogStream");
            bindFunc(cast(void**)&aiGetVersionMajor, "aiGetVersionMajor");
            bindFunc(cast(void**)&aiGetVersionMinor, "aiGetVersionMinor");
            bindFunc(cast(void**)&aiGetVersionRevision, "aiGetVersionRevision");
            bindFunc(cast(void**)&aiIdentityMatrix3, "aiIdentityMatrix3");
            bindFunc(cast(void**)&aiIdentityMatrix4, "aiIdentityMatrix4");
            bindFunc(cast(void**)&aiImportFile, "aiImportFile");
            bindFunc(cast(void**)&aiImportFileEx, "aiImportFileEx");
            bindFunc(cast(void**)&aiImportFileExWithProperties, "aiImportFileExWithProperties");
            bindFunc(cast(void**)&aiImportFileFromMemory, "aiImportFileFromMemory");
            bindFunc(cast(void**)&aiImportFileFromMemoryWithProperties, "aiImportFileFromMemoryWithProperties");
            bindFunc(cast(void**)&aiIsExtensionSupported, "aiIsExtensionSupported");
            bindFunc(cast(void**)&aiMultiplyMatrix3, "aiMultiplyMatrix3");
            bindFunc(cast(void**)&aiMultiplyMatrix4, "aiMultiplyMatrix4");
            bindFunc(cast(void**)&aiReleaseExportBlob, "aiReleaseExportBlob");
            bindFunc(cast(void**)&aiReleaseImport, "aiReleaseImport");
            bindFunc(cast(void**)&aiReleasePropertyStore, "aiReleasePropertyStore");
            bindFunc(cast(void**)&aiSetImportPropertyFloat, "aiSetImportPropertyFloat");
            bindFunc(cast(void**)&aiSetImportPropertyInteger, "aiSetImportPropertyInteger");
            bindFunc(cast(void**)&aiSetImportPropertyString, "aiSetImportPropertyString");
            bindFunc(cast(void**)&aiTransformVecByMatrix3, "aiTransformVecByMatrix3");
            bindFunc(cast(void**)&aiTransformVecByMatrix4, "aiTransformVecByMatrix4");
            bindFunc(cast(void**)&aiTransposeMatrix3, "aiTransposeMatrix3");
            bindFunc(cast(void**)&aiTransposeMatrix4, "aiTransposeMatrix4");
        }
    }

    public
    {
        this()
        {
            super(libNames);
        }
    }
}

__gshared DerelictASSIMP3Loader DerelictASSIMP3;

shared static this()
{
    DerelictASSIMP3 = new DerelictASSIMP3Loader();
}

shared static ~this()
{
    DerelictASSIMP3.unload();
}

types.d

/*

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

*/
module derelict.assimp3.types;


// assimp.h
extern (C) nothrow alias void function(const(char)*, char*) aiLogStreamCallback;

struct aiPropertyStore
{
    char sentinel;
}

struct aiLogStream
{
    aiLogStreamCallback callback;
    char* user;
}


// aiPostProcess.h
enum aiPostProcessSteps : uint
{
    CalcTangentSpace = 0x1,
    JoinIdenticalVertices = 0x2,
    MakeLeftHanded = 0x4,
    Triangulate = 0x8,
    RemoveComponent = 0x10,
    GenNormals = 0x20,
    GenSmoothNormals = 0x40,
    SplitLargeMeshes = 0x80,
    PreTransformVertices = 0x100,
    LimitBoneWeights = 0x200,
    ValidateDataStructure = 0x400,
    ImproveCacheLocality = 0x800,
    RemoveRedundantMaterials = 0x1000,
    FixInfacingNormals = 0x2000,
    SortByPType = 0x8000,
    FindDegenerates = 0x10000,
    FindInvalidData = 0x20000,
    GenUVCoords = 0x40000,
    TransformUVCoords = 0x80000,
    FindInstances = 0x100000,
    OptimizeMeshes = 0x200000,
    OptimizeGraph = 0x400000,
    FlipUVs = 0x800000,
    FlipWindingOrder = 0x1000000,
    aiProcess_SplitByBoneCount  = 0x2000000,
    aiProcess_Debone  = 0x4000000,
}

// aiAnim.h
struct aiVectorKey
{
    double mTime;
    aiVector3D mValue;
}

struct aiQuatKey
{
    double mTime;
    aiQuaternion mValue;
}

struct aiMeshKey
{
    double mTime;
    uint mValue;
}

enum aiAnimBehaviour : uint
{
    DEFAULT = 0x0,
    CONSTANT = 0x1,
    LINEAR = 0x2,
    REPEAT = 0x3,
}

struct aiNodeAnim
{
    aiString mNodeName;
    uint mNumPositionKeys;
    aiVectorKey* mPositionKEys;
    uint mNumRotationKeys;
    aiQuatKey* mRotationKeys;
    uint mNumScalingKeys;
    aiVectorKey* mScalingKeys;
    aiAnimBehaviour mPreState;
    aiAnimBehaviour mPostState;
}

struct aiMeshAnim
{
    aiString mName;
    uint mNumKeys;
    aiMeshKey* mKeys;
}

struct aiAnimation
{
    aiString mName;
    double mDuration;
    double mTicksPerSecond;
    uint mNumChannels;
    aiNodeAnim** mChannels;
    uint mNumMeshChannels;
    aiMeshAnim** mMeshChannels;
}


// aiMaterial.h
enum AI_DEFUALT_MATERIAL_NAME = "DefaultMaterial";

const uint AI_MAX_NUMBER_OF_COLOR_SETS = 0x8;
const uint AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8;

enum aiTextureOp : uint
{
    Multiply = 0x0,
    Add = 0x1,
    Subtract = 0x2,
    Divide = 0x3,
    SmoothAdd = 0x4,
    SignedAdd = 0x5,
}

enum aiTextureMapMode : uint
{
    Wrap = 0x0,
    Clamp = 0x1,
    Decal = 0x3,
    Mirror = 0x2,
}

enum aiTextureMapping : uint
{
    UV = 0x0,
    SPHERE = 0x1,
    CYLINDER = 0x2,
    BOX = 0x3,
    PLANE = 0x4,
    OTHER = 0x5,
}

enum aiTextureType : uint
{
    NONE = 0x0,
    DIFFUSE = 0x1,
    SPECULAR = 0x2,
    AMBIENT = 0x3,
    EMISSIVE = 0x4,
    HEIGHT = 0x5,
    NORMALS = 0x6,
    SHININESS = 0x7,
    OPACITY = 0x8,
    DISPLACEMENT = 0x9,
    LIGHTMAP = 0xA,
    REFLECTION = 0xB,
    UNKNOWN = 0xC,
}

enum aiShadingMode : uint
{
    Flat = 0x1,
    Gouraud = 0x2,
    Phong = 0x3,
    Blinn = 0x4,
    Toon = 0x5,
    OrenNayar = 0x6,
    Minnaert = 0x7,
    CookTorrance = 0x8,
    NoShading = 0x9,
    Fresnel = 0xA,
}

enum aiTextureFlags : uint
{
    Invert = 0x1,
    UseAlpha = 0x2,
    IgnoreAlpha = 0x4,
}

enum aiBlendMode : uint
{
    Default = 0x0,
    Additive = 0x1,
}

struct aiUVTransform
{
    aiVector2D mTranslation;
    aiVector3D mScaling;
    float mRotation;
}

enum aiPropertyTypeInfo : uint
{
    Float = 0x1,
    String = 0x3,
    Integer = 0x4,
    Buffer = 0x5,
}

struct aiMaterialProperty
{
    aiString mKey;
    uint mSemantic;
    uint mIndex;
    uint mDataLength;
    aiPropertyTypeInfo mType;
    char* mData;
}

struct aiMaterial
{
    aiMaterialProperty** mProperties;
    uint mNumProperties;
    uint mNumAllocated;
}


// aiTexture.h
struct aiTexel
{
    ubyte b, g, r, a;
}

struct aiTexture
{
    uint mWidth;
    uint mHeight;
    char achFormatHint[4];
    aiTexel* pcData;
}


// aiLight.h
enum aiLightSourceType : uint
{
    UNDEFINED = 0x0,
    DIRECTIONAL = 0x1,
    POINT = 0x2,
    SPOT = 0x3,
}

struct aiLight
{
    aiString mName;
    aiLightSourceType mType;
    aiVector3D mPosition;
    aiVector3D mDirection;
    float mAttenuationConstant;
    float mAttenuationLinear;
    float mAttentuationQuadratic;
    aiColor3D mColorDiffuse;
    aiColor3D mColorSpecular;
    aiColor3D mColorAmbient;
    float mAngleInnerCone;
    float mAngleOuterCone;
}


// aiCamera.h
struct aiCamera
{
    aiString mName;
    aiVector3D mPosition;
    aiVector3D mUp;
    aiVector3D mLookAt;
    float mHorizontalFOV;
    float mClipPlaneNear;
    float mClipPlaneFar;
    float mAspect;
}


// aiFileIO.h
extern (C) nothrow
{
    alias size_t function(aiFile*, const char*, size_t, size_t) aiFileWriteProc;
    alias size_t function(aiFile*, char*, size_t, size_t) aiFileReadProc;
    alias size_t function(aiFile*) aiFileTellProc;
    alias void function(aiFile*) aiFileFlushProc;
    alias aiReturn function(aiFile*, size_t, aiOrigin) aiFileSeekProc;

    alias aiFile* function(aiFileIO*, const char*, const char*) aiFileOpenProc;
    alias void function(aiFileIO*, aiFile*) aiFileCloseProc;

    alias char* aiUserData;
}

struct aiFileIO
{
    aiFileOpenProc OpenProc;
    aiFileCloseProc CloseProc;
    aiUserData UserData;
}

struct aiFile
{
    aiFileReadProc ReadProc;
    aiFileWriteProc WriteProc;
    aiFileTellProc TellProc;
    aiFileTellProc FileSizeProc;
    aiFileSeekProc SeekProc;
    aiFileFlushProc FlushProc;
    aiUserData UserData;
}


// aiVector2D.h
struct aiVector2D
{
    float x, y;
}


// aiVector3D.h
struct aiVector3D
{
    float x, y, z;
}


// aiQuaternion.h
struct aiQuaternion
{
    float w, x, y, z;
}


// aiMatrix3x3.h
struct aiMatrix3x3
{
    float a1, a2, a3;
    float b1, b2, b3;
    float c1, c2, c3;
}


// aiMatrix4x4.h
struct aiMatrix4x4
{
    float a1, a2, a3, a4;
    float b1, b2, b3, b4;
    float c1, c2, c3, c4;
    float d1, d2, d3, d4;
}


// aiColor4D.h
struct aiColor4D
{
    float r, g, b, a;
}


// aiMesh.h
struct aiFace
{
    uint mNumIndices;
    uint* mIndices;
}

struct aiVertexWeight
{
    uint mVertexId;
    float mWeight;
}

struct aiBone
{
    aiString mName;
    uint mnumWeights;
    aiVertexWeight* mWeights;
    aiMatrix4x4 mOffsetMatrix;
}

enum aiPrimitiveType : uint
{
    POINT = 0x1,
    LINE = 0x2,
    TRIANGLE = 0x4,
    POLYGON = 0x8,
}

struct aiAnimMesh
{
    aiVector3D* mVertices;
    aiVector3D* mNormals;
    aiVector3D* mTangents;
    aiVector3D* mBitangents;
    aiColor4D* mColor[AI_MAX_NUMBER_OF_COLOR_SETS];
    aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
    uint mNumVertices;
}

struct aiMesh
{
    uint mPrimitiveTypes;
    uint mNumVertices;
    uint mNumFaces;
    aiVector3D* mVertices;
    aiVector3D* mNormals;
    aiVector3D* mTangents;
    aiVector3D* mBitangents;
    aiColor4D * mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
    aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
    uint mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
    aiFace* mFaces;
    uint mNumBones;
    aiBone** mBones;
    uint mMaterialIndex;
    aiString mName;
    uint mNumAnimMeshes;
    aiAnimMesh** mAnimMeshes;
}


// aiScene.h
struct aiNode
{
    aiString mName;
    aiMatrix4x4 mTransformation;
    aiNode* mParent;
    uint mNumChildren;
    aiNode** mChildren;
    uint mNumMeshes;
    uint* mMeshes;
}

struct aiScene
{
    uint mFlags;
    aiNode* mRootNode;
    uint mNumMeshes;
    aiMesh** mMeshes;
    uint mNumMaterials;
    aiMaterial** mMaterials;
    uint mNumAnimations;
    aiAnimation** mAnimations;
    uint mNumTextures;
    aiTexture** mTextures;
    uint mNumLights;
    aiLight** mLights;
    uint mNumCameras;
    aiCamera** mCameras;
}


// aiTypes.h
struct aiPlane
{
    float a, b, c, d;
}

struct aiRay
{
    aiVector3D pos, dir;
}

struct aiColor3D
{
    float r, g, b;
}

struct aiString
{
    size_t length;
    char data[MAXLEN];
}

enum aiReturn : int
{
    SUCCESS = 0x0,
    FAILURE = -0x1,
    OUTOFMEMORY = -0x3,
}

enum aiOrigin : uint
{
    SET = 0x0,
    CUR = 0x1,
    END = 0x2,
}

enum aiDefaultLogStream : int
{
    FILE = 0x1,
    STDOUT = 0x2,
    STDERR = 0x4,
    DEBUGGER = 0x8,
}

struct aiMemoryInfo
{
    uint textures;
    uint materials;
    uint meshes;
    uint nodes;
    uint animations;
    uint cameras;
    uint lights;
    uint total;
}

const size_t MAXLEN = 1024;

alias int aiBool;

enum AI_FALSE = 0,
     AI_TRUE = 1;


// version.h
enum ASSIMP_CFLAGS_SHARED = 0x1,
     ASSIMP_CFLAGS_STLPORT = 0x2,
     ASSIMP_CFLAGS_DEBUG = 0x4,
     ASSIMP_CFLAGS_NOBOOST = 0x8,
     ASSIMP_CFLAGS_SINGLETHREADED = 0x10;

// cexport.h
struct aiExportDataBlob 
{
    size_t size;
    void* data;
    aiString name;
    aiExportDataBlob* next;
}

struct aiExportFormatDesc
{
    const(char)* id;
    const(char)* description;
    const(char)* fileExtension;
};

functions.d

/*

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

*/
module derelict.assimp3.functions;

private
{
    import derelict.assimp3.types;
}

extern(C)
{
    alias nothrow const(aiScene)* function(const(char)*, uint) da_aiImportFile;
    alias nothrow const(aiScene)* function(const(char)*, uint, aiFileIO*) da_aiImportFileEx;
    alias nothrow const(aiScene)* function(const(char)*, uint, aiFileIO*, aiPropertyStore*) da_aiImportFileExWithProperties;
    alias nothrow const(aiScene)* function(const(char)*, uint, uint, const(char)*) da_aiImportFileFromMemory;
    alias nothrow const(aiScene)* function(const(char)*, uint, uint, const(char)*, aiPropertyStore*) da_aiImportFileFromMemoryWithProperties;
    alias nothrow const(aiScene)* function(const(aiScene)*, uint) da_aiApplyPostProcessing;
    alias nothrow aiLogStream function(aiDefaultLogStream, const(char)*) da_aiGetPredefinedLogStream;
    alias nothrow void function(const(aiLogStream)*) da_aiAttachLogStream;
    alias nothrow void function(aiBool) da_aiEnableVerboseLogging;
    alias nothrow aiReturn function(const(aiLogStream)*) da_aiDetachLogStream;
    alias nothrow void function() da_aiDetachAllLogStreams;
    alias nothrow void function(const(aiScene)*) da_aiReleaseImport;
    alias nothrow const(char)* function() da_aiGetErrorString;
    alias nothrow aiBool function(const(char)*) da_aiIsExtensionSupported;
    alias nothrow void function(aiString*) da_aiGetExtensionList;
    alias nothrow void function(const(aiScene)*, aiMemoryInfo*) da_aiGetMemoryRequirements;
    alias nothrow aiPropertyStore* function() da_aiCreatePropertyStore;
    alias nothrow void function(aiPropertyStore*) da_aiReleasePropertyStore;
    alias nothrow void function(aiPropertyStore*, const(char)*, int) da_aiSetImportPropertyInteger;
    alias nothrow void function(aiPropertyStore*, const(char)*, float) da_aiSetImportPropertyFloat;
    alias nothrow void function(aiPropertyStore*, const(char)*, const(aiString)*) da_aiSetImportPropertyString;
    alias nothrow void function(aiQuaternion*, const(aiMatrix3x3)*) da_aiCreateQuaternionFromMatrix;
    alias nothrow void function(const aiMatrix4x4*, aiVector3D*, aiQuaternion*, aiVector3D*) da_aiDecomposeMatrix;
    alias nothrow void function(aiMatrix4x4*) da_aiTransposeMatrix4;
    alias nothrow void function(aiMatrix3x3*) da_aiTransposeMatrix3;
    alias nothrow void function(aiVector3D*, const(aiMatrix3x3)*) da_aiTransformVecByMatrix3;
    alias nothrow void function(aiVector3D*, const(aiMatrix4x4)*) da_aiTransformVecByMatrix4;
    alias nothrow void function(aiMatrix4x4*, const(aiMatrix4x4)*) da_aiMultiplyMatrix4;
    alias nothrow void function(aiMatrix3x3*, const(aiMatrix3x3)*) da_aiMultiplyMatrix3;
    alias nothrow void function(aiMatrix3x3*) da_aiIdentityMatrix3;
    alias nothrow void function(aiMatrix4x4*) da_aiIdentityMatrix4;
    alias nothrow const(char)* function() da_aiGetLegalString;
    alias nothrow uint function() da_aiGetVersionMinor;
    alias nothrow uint function() da_aiGetVersionMajor;
    alias nothrow uint function() da_aiGetVersionRevision;
    alias nothrow uint function() da_aiGetCompileFlags;

    // from material.h
    alias nothrow aiReturn function(const(aiMaterial)*, const(char)*, uint, uint, const(aiMaterialProperty*)*) da_aiGetMaterialProperty;
    alias nothrow aiReturn function(const(aiMaterial)*, const(char)*, uint, uint, float*, uint*) da_aiGetMaterialFloatArray;
    alias nothrow aiReturn function(const(aiMaterial)*, const(char)*, uint, uint, int*, uint*) da_aiGetMaterialIntegerArray;
    alias nothrow aiReturn function(const(aiMaterial)*, const(char)*, uint, uint, aiColor4D*) da_aiGetMaterialColor;
    alias nothrow aiReturn function(const(aiMaterial)*, const(char)*, uint, uint, aiString*) da_aiGetMaterialString;
    alias nothrow aiReturn function(const(aiMaterial)*, aiTextureType) da_aiGetMaterialTextureCount;
    alias nothrow aiReturn function(const(aiMaterial)*, aiTextureType, uint, aiString*, aiTextureMapping*, uint*, float*, aiTextureOp*, aiTextureMapMode*, uint*) da_aiGetMaterialTexture;

    // from cexport.h
    alias nothrow void function(const(aiScene)*, aiScene**) da_aiCopyScene;

    alias nothrow aiReturn function(const(aiScene)*, const(char)*, const(char)*, uint) da_aiExportScene;
    alias nothrow aiReturn function(const(aiScene)*, const(char)*, const(char)*, aiFileIO*, uint) da_aiExportSceneEx;

    alias nothrow const(aiExportDataBlob)* function(const(aiScene)*, const(char)*, uint) da_aiExportSceneToBlob;
    alias nothrow void function(const(aiExportDataBlob)*) da_aiReleaseExportBlob;

    alias nothrow size_t function() da_aiGetExportFormatCount;

    alias nothrow const(aiExportFormatDesc)* function(size_t) da_aiGetExportFormatDescription;
}

__gshared
{
    da_aiApplyPostProcessing aiApplyPostProcessing;
    da_aiAttachLogStream aiAttachLogStream;
    da_aiCopyScene aiCopyScene;
    da_aiCreatePropertyStore aiCreatePropertyStore;
    da_aiCreateQuaternionFromMatrix aiCreateQuaternionFromMatrix;
    da_aiDecomposeMatrix aiDecomposeMatrix;
    da_aiDetachAllLogStreams aiDetachAllLogStreams;
    da_aiDetachLogStream aiDetachLogStream;
    da_aiEnableVerboseLogging aiEnableVerboseLogging;
    da_aiExportScene aiExportScene;
    da_aiExportSceneEx aiExportSceneEx;
    da_aiExportSceneToBlob aiExportSceneToBlob;
    da_aiGetCompileFlags aiGetCompileFlags;
    da_aiGetErrorString aiGetErrorString;
    da_aiGetExportFormatCount aiGetExportFormatCount;
    da_aiGetExportFormatDescription aiGetExportFormatDescription;
    da_aiGetExtensionList aiGetExtensionList;
    da_aiGetLegalString aiGetLegalString;
    da_aiGetMaterialColor aiGetMaterialColor;
    da_aiGetMaterialFloatArray aiGetMaterialFloatArray;
    da_aiGetMaterialIntegerArray aiGetMaterialIntegerArray;
    da_aiGetMaterialProperty aiGetMaterialProperty;
    da_aiGetMaterialString aiGetMaterialString;
    da_aiGetMaterialTexture aiGetMaterialTexture;
    da_aiGetMaterialTextureCount aiGetMaterialTextureCount;
    da_aiGetMemoryRequirements aiGetMemoryRequirements;
    da_aiGetPredefinedLogStream aiGetPredefinedLogStream;
    da_aiGetVersionMajor aiGetVersionMajor;
    da_aiGetVersionMinor aiGetVersionMinor;
    da_aiGetVersionRevision aiGetVersionRevision;
    da_aiIdentityMatrix3 aiIdentityMatrix3;
    da_aiIdentityMatrix4 aiIdentityMatrix4;
    da_aiImportFile aiImportFile;
    da_aiImportFileEx aiImportFileEx;
    da_aiImportFileExWithProperties aiImportFileExWithProperties;
    da_aiImportFileFromMemory aiImportFileFromMemory;
    da_aiImportFileFromMemoryWithProperties aiImportFileFromMemoryWithProperties;
    da_aiIsExtensionSupported aiIsExtensionSupported;
    da_aiMultiplyMatrix3 aiMultiplyMatrix3;
    da_aiMultiplyMatrix4 aiMultiplyMatrix4;
    da_aiReleaseExportBlob aiReleaseExportBlob;
    da_aiReleaseImport aiReleaseImport;
    da_aiReleasePropertyStore aiReleasePropertyStore;
    da_aiSetImportPropertyFloat aiSetImportPropertyFloat;
    da_aiSetImportPropertyInteger aiSetImportPropertyInteger;
    da_aiSetImportPropertyString aiSetImportPropertyString;
    da_aiTransformVecByMatrix3 aiTransformVecByMatrix3;
    da_aiTransformVecByMatrix4 aiTransformVecByMatrix4;
    da_aiTransposeMatrix3 aiTransposeMatrix3;
    da_aiTransposeMatrix4 aiTransposeMatrix4;
}

da_alGetString small fix

alias nothrow const(char)* function(ALenum) da_alGetString;

should be

alias nothrow const(ALchar)* function(ALenum) da_alGetString;

errors compiling with dmd 2.061 (alpha)

$ dmd -c -op derelict/lua/macros.d

derelict/lua/macros.d(128): Error: cannot implicitly convert expression ((*luaL_checkinteger)(L, n)) of type long to int
derelict/lua/macros.d(131): Error: cannot implicitly convert expression ((*luaL_optinteger)(L, n, d)) of type long to int

Why build/build.d do not warn these errors?

ASSIMP: aiMesh structure

I recently ran into a problem when using the derelict assimp bindings.

More specifically, when accessing the mFaces member of an aiMesh instance, mFaces was always "null", which it should never be according to the assimp documentation.

I traced the problem back to the following fact:

in assimp/mesh.h I have:

define AI_MAX_NUMBER_OF_COLOR_SETS 0x8
define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x8

while in derelict/assimp/types.d I have:

const uint AI_MAX_NUMBER_OF_COLOR_SETS = 0x4;
const uint AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x4;

This results in a different memory layout of the c and d structs, and aiMesh.mFaces accessing the wrong memory.

KHR_debug extension not bound properly

KHR_debug extension binds to a single function glDebug, which does noct exist in the specification. glDebug is a prefix to a function familly. Enums from the specification are not implemented as well. The binding throws an SymbolLoadException.

Derelict.freetype library names

Not sure the proper way of sending these fixes in so I will send in an issue.

In derelict.freetype.ft.d the libraries are listed as so:

else static if(Derelict_OS_Mac) enum libNames = "libfreetype.so.6,libfreetype.so"; else static if(Derelict_OS_Posix) enum libNames = "libfreetype.dylib,libfreetype.6.dylib,libfreetype.6.3.16.dylib,/usr/X11/lib/libfreetype.dylib,/usr/X11/lib/libfreetype.6.dylib,/usr/X11/lib/libfreetype.6.3.16.dylib";

Should the libnames be switched so the .dylib's are associated with Derelict_OS_Mac and the .so's with Derelict_OS_Posix?

SDL2 bindings do not match prebuilt DLL

Hi,

Currently, SDL2 bindings do not match neither the DLL located at https://github.com/downloads/aldacron/Derelict3/SDL2.dll (missing SDL_GetDisplayName) nor the latest SDL2 hg (missing SDL_GetTouch).

Could you please do one of the following:

  • Upload a DLL matching the current Derelict 3 bindings
  • Specify which hg commit are the current bindings based off, so I could build a compatible SDL2.dll myself
  • Update the bindings to match SDL2 hg
  • Provide instructions on the proper way to update bindings, so I could put together a pull request (e.g. Which hg commit are the current bindings based off? Is there a better way than comparing the "include" directories?)

GLFW

from latest glw3 rev they are fixed shared libb buils but with derelict
this line:

GLFWwindow window = glfwOpenWindow( xResolution, yResolution, GLFW_WINDOWED, "Imperium" , null );

is always null

module main;

import std.string;
import std.stdio;
import std.conv;
import std.getopt;
import std.c.process;
import std.exception;
import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;
import derelict.glfw3.types;

pragma(lib, "glfw");
pragma(lib, "DerelictGL3");
pragma(lib, "DerelictGLFW3");
pragma(lib, "DerelictUtil");
pragma(lib, "dl");

enum string v           = "0.1";
enum string[] authors   = [ "Jonathan MERCIER" ];
size_t verbosity        = 1;

// horizontal and vertical screen resolution
const int   xResolution     = 800;
const int   yResolution     = 600;

void main( string[] args ){
    void help(){
        writefln( "Usage: %s [option]", args[0] );
        writeln(
`
--help      -h  Display this message
--version   -v  Display program version
--verbose   -v  Increase verbosity
--quiet     -q  Turn off verbosity
`
        );
        exit(0);
    }
    void about(){
        writefln( "Imperium version %s", v );
        writeln( "Writen by:");
        foreach( author; authors )
            writefln( "\t- %s", author );
        exit(0);
    }
    void verbose( string option ){
        switch( option ){
           case("v"):
           case("verbose"):
               verbosity += 1;
               break;
           case("quiet"):
               verbosity = 0;
               break;
           default:
               verbosity = 1;
               break;
        }
    }

    getopt(
        args,
        "help|h",       &help,
        "version",      &about,
        "verbose|v",    &verbosity,
        "quiet|q",      &verbosity
    );

    principale();
}

void principale(){
    DerelictGL3.load();
    DerelictGLFW3.load();
    bool isRunning = true;
    scope(exit) glfwTerminate();
    scope(exit) isRunning = false;

    if( !glfwInit() )
      throw new Exception( "glfwInit failure: " ~ to!string( glfwErrorString( glfwGetError() ) ) ) ;

    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    GLFWwindow window = glfwOpenWindow( xResolution, yResolution, GLFW_WINDOWED, "Imperium" , null );

    enforce(
            window !is null,
            " Error impossible to create the main window"
           );

    glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

    glfwSwapInterval(1);

    while( isRunning ){
        // OpenGL rendering goes here...
        glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
        // Swap front and back rendering buffers
        glfwSwapBuffers();
        // Check if ESC key was pressed or window was closed
        writefln( "est une fenêtre: %s", glfwIsWindow(window) == GL_TRUE );
        isRunning = glfwIsWindow(window) && glfwGetKey( window, GLFW_KEY_ESCAPE ) != GLFW_PRESS;
    }
}

SFML2 sfTransform_Identity doesnt exist.

The blank transform "sfTransform_Identity" defined in Transform.h doesnt seem to exist in derelict3 bindings.

This may be causing issues with using RenderStates.

void glfwSetWindowPos( int x, int y ) not available in Derelict 3

GLFW's "void glfwSetWindowPos( int x, int y )" function is missing, please add this into the project.

Hmm... found this at the glfw repository:

Removed glfwSetWindowPos and glfwGetWindowPos
glfwGetWindowPos is superseded by glfwGetWindowParam()
with GLFW_POSITION_X and GLFW_POSITION_Y as parameters.

glfwSetWindowPos can easily lead to bad practices
(moving windows around without the users consent), and
has been replaced with the GLFW_POSITION_X/Y window
hints that allow setting the window position for a
newly created window.


If this is the current state of glfw, than excuse my issue-report, please! Had an old glfw revision installed!

Failed to load symbol SDL_JoystickOpened from shared library libSDL2.so

I'm using the latest versions of Derelict3 and SDL2 built right from their respective repositories.

[mfag@mfag-tpad lighthouse]$ cat test.d
int main() {
    DerelictSDL2.load();
    return 0;
}
[mfag@mfag-tpad lighthouse]$ dmd test.d -L-lSDL2 -L-ldl -L-lDerelictSDL2 -L-lDerelictUtil
[mfag@mfag-tpad lighthouse]$ ./test
derelict.util.exception.SymbolLoadException@../import/derelict/util/exception.d(38): Failed to load symbol SDL_JoystickOpened from shared library libSDL2.so
----------------
./test(void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool)+0x7d) [0x4306a9]
./test(void derelict.sdl2.sdl.DerelictSDL2Loader.loadSymbols()+0x116a) [0x42d97e]
./test(void derelict.util.loader.SharedLibLoader.load(immutable(char)[][])+0x2f) [0x430553]
./test(void derelict.util.loader.SharedLibLoader.load(immutable(char)[])+0xa4) [0x43051c]
./test(void derelict.util.loader.SharedLibLoader.load()+0x18) [0x430470]
./test(_Dmain+0x12) [0x42c752]
./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x1c) [0x4355f8]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x434f72]
./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x3b) [0x43563f]
./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void delegate())+0x2a) [0x434f72]
./test(main+0xd1) [0x434efd]
/usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7fe5ba134725]
----------------

Building on MAC OS X

Here's the output of rdmd on MAC OS X 10.7

/Users/Nebster/Development/D/Derelict3/build [master] 2718 % rdmd derelict.d    
Using the Digital Mars DMD compiler.
Using the Digital Mars DMD compiler.
Building all packages.
Building DerelictUtil

../import/derelict/util/exception.d
../import/derelict/util/loader.d
../import/derelict/util/sharedlib.d
../import/derelict/util/system.d
../import/derelict/util/wintypes.d
../import/derelict/util/xtypes.d
../import/derelict/util/sharedlib.d(55): Error: undefined identifier CCPTR
../import/derelict/util/sharedlib.d(57): Error: undefined identifier CCPTR

DerelictSFML2Graphics.load() loads missing function.

Sorry for lack of form this is my first time doing anything like this, anyways onto it.

I have been trying to piece together how to use SFML2 with Derelict3 and i have managed to recompile the latest CSFML2 build and it worked fine until i ran DerelictSFML2Graphics.load() at which point there was an error because derelict/sfml2/graphics.d try's to import the function "sfShader_unbind" which appears to be missing from the current CSFML2 build, by commenting this out it all seems to work fine now. I will continue working with it and report further in case there is still a problem.

I am not sure if this function is meant to be there but was just overlooked in the current CSFML2 build, i cannot seem to get onto their forums to ask.

LUA lib

I do not see anymore the lua binding lib?

with linux OS and build as shared lib

glGenVertexArrays and associated functions not bound in Derelict

Is there any reason why glGenVertexArrays(GLsizei n, GLuint *arrays), glBindVertexArray(GLuint array) and glDeleteVertexArrays(GLsizei n, GLuint *arrays) are absent from opengl3/functions.d? Reading around, it seems as if VAOs are required in programs using the OpenGL 3.2 Core Profile and up. These functions are defined in the OS X version of gl3.h and also in the GL3 man pages:

Just seeking clarification (as usual, I have no idea what I'm doing, haha). If this was indeed unintentional, I can quickly do the work and submit a pull request.

errors compiling with dmd 2.060

I'm getting this errors when compiling with dmd 2.060 beta:

[...]
../import/derelict/opengl3/glx.d(177): Error: expected 3 function arguments, not 2
../import/derelict/opengl3/glx.d(178): Error: expected 3 function arguments, not 2
[...]
../import/derelict/opengl3/glx.d(198): Error: expected 3 function arguments, not 2
[...]
Building DerelictSFML2

std.file.FileException@std/file.d(2514): ../import/derelict/sfml2/: No such file or directory
[...]

GLFW3

to record what to do:

  • GLFWmonitorfun
    glfw.types line 308 define GLFWmonitorfun as function(GLFWmonitor*) GLFWmonitorfun
    but it should to be function(GLFWmonitor*, int) GLFWmonitorfun
    reference
  • GLFW_REPEAT
    glfw.types line 40 need to add GLFW_REPEAT = 2
    reference
  • modifier key
    add into glfw.types
enum{
    GLFW_MOD_SHIFT      = 0x0001,
    GLFW_MOD_CONTROL    = 0x0002,
    GLFW_MOD_ALT        = 0x0004,
    GLFW_MOD_SUPER      = 0x0008
}

reference

  • glfwGetVideoMode ( this one do not end by s)
    glfw3.functions line 54 define GLFWvidmode function(GLFWmonitor*) da_glfwGetVideoMode;
    but it should to be const(GLFWvidmode*) function(GLFWmonitor)* da_glfwGetVideoMode;
    reference
  • GLFWmousebuttonfun
    glfw3.types line 310 define function(GLFWwindow*, int, int) GLFWmousebuttonfun;
    but it should to be function(GLFWwindow*, int, int, int) GLFWmousebuttonfun;
    reference
  • GLFWkeyfun
    glfw3.types line 314 define function(GLFWwindow*, int, int) GLFWkeyfun
    but it should to be function(GLFWwindow*, int, int, int) GLFWkeyfun
    reference
  • GLFWcharfun
    glfw3.types line 315 define function(GLFWwindow*, int) GLFWcharfun;
    but it should to be function(GLFWwindow*, uint) GLFWcharfun;
    reference
  • Update new joystick BPI
    reference
  • patch
diff -up derelict-20130524gita5c9387/import/derelict/glfw3/functions.d.fix derelict-20130524gita5c9387/import/derelict/glfw3/functions.d
--- derelict-20130524gita5c9387/import/derelict/glfw3/functions.d.fix   2013-05-24 02:31:42.000000000 +0200
+++ derelict-20130524gita5c9387/import/derelict/glfw3/functions.d   2013-05-26 02:27:57.965976844 +0200
@@ -51,7 +51,7 @@ extern(C)
     alias nothrow void function(GLFWmonitor*, int*, int*) da_glfwGetMonitorPos;

     alias nothrow const(GLFWvidmode)* function(GLFWmonitor*, int*) da_glfwGetVideoModes;
-    alias nothrow GLFWvidmode function(GLFWmonitor*) da_glfwGetVideoMode;
+    alias nothrow const(GLFWvidmode)* function(GLFWmonitor*) da_glfwGetVideoMode;

     alias nothrow void function(float) da_glfwSetGamma;
     alias nothrow void function(GLFWgammaramp*) da_glfwGetGammaRamp;
@@ -97,9 +97,9 @@ extern(C)
     alias nothrow void function(GLFWwindow*, GLFWcursorenterfun) da_glfwSetCursorEnterCallback;
     alias nothrow void function(GLFWwindow*, GLFWscrollfun) da_glfwSetScrollCallback;

-    alias nothrow int function(int, int) da_glfwGetJoystickParam;
-    alias nothrow int function(int, float*, int) da_glfwGetJoystickAxes;
-    alias nothrow int function(int, ubyte*, int) da_glfwGetJoystickButtons;
+    alias nothrow int function(int) da_glfwJoystickPresent;
+    alias nothrow float* function(int, int) da_glfwGetJoystickAxes;
+    alias nothrow uint* function(int, int) da_glfwGetJoystickButtons;
     alias nothrow const(char)* function(int) da_glfwGetJoystickName;

     alias nothrow void function(GLFWwindow*, const(char)*) da_glfwSetClipboardString;
@@ -173,7 +173,7 @@ __gshared
     da_glfwSetCursorPosCallback glfwSetCursorPosCallback;
     da_glfwSetCursorEnterCallback glfwSetCursorEnterCallback;
     da_glfwSetScrollCallback glfwSetScrollCallback;
-    da_glfwGetJoystickParam glfwGetJoystickParam;
+    da_glfwJoystickPresent glfwJoystickPresent;
     da_glfwGetJoystickAxes glfwGetJoystickAxes;
     da_glfwGetJoystickButtons glfwGetJoystickButtons;
     da_glfwGetJoystickName glfwGetJoystickName;
diff -up derelict-20130524gita5c9387/import/derelict/glfw3/glfw3.d.fix derelict-20130524gita5c9387/import/derelict/glfw3/glfw3.d
--- derelict-20130524gita5c9387/import/derelict/glfw3/glfw3.d.fix   2013-05-26 02:30:49.804294648 +0200
+++ derelict-20130524gita5c9387/import/derelict/glfw3/glfw3.d   2013-05-26 02:38:50.239030247 +0200
@@ -106,7 +106,7 @@ class DerelictGLFW3Loader : SharedLibLoa
             bindFunc(cast(void**)&glfwSetMouseButtonCallback, "glfwSetMouseButtonCallback");
             bindFunc(cast(void**)&glfwSetCursorPosCallback, "glfwSetCursorPosCallback");
             bindFunc(cast(void**)&glfwSetScrollCallback, "glfwSetScrollCallback");
-            bindFunc(cast(void**)&glfwGetJoystickParam, "glfwGetJoystickParam");
+            bindFunc(cast(void**)&glfwJoystickPresent, "glfwJoystickPresent");
             bindFunc(cast(void**)&glfwGetJoystickAxes, "glfwGetJoystickAxes");
             bindFunc(cast(void**)&glfwGetJoystickButtons, "glfwGetJoystickButtons");
             bindFunc(cast(void**)&glfwGetJoystickName, "glfwGetJoystickName");
diff -up derelict-20130524gita5c9387/import/derelict/glfw3/types.d.fix derelict-20130524gita5c9387/import/derelict/glfw3/types.d
--- derelict-20130524gita5c9387/import/derelict/glfw3/types.d.fix   2013-05-24 02:31:42.000000000 +0200
+++ derelict-20130524gita5c9387/import/derelict/glfw3/types.d   2013-05-26 02:27:57.965976844 +0200
@@ -37,7 +37,15 @@ enum
 enum
 {
     GLFW_RELEASE = 0,
-    GLFW_PRESS = 1
+    GLFW_PRESS  = 1,
+    GLFW_REPEAT = 2
+}
+
+enum{
+    GLFW_MOD_SHIFT      = 0x0001,
+    GLFW_MOD_CONTROL    = 0x0002,
+    GLFW_MOD_ALT        = 0x0004,
+    GLFW_MOD_SUPER      = 0x0008
 }

 enum
@@ -299,13 +307,13 @@ extern(C)
     alias void function(GLFWwindow*) GLFWwindowrefreshfun;
     alias void function(GLFWwindow*, int) GLFWwindowfocusfun;
     alias void function(GLFWwindow*, int) GLFWwindowiconifyfun;
-    alias void function(GLFWwindow*, int, int) GLFWmousebuttonfun;
+    alias void function(GLFWwindow*, int, int, int) GLFWmousebuttonfun;
     alias void function(GLFWwindow*, double, double) GLFWcursorposfun;
     alias void function(GLFWwindow*, int) GLFWcursorenterfun;
     alias void function(GLFWwindow*, double, double) GLFWscrollfun;
-    alias void function(GLFWwindow*, int, int) GLFWkeyfun;
-    alias void function(GLFWwindow*, int) GLFWcharfun;
-    alias void function(GLFWmonitor*) GLFWmonitorfun;
+    alias void function(GLFWwindow*, int, int, int) GLFWkeyfun;
+    alias void function(GLFWwindow*, uint) GLFWcharfun;
+    alias void function(GLFWmonitor*, int) GLFWmonitorfun;
 }

 struct GLFWvidmode

OpenGL version detection is too fragile

The current OpenGL version detection routine in gl3.d is not robust enough and fails with some drivers which report version numbers with a patch level. E.g. with linux 64-bit NVIDIA 304.88, glGetString(GL_VERSION) returns the following: "3.0.0 NVIDIA 304.88" which causes findMaxAvailable to return HighestSupported, which in turn leads to "failed to bind symbol ..." errors.

MacOS X 10.8 - SDL2 does install into /usr/local/lib folder and is called libSDL2.dylib

The following issue occurs on Mac OSX Mountain Lion (10.8.x) respectively it was only tested on this os:

I've pulled SDL2 (aka. SDL 1.3) from the repository to use it with derelict3 and build SDL2 like described in the appropriate readme file manually.

While performing the "make install" command I've noticed that SDL2 gets installed into "/usr/local/lib".

This folder is filled with these files afterwards:

libSDL2-2.0.0.dylib
libSDL2.la
libSDL2.a
libSDL2main.a
libSDL2.dylib

The same thing happens, if you build and install SDL2 via XCode with the SDL.xcodeproj file from the SDL repository.

Now I've written my test file and executed the build.
DerelictSDL2.load() failed and told me, that no appropriate lib could be loaded.

I've figured out that in sdl.d from the derelict3 branch the libname variable was wrongly set for Mac OSX:

Original:

else static if(Derelict_OS_Mac)
enum libNames = "../Frameworks/SDL2.framework/SDL2, /Library/Frameworks/SDL2.framework/SDL2, /System/Library/Frameworks/SDL2.framework/SDL2";

Instead it has to be:

else static if(Derelict_OS_Mac)
enum libNames = "/usr/local/lib/libSDL2.dylib";

regardless of the wrong path, the library's name has to be extended with ".dylib". Using only "libSDL2" does NOT suffice.

Now SDL2 is loaded properly.

GLFW3 out of date

Hey,

Can you provide a git revision that the current state of your binding works with? I can then work on a patch to update your bindings to the latest version if you want.

Maximum GLVersion detection incorrect.

The detection logic used by DerelictGL3 when finding the maximum GL version is flawed and will in some cases detect an incorrect version due to the driver version containing a GL version number within it. As an example from my Macbook:

3.2 NVIDIA-8.10.44 304.10.65f03

Is the result given by glGetString(GL_VERSION). Derelict's max version logic sees the 4.1 in 304.10.65f03 and assumes OpenGL 4.1 is supported. This, naturally, causes errors when attempting to reload the symbols.

The logic for detecting the maximum version either needs reworking, or Derelict needs to support a slightly more graceful failure to load beyond the detected maximum version. Perhaps a failure ceases to load the failed GL version and beyond? Another alternative seems to be the version string always begins with the GL version (but I am unable to verify this).

I also submitted a pull request with a fix I put together, I hope I did this correctly, I've never done this before.

GLFW3 Bindings out of date?

Seems like the GLFW3 bindings are dated. glfwWindowShouldClose is undefined. And I suppose there are other functions missing too. But I can't verify that.

Linux lua library path

On ubuntu 13.04 64-bit the default path for lua 5.2 library is:
/usr/lib/x86_64-linux-gnu/liblua5.2.so
So please add liblua5.2.so to the default lua library list
By the way, I really love Derelict3 :-)

Enhancement: Make unbound function pointers throw in debug mode

I hope this hasn't been proposed already, but have you considered setting unbound OpenGL functions to some error function? Basically:

template throwFunc(alias func)
{
    alias typeof(func) OriginalType;
    ReturnType!OriginalType throwFunc(ParameterTypeTuple!OriginalType)
    {
        throw new Exception("Function " ~ func.stringof ~ " is not bound!");
    }
}

It seems a little bit more difficult to implement for extern(C) functions, might have to use a string mixin:

void* throwFunc(alias func)()
{
    alias typeof(func) OriginalType;
    alias ReturnType!OriginalType RetType;
    alias ParameterTypeTuple!OriginalType ParamTypes;

    mixin("
    extern(C) " ~ RetType.stringof ~ " " ~ func.stringof ~"throwHelperDFKLS("~ParamTypes.stringof~")
    {
        throw new Exception(\"Function " ~ func.stringof ~ " is not bound!\");
    }
    return &"~ func.stringof~"throwHelperDFKLS;";
}

glGetError = throwFunc(glGetError);

it shouldn't run slower, but it might blow up executables a bit but in debug mode, that might be ok?

How about a stable release?

Derelict3 seems fairly stable for me. Why not make a release? It's not it's going to change a lot or anything. It's just a bunch of bindings.

"Error: struct derelict.sfml2.graphicstypes.sfRenderWindow unknown size"

module main;

import std.stdio;
import derelict.sfml2.system;
import derelict.sfml2.window;
import derelict.sfml2.graphics;
import derelict.sfml2.audio;

void main(string[] args)
{
    DerelictSFML2Window.load();
    DerelictSFML2System.load();
    DerelictSFML2Graphics.load();
    DerelictSFML2Audio.load();

    sfRenderWindow w;
}

Doesn't build. Using MonoDevelop. I have the csfml DLL files in the project folder, I linked all Derelict lib files.

What am I doing wrong?

FreeImageIO struct small fix

alias extern(C) nothrow int function(fi_handle handle, long offset, int origin) FI_SeekProc;

should be

alias extern(C) nothrow int function(fi_handle handle, c_long offset, int origin) FI_SeekProc;

Also, every function pointer in the FreeImageIO struct should be extern(Windows) instead of extern(C) becouse according to the FreeImage documentation they use the stdcall calling convention.

Feature request: use premake to build the projects

You could use premake-dev-d from bitbucket, either from Goughy or mine.

Pros:

  • The premake executable has a really small footprint, so you can put it into the repository.
  • The premake configuration files are easy to create and read.

Cons:

  • You need to learn a bit of Lua? (not really sure if it should be considered a cons...)
  • It currently only creates makefiles, but I'm planning to support the creation of Sublime Text projects and Visual Studio solutions.

Where glu* functions?

I dont see the GLU functions being bound, like gluPerspective(). Is there a reason they arent included in Derelict3?

rdmd build fails

$ git clone [email protected]:aldacron/Derelict3.git
Cloning into Derelict3...
X11 forwarding request failed on channel 0
remote: Counting objects: 1777, done.
remote: Compressing objects: 100% (862/862), done.
remote: Total 1777 (delta 760), reused 1660 (delta 659)
Receiving objects: 100% (1777/1777), 642.36 KiB | 184 KiB/s, done.
Resolving deltas: 100% (760/760), done.
$ cd Derelict3/build/
$ rdmd build.d
Using the Digital Mars DMD compiler.
Using the Digital Mars DMD compiler.
Building all packages.
Building DerelictPQ

std.file.FileException@std/file.d(2394): /tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/../import/derelict/pq/: No such file or directory

/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(bool std.file.DirIteratorImpl.stepIn(immutable(char)[])+0x61) [0x484a35]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(ref std.file.DirIteratorImpl std.file.DirIteratorImpl._ctor(immutable(char)[], std.file.SpanMode, bool)+0x9d) [0x484d51]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(std.file.DirIteratorImpl* std.conv.emplace!(std.file.DirIteratorImpl, immutable(char)[], std.file.SpanMode, bool).emplace(std.file.DirIteratorImpl
, ref immutable(char)[], ref std.file.SpanMode, ref bool)+0x48) [0x47c130]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(void std.typecons.__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted.RefCountedStore.initialize!(immutable(char)[], std.file.SpanMode, bool).initialize(ref immutable(char)[], ref std.file.SpanMode, ref bool)+0x83) [0x472e6f]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(ref std.typecons.__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted std.typecons.__T10RefCountedTS3std4file15DirIteratorImplVE3std8typecons24RefCountedAutoInitialize0Z.RefCounted.__ctor!(immutable(char)[], std.file.SpanMode, bool).__ctor(ref immutable(char)[], ref std.file.SpanMode, ref bool)+0x11) [0x472de1]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(ref std.file.DirIterator std.file.DirIterator.__ctor(immutable(char)[], std.file.SpanMode, bool)+0x40) [0x46fd24]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(std.file.DirIterator std.file.dirEntries(immutable(char)[], std.file.SpanMode, bool)+0x39) [0x470175]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(void derelict.buildPackage(immutable(char)[])+0x12a) [0x457f0a]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(void derelict.buildAll()+0x8e) [0x457c06]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(Dmain+0x2da) [0x457b3a]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(extern (C) int rt.dmain2.d_run_main(int, char
, extern (C) int function(char[][])).void runMain()+0x18) [0x46b978]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(extern (C) int rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])*).void tryExec(scope void delegate())+0x2a) [0x46b4aa]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(extern (C) int rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])).void runAll()+0x40) [0x46b9c8]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(extern (C) int rt.dmain2.d_run_main(int, char
, extern (C) int function(char[][])
).void tryExec(scope void delegate())+0x2a) [0x46b4aa]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(_d_run_main+0x1ae) [0x46b466]
/tmp/.rdmd-1000/rdmd-build.d-1153E3FFF76CA6CE090CC23FC25418A4/build(main+0x17) [0x46b2b3]

/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7fe4f9821a55]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.