Change void* parameter in beginScene to SExposedVideoData&, which will allow to configure more features. Due to the constructor for SExposedVideoData this is mostly transparent, just add this type around the currently used pointer.

Please also note that the OpenGL context handling is not yet working, so no real enhancement so far.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3013 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2009-12-06 22:17:52 +00:00
parent 3ca524aca4
commit fa2c5d0cd4
14 changed files with 60 additions and 44 deletions

View File

@ -1,5 +1,7 @@
Changes in 1.7
- Change the beginScene window parameter from void* to SExposedVideoData&. This will allow to manage contexts for OpenGL at some point.
- Add bzip2 and LZMA decompression modes for zip loader.
- Add OBJ_TEXTURE_PATH and B3D_TEXTURE_PATH to SceneParameters to allow setting texture-paths for obj and b3d.

View File

@ -18,6 +18,7 @@
#include "triangle3d.h"
#include "EDriverTypes.h"
#include "EDriverFeatures.h"
#include "SExposedVideoData.h"
namespace irr
{
@ -39,7 +40,6 @@ namespace video
struct S3DVertex2TCoords;
struct S3DVertexTangents;
struct SLight;
struct SExposedVideoData;
class IImageLoader;
class IImageWriter;
class IMaterialRenderer;
@ -259,7 +259,7 @@ namespace video
\return False if failed. */
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0),
void* windowId=0,
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0) =0;
//! Presents the rendered image to the screen.

View File

@ -400,10 +400,10 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
//! applications must call this method before performing any rendering. returns false if failed.
bool CD3D8Driver::beginScene(bool backBuffer, bool zBuffer, SColor color,
void* windowId, core::rect<s32>* sourceRect)
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
{
CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect);
WindowId = windowId;
CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect);
WindowId = (HWND)videoData.D3D8.HWnd;
SceneSourceRect = sourceRect;
if (!pID3DDevice)
@ -412,8 +412,7 @@ bool CD3D8Driver::beginScene(bool backBuffer, bool zBuffer, SColor color,
HRESULT hr;
if (DeviceLost)
{
#if defined( _IRR_XBOX_PLATFORM_)
#else
#ifndef _IRR_XBOX_PLATFORM_
if(FAILED(hr = pID3DDevice->TestCooperativeLevel()))
{
if (hr == D3DERR_DEVICELOST)
@ -480,7 +479,7 @@ bool CD3D8Driver::endScene()
sourceRectData.bottom = SceneSourceRect->LowerRightCorner.Y;
}
hr = pID3DDevice->Present(srcRct, NULL, (HWND)WindowId, NULL);
hr = pID3DDevice->Present(srcRct, NULL, WindowId, NULL);
if (SUCCEEDED(hr))
return true;

View File

@ -40,7 +40,7 @@ namespace video
//! applications must call this method before performing any rendering. returns false if failed.
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0),
void* windowId=0,
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0);
//! applications must call this method after performing any rendering. returns false if failed.
@ -302,7 +302,7 @@ namespace video
IDirect3DSurface8* PrevRenderTarget;
core::dimension2d<u32> CurrentRendertargetSize;
void* WindowId;
HWND WindowId;
core::rect<s32>* SceneSourceRect;
D3DCAPS8 Caps;

View File

@ -475,10 +475,10 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
//! applications must call this method before performing any rendering. returns false if failed.
bool CD3D9Driver::beginScene(bool backBuffer, bool zBuffer, SColor color,
void* windowId, core::rect<s32>* sourceRect)
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
{
CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect);
WindowId = windowId;
CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect);
WindowId = (HWND)videoData.D3D9.HWnd;
SceneSourceRect = sourceRect;
if (!pID3DDevice)
@ -552,7 +552,7 @@ bool CD3D9Driver::endScene()
sourceRectData.bottom = SceneSourceRect->LowerRightCorner.Y;
}
hr = pID3DDevice->Present(srcRct, NULL, (HWND)WindowId, NULL);
hr = pID3DDevice->Present(srcRct, NULL, WindowId, NULL);
if (SUCCEEDED(hr))
return true;

View File

@ -56,7 +56,7 @@ namespace video
//! applications must call this method before performing any rendering. returns false if failed.
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0),
void* windowId=0,
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0);
//! applications must call this method after performing any rendering. returns false if failed.
@ -393,7 +393,7 @@ namespace video
core::dimension2d<u32> CurrentRendertargetSize;
core::dimension2d<u32> CurrentDepthBufferSize;
void* WindowId;
HWND WindowId;
core::rect<s32>* SceneSourceRect;
D3DCAPS9 Caps;

View File

@ -249,7 +249,7 @@ void CNullDriver::deleteAllTextures()
//! applications must call this method before performing any rendering. returns false if failed.
bool CNullDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
void* windowId, core::rect<s32>* sourceRect)
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
{
core::clearFPUException();
PrimitivesDrawn = 0;

View File

@ -43,7 +43,8 @@ namespace video
virtual ~CNullDriver();
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0), void* windowId=0,
SColor color=SColor(255,0,0,0),
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0);
virtual bool endScene();

View File

@ -39,7 +39,7 @@ COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params,
CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
CurrentTarget(ERT_FRAME_BUFFER),
Doublebuffer(params.Doublebuffer), Stereo(params.Stereobuffer),
HDc(0), Window(static_cast<HWND>(params.WindowId)), HRc(0), DeviceType(EIDT_WIN32)
HDc(0), Window(static_cast<HWND>(params.WindowId)), DeviceType(EIDT_WIN32)
{
#ifdef _DEBUG
setDebugName("COpenGLDriver");
@ -175,8 +175,8 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
}
SetPixelFormat(HDc, PixelFormat, &pfd);
HRc=wglCreateContext(HDc);
if (!HRc)
HGLRC hrc=wglCreateContext(HDc);
if (!hrc)
{
os::Printer::log("Cannot create a temporary GL rendering context.", ELL_ERROR);
ReleaseDC(temporary_wnd, HDc);
@ -184,10 +184,10 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
return false;
}
if (!wglMakeCurrent(HDc, HRc))
if (!wglMakeCurrent(HDc, hrc))
{
os::Printer::log("Cannot activate a temporary GL rendering context.", ELL_ERROR);
wglDeleteContext(HRc);
wglDeleteContext(hrc);
ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd);
return false;
@ -277,7 +277,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
AntiAlias=0;
wglMakeCurrent(HDc, NULL);
wglDeleteContext(HRc);
wglDeleteContext(hrc);
ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd);
@ -349,23 +349,23 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
0
};
HRc=wglCreateContextAttribs_ARB(HDc, 0, iAttribs);
hrc=wglCreateContextAttribs_ARB(HDc, 0, iAttribs);
}
else
#endif
HRc=wglCreateContext(HDc);
hrc=wglCreateContext(HDc);
if (!HRc)
if (!hrc)
{
os::Printer::log("Cannot create a GL rendering context.", ELL_ERROR);
return false;
}
// activate rendering context
if (!wglMakeCurrent(HDc, HRc))
if (!wglMakeCurrent(HDc, hrc))
{
os::Printer::log("Cannot activate GL rendering context", ELL_ERROR);
wglDeleteContext(HRc);
wglDeleteContext(hrc);
return false;
}
@ -399,7 +399,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
// set exposed data
ExposedData.OpenGLWin32.HDc = HDc;
ExposedData.OpenGLWin32.HRc = HRc;
ExposedData.OpenGLWin32.HRc = hrc;
ExposedData.OpenGLWin32.HWnd = Window;
return true;
@ -516,12 +516,12 @@ COpenGLDriver::~COpenGLDriver()
if (DeviceType == EIDT_WIN32)
{
if (HRc)
if (ExposedData.OpenGLWin32.HRc)
{
if (!wglMakeCurrent(0, 0))
os::Printer::log("Release of dc and rc failed.", ELL_WARNING);
if (!wglDeleteContext(HRc))
if (!wglDeleteContext((HGLRC)ExposedData.OpenGLWin32.HRc))
os::Printer::log("Release of rendering context failed.", ELL_WARNING);
}
@ -746,9 +746,23 @@ void COpenGLDriver::clearBuffers(bool backBuffer, bool zBuffer, bool stencilBuff
//! init call for rendering start
bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
void* windowId, core::rect<s32>* sourceRect)
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
{
CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect);
CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect);
#if 0
// This should be fixed to allow using OpenGL with the videoData parameter
if (videoData.OpenGLWin32.HWnd)
{
HDc = (HDC)videoData.OpenGLWin32.HDc;
wglMakeCurrent(HDc, (HGLRC)videoData.OpenGLWin32.HRc);
}
else if (HDc != ExposedData.OpenGLWin32.HDc)
{
HDc = (HDC)ExposedData.OpenGLWin32.HDc;
wglMakeCurrent(HDc, (HGLRC)ExposedData.OpenGLWin32.HRc);
}
#endif
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
if (DeviceType == EIDT_SDL)

View File

@ -61,7 +61,7 @@ namespace video
//! clears the zbuffer
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0),
void* windowId=0,
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0);
//! presents the rendered scene on the screen, returns false if failed
@ -440,7 +440,6 @@ namespace video
#ifdef _IRR_WINDOWS_API_
HDC HDc; // Private GDI Device Context
HWND Window;
HGLRC HRc; // Permanent Rendering Context
#endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
GLXDrawable Drawable;

View File

@ -214,10 +214,10 @@ void CSoftwareDriver::setMaterial(const SMaterial& material)
//! clears the zbuffer
bool CSoftwareDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
void* windowId, core::rect<s32>* sourceRect)
const SExposedVideoData& videoData, core::rect<s32>* sourceRect)
{
CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect);
WindowId=windowId;
CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect);
WindowId=videoData.D3D9.HWnd;
SceneSourceRect = sourceRect;
if (backBuffer && BackBuffer)

View File

@ -42,7 +42,7 @@ namespace video
//! clears the zbuffer
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0),
void* windowId=0,
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0);
//! presents the rendered scene on the screen, returns false if failed

View File

@ -343,10 +343,11 @@ void CBurningVideoDriver::setTransform(E_TRANSFORMATION_STATE state, const core:
//! clears the zbuffer
bool CBurningVideoDriver::beginScene(bool backBuffer, bool zBuffer,
SColor color, void* windowId, core::rect<s32>* sourceRect)
SColor color, const SExposedVideoData& videoData,
core::rect<s32>* sourceRect)
{
CNullDriver::beginScene(backBuffer, zBuffer, color, windowId, sourceRect);
WindowId = windowId;
CNullDriver::beginScene(backBuffer, zBuffer, color, videoData, sourceRect);
WindowId = videoData.D3D9.HWnd;
SceneSourceRect = sourceRect;
if (backBuffer && BackBuffer)

View File

@ -44,7 +44,7 @@ namespace video
//! clears the zbuffer
virtual bool beginScene(bool backBuffer=true, bool zBuffer=true,
SColor color=SColor(255,0,0,0),
void* windowId=0,
const SExposedVideoData& videoData=SExposedVideoData(),
core::rect<s32>* sourceRect=0);
//! presents the rendered scene on the screen, returns false if failed