Commit f42fdc4a authored by hybrid's avatar hybrid

Added Win32 fullscreen enhancement, now trying to get a better refresh rate....

Added Win32 fullscreen enhancement, now trying to get a better refresh rate. Some minor changes, mainly to comments and indentation.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@819 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ebb6f460
...@@ -961,7 +961,7 @@ namespace scene ...@@ -961,7 +961,7 @@ namespace scene
how big the radius should be, you could use the following code to determine how big the radius should be, you could use the following code to determine
it: it:
\code \code
core::aabbox<f32> box = yourSceneNode->getBoundingBox(); const core::aabbox<f32>& box = yourSceneNode->getBoundingBox();
core::vector3df radius = box.MaxEdge - box.getCenter(); core::vector3df radius = box.MaxEdge - box.getCenter();
\endcode \endcode
\param gravityPerSecond: Sets the gravity of the environment. A good example value would be \param gravityPerSecond: Sets the gravity of the environment. A good example value would be
......
This diff is collapsed.
...@@ -1737,7 +1737,7 @@ void CD3D9Driver::setAmbientLight(const SColorf& color) ...@@ -1737,7 +1737,7 @@ void CD3D9Driver::setAmbientLight(const SColorf& color)
//! \return Returns the name of the video driver. Example: In case of the DIRECT3D9 //! \return Returns the name of the video driver. Example: In case of the DIRECT3D9
//! driver, it would return "Direct3D9.1". //! driver, it would return "Direct3D9.0".
const wchar_t* CD3D9Driver::getName() const wchar_t* CD3D9Driver::getName()
{ {
return L"Direct3D 9.0"; return L"Direct3D 9.0";
......
...@@ -696,18 +696,25 @@ bool CIrrDeviceWin32::isWindowActive() ...@@ -696,18 +696,25 @@ bool CIrrDeviceWin32::isWindowActive()
//! switchs to fullscreen //! switches to fullscreen
bool CIrrDeviceWin32::switchToFullScreen(s32 width, s32 height, s32 bits) bool CIrrDeviceWin32::switchToFullScreen(s32 width, s32 height, s32 bits)
{ {
DEVMODE dm; DEVMODE dm;
memset(&dm, 0, sizeof(dm)); memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm); dm.dmSize = sizeof(dm);
// use default values from current setting
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
dm.dmPelsWidth = width; dm.dmPelsWidth = width;
dm.dmPelsHeight = height; dm.dmPelsHeight = height;
dm.dmBitsPerPel = bits; dm.dmBitsPerPel = bits;
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
LONG ret = ChangeDisplaySettings(&dm, CDS_FULLSCREEN); LONG ret = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
if (ret != DISP_CHANGE_SUCCESSFUL)
{ // try again without forcing display frequency
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
ret = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
}
switch(ret) switch(ret)
{ {
......
...@@ -38,9 +38,9 @@ CLightSceneNode::~CLightSceneNode() ...@@ -38,9 +38,9 @@ CLightSceneNode::~CLightSceneNode()
//! pre render event //! pre render event
void CLightSceneNode::OnRegisterSceneNode() void CLightSceneNode::OnRegisterSceneNode()
{ {
doLightRecalc (); doLightRecalc();
if (IsVisible ) if (IsVisible)
{ {
SceneManager->registerNodeForRendering(this, ESNRP_LIGHT); SceneManager->registerNodeForRendering(this, ESNRP_LIGHT);
ISceneNode::OnRegisterSceneNode(); ISceneNode::OnRegisterSceneNode();
...@@ -69,8 +69,8 @@ void CLightSceneNode::render() ...@@ -69,8 +69,8 @@ void CLightSceneNode::render()
break; break;
case video::ELT_DIRECTIONAL: case video::ELT_DIRECTIONAL:
driver->draw3DLine(core::vector3df ( 0.f, 0.f, 0.f ), driver->draw3DLine(core::vector3df( 0.f, 0.f, 0.f ),
core::vector3df ( 0.f, 0.f, 0.f ) + (LightData.Position * 10.f ), core::vector3df( 0.f, 0.f, 0.f ) + (LightData.Position * 10.f ),
LightData.DiffuseColor.toSColor() LightData.DiffuseColor.toSColor()
); );
break; break;
...@@ -81,12 +81,12 @@ void CLightSceneNode::render() ...@@ -81,12 +81,12 @@ void CLightSceneNode::render()
} }
//! returns the light data //! sets the light data
void CLightSceneNode::setLightData(const video::SLight& light) void CLightSceneNode::setLightData(const video::SLight& light)
{ {
LightData = light; LightData = light;
ISceneNode::setPosition(light.Position); ISceneNode::setPosition(light.Position);
ISceneNode::updateAbsolutePosition (); ISceneNode::updateAbsolutePosition();
} }
...@@ -111,24 +111,24 @@ void CLightSceneNode::doLightRecalc() ...@@ -111,24 +111,24 @@ void CLightSceneNode::doLightRecalc()
case video::ELT_POINT: case video::ELT_POINT:
{ {
f32 r = LightData.Radius * LightData.Radius * 0.5f; f32 r = LightData.Radius * LightData.Radius * 0.5f;
BBox.MaxEdge.set ( r, r, r ); BBox.MaxEdge.set( r, r, r );
BBox.MinEdge.set ( -r, -r, -r ); BBox.MinEdge.set( -r, -r, -r );
setAutomaticCulling ( scene::EAC_BOX ); setAutomaticCulling( scene::EAC_BOX );
LightData.Position = getAbsolutePosition(); LightData.Position = getAbsolutePosition();
} break; } break;
case video::ELT_DIRECTIONAL: case video::ELT_DIRECTIONAL:
BBox.reset ( 0, 0, 0 ); BBox.reset( 0, 0, 0 );
setAutomaticCulling ( scene::EAC_OFF ); setAutomaticCulling( scene::EAC_OFF );
// misuse Position as direction.. // misuse Position as direction..
LightData.Position = getAbsolutePosition(); LightData.Position = getAbsolutePosition();
LightData.Position.invert(); LightData.Position.invert();
if ( LightData.Position.getLengthSQ() == 0.0 ) if ( LightData.Position.getLengthSQ() == 0.0 )
{ {
LightData.Position.set ( 0.f, -1.f, 0.f ); LightData.Position.set( 0.f, -1.f, 0.f );
os::Printer::log ( "Invalid Directional Light Direction" ); os::Printer::log( "Invalid Directional Light Direction" );
} }
else else
{ {
...@@ -171,8 +171,10 @@ void CLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeR ...@@ -171,8 +171,10 @@ void CLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeR
//! Creates a clone of this scene node and its children. //! Creates a clone of this scene node and its children.
ISceneNode* CLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager) ISceneNode* CLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{ {
if (!newParent) newParent = Parent; if (!newParent)
if (!newManager) newManager = SceneManager; newParent = Parent;
if (!newManager)
newManager = SceneManager;
CLightSceneNode* nb = new CLightSceneNode(newParent, CLightSceneNode* nb = new CLightSceneNode(newParent,
newManager, ID, RelativeTranslation, LightData.DiffuseColor, LightData.Radius); newManager, ID, RelativeTranslation, LightData.DiffuseColor, LightData.Radius);
......
...@@ -63,7 +63,7 @@ IImageWriter* createImageWriterPPM(); ...@@ -63,7 +63,7 @@ IImageWriter* createImageWriterPPM();
//! constructor //! constructor
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& screenSize) CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& screenSize)
: FileSystem(io), ViewPort(0,0,0,0), ScreenSize(screenSize), : FileSystem(io), ViewPort(0,0,0,0), ScreenSize(screenSize),
PrimitivesDrawn(0), TextureCreationFlags(0) PrimitivesDrawn(0), TextureCreationFlags(0)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CNullDriver"); setDebugName("CNullDriver");
...@@ -406,7 +406,7 @@ ITexture* CNullDriver::addTexture(const c8* name, IImage* image) ...@@ -406,7 +406,7 @@ ITexture* CNullDriver::addTexture(const c8* name, IImage* image)
//! creates a Texture //! creates a Texture
ITexture* CNullDriver::addTexture(const core::dimension2d<s32>& size, ITexture* CNullDriver::addTexture(const core::dimension2d<s32>& size,
const c8* name, ECOLOR_FORMAT format) const c8* name, ECOLOR_FORMAT format)
{ {
if (!name) if (!name)
return 0; return 0;
...@@ -439,7 +439,7 @@ ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const char* ...@@ -439,7 +439,7 @@ ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const char*
//! sets a render target //! sets a render target
bool CNullDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer, bool CNullDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
bool clearZBuffer, SColor color) bool clearZBuffer, SColor color)
{ {
return false; return false;
} }
...@@ -587,7 +587,7 @@ void CNullDriver::draw2DImage(video::ITexture* texture, ...@@ -587,7 +587,7 @@ void CNullDriver::draw2DImage(video::ITexture* texture,
bool useAlphaChannelOfTexture) bool useAlphaChannelOfTexture)
{ {
core::position2d<s32> target(pos); core::position2d<s32> target(pos);
for (u32 i=0; i<indices.size(); ++i) for (u32 i=0; i<indices.size(); ++i)
{ {
draw2DImage(texture, target, sourceRects[indices[i]], draw2DImage(texture, target, sourceRects[indices[i]],
...@@ -610,9 +610,9 @@ void CNullDriver::draw2DImage(video::ITexture* texture, const core::rect<s32>& d ...@@ -610,9 +610,9 @@ void CNullDriver::draw2DImage(video::ITexture* texture, const core::rect<s32>& d
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
void CNullDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos, void CNullDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture) bool useAlphaChannelOfTexture)
{ {
} }
...@@ -678,7 +678,7 @@ core::dimension2d<s32> CNullDriver::getScreenSize() ...@@ -678,7 +678,7 @@ core::dimension2d<s32> CNullDriver::getScreenSize()
return ScreenSize; return ScreenSize;
} }
//! returns the current render target size, //! returns the current render target size,
//! or the screen size if render targets are not implemented //! or the screen size if render targets are not implemented
core::dimension2d<s32> CNullDriver::getCurrentRenderTargetSize() core::dimension2d<s32> CNullDriver::getCurrentRenderTargetSize()
{ {
...@@ -732,8 +732,9 @@ void CNullDriver::drawStencilShadowVolume(const core::vector3df* triangles, s32 ...@@ -732,8 +732,9 @@ void CNullDriver::drawStencilShadowVolume(const core::vector3df* triangles, s32
//! Fills the stencil shadow with color. After the shadow volume has been drawn //! Fills the stencil shadow with color. After the shadow volume has been drawn
//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this //! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this
//! to draw the color of the shadow. //! to draw the color of the shadow.
void CNullDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftUpEdge, void CNullDriver::drawStencilShadow(bool clearStencilBuffer,
video::SColor rightUpEdge, video::SColor leftDownEdge, video::SColor rightDownEdge) video::SColor leftUpEdge, video::SColor rightUpEdge,
video::SColor leftDownEdge, video::SColor rightDownEdge)
{ {
} }
...@@ -745,7 +746,6 @@ void CNullDriver::deleteAllDynamicLights() ...@@ -745,7 +746,6 @@ void CNullDriver::deleteAllDynamicLights()
} }
//! adds a dynamic light //! adds a dynamic light
void CNullDriver::addDynamicLight(const SLight& light) void CNullDriver::addDynamicLight(const SLight& light)
{ {
...@@ -760,6 +760,7 @@ u32 CNullDriver::getMaximalDynamicLightAmount() ...@@ -760,6 +760,7 @@ u32 CNullDriver::getMaximalDynamicLightAmount()
return 0; return 0;
} }
//! Returns current amount of dynamic lights set //! Returns current amount of dynamic lights set
//! \return Current amount of dynamic lights set //! \return Current amount of dynamic lights set
u32 CNullDriver::getDynamicLightCount() u32 CNullDriver::getDynamicLightCount()
...@@ -767,16 +768,17 @@ u32 CNullDriver::getDynamicLightCount() ...@@ -767,16 +768,17 @@ u32 CNullDriver::getDynamicLightCount()
return Lights.size(); return Lights.size();
} }
//! Returns light data which was previously set with IVideDriver::addDynamicLight().
//! Returns light data which was previously set by IVideoDriver::addDynamicLight().
//! \param idx: Zero based index of the light. Must be greater than 0 and smaller //! \param idx: Zero based index of the light. Must be greater than 0 and smaller
//! than IVideoDriver()::getDynamicLightCount. //! than IVideoDriver()::getDynamicLightCount.
//! \return Light data. //! \return Light data.
const SLight& CNullDriver::getDynamicLight(u32 idx) const SLight& CNullDriver::getDynamicLight(u32 idx)
{ {
if ( idx < Lights.size() ) if ( idx < Lights.size() )
return Lights[idx]; return Lights[idx];
else
return *((SLight*)0); return *((SLight*)0);
} }
...@@ -853,7 +855,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture, video::SColor co ...@@ -853,7 +855,7 @@ void CNullDriver::makeColorKeyTexture(video::ITexture* texture, video::SColor co
//! Creates an 1bit alpha channel of the texture based of an color key position. //! Creates an 1bit alpha channel of the texture based of an color key position.
void CNullDriver::makeColorKeyTexture(video::ITexture* texture, void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
core::position2d<s32> colorKeyPixelPos) core::position2d<s32> colorKeyPixelPos)
{ {
if (!texture) if (!texture)
return; return;
......
...@@ -1632,7 +1632,6 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh ...@@ -1632,7 +1632,6 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
} }
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment