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);
......
...@@ -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,7 +768,8 @@ u32 CNullDriver::getDynamicLightCount() ...@@ -767,7 +768,8 @@ 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.
...@@ -775,7 +777,7 @@ const SLight& CNullDriver::getDynamicLight(u32 idx) ...@@ -775,7 +777,7 @@ 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);
} }
......
...@@ -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