X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2FIVideoDriver.cpp;h=61333989136cdecf3f75933c93084e7d41acd2fc;hb=refs%2Fheads%2Fmaster;hp=0033729a3d5715f7047991e4c4b10187eef4f866;hpb=69d811182f2f282f9c8f558f26d92e34417d6526;p=c-irrlicht.git diff --git a/src/IVideoDriver.cpp b/src/IVideoDriver.cpp index 0033729..6133398 100644 --- a/src/IVideoDriver.cpp +++ b/src/IVideoDriver.cpp @@ -20,42 +20,47 @@ */ #include +#include #include "IVideoDriver.h" extern "C" { int irr_video_beginScene(irr_video_IVideoDriver* driver, - int backBuffer, - int zBuffer, + bool backBuffer, + bool zBuffer, const irr_video_SColor* color, irr_video_SExposedVideoData* videoData, const irr_core_rect_s32* sourceRect) { - // Color - irr::video::SColor col = irr::video::SColor(color->a, color->r, - color->g, color->b); - // Video data // TODO irr::video::SExposedVideoData vdata = irr::video::SExposedVideoData(); - // Source rect - irr::core::rect rect; - if (sourceRect != NULL) - { - rect = irr::core::rect(sourceRect->x, - sourceRect->y, - sourceRect->x2, - sourceRect->y2); - } - // Begin scene return ((irr::video::IVideoDriver*)driver) ->beginScene(backBuffer, zBuffer, - col, + *(irr::video::SColor*)color, vdata, - sourceRect != NULL ? &rect : 0); + (irr::core::rect*)sourceRect); + } + + void + irr_video_drawVertexPrimitiveList(irr_video_IVideoDriver* driver, + const void* vertices, + uint32_t vertexCount, + const void* indexList, + uint32_t primCount, + irr_video_E_VERTEX_TYPE vType, + irr_scene_E_PRIMITIVE_TYPE pType, + irr_video_E_INDEX_TYPE iType) + { + ((irr::video::IVideoDriver*)driver) + ->drawVertexPrimitiveList(vertices, vertexCount, + indexList, primCount, + (irr::video::E_VERTEX_TYPE)vType, + (irr::scene::E_PRIMITIVE_TYPE)pType, + (irr::video::E_INDEX_TYPE)iType); } int @@ -65,11 +70,21 @@ extern "C" { } int - irr_getFPS(irr_video_IVideoDriver* driver) + irr_video_getFPS(irr_video_IVideoDriver* driver) { return ((irr::video::IVideoDriver*)driver)->getFPS(); } + const char* + irr_video_getName(irr_video_IVideoDriver* driver) + { + const wchar_t *wname = ((irr::video::IVideoDriver*)driver)->getName(); + size_t nbytes = wcslen(wname) + 1; + char *name = (char*)malloc(nbytes); + wcstombs(name, wname, nbytes); + return name; + } + irr_video_ITexture* irr_video_getTexture(irr_video_IVideoDriver* driver, const char* filename) @@ -78,4 +93,20 @@ extern "C" { ((irr::video::IVideoDriver*)driver)->getTexture(filename); } + void + irr_video_setMaterial(irr_video_IVideoDriver* driver, + irr_video_SMaterial* material) + { + ((irr::video::IVideoDriver*)driver)->setMaterial(*(irr::video::SMaterial*)material); + } + + void + irr_video_setTransform(irr_video_IVideoDriver* driver, + irr_video_E_TRANSFORMATION_STATE state, + irr_core_matrix4* mat) + { + ((irr::video::IVideoDriver*)driver) + ->setTransform((irr::video::E_TRANSFORMATION_STATE)state, + *(irr::core::matrix4*)mat); + } }