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
how big the radius should be, you could use the following code to determine
it:
\code
core::aabbox<f32> box = yourSceneNode->getBoundingBox();
const core::aabbox<f32>& box = yourSceneNode->getBoundingBox();
core::vector3df radius = box.MaxEdge - box.getCenter();
\endcode
\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)
//! \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()
{
return L"Direct3D 9.0";
......
......@@ -696,18 +696,25 @@ bool CIrrDeviceWin32::isWindowActive()
//! switchs to fullscreen
//! switches to fullscreen
bool CIrrDeviceWin32::switchToFullScreen(s32 width, s32 height, s32 bits)
{
DEVMODE dm;
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
// use default values from current setting
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
dm.dmPelsWidth = width;
dm.dmPelsHeight = height;
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);
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)
{
......
......@@ -38,9 +38,9 @@ CLightSceneNode::~CLightSceneNode()
//! pre render event
void CLightSceneNode::OnRegisterSceneNode()
{
doLightRecalc ();
doLightRecalc();
if (IsVisible )
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, ESNRP_LIGHT);
ISceneNode::OnRegisterSceneNode();
......@@ -69,8 +69,8 @@ void CLightSceneNode::render()
break;
case video::ELT_DIRECTIONAL:
driver->draw3DLine(core::vector3df ( 0.f, 0.f, 0.f ),
core::vector3df ( 0.f, 0.f, 0.f ) + (LightData.Position * 10.f ),
driver->draw3DLine(core::vector3df( 0.f, 0.f, 0.f ),
core::vector3df( 0.f, 0.f, 0.f ) + (LightData.Position * 10.f ),
LightData.DiffuseColor.toSColor()
);
break;
......@@ -81,12 +81,12 @@ void CLightSceneNode::render()
}
//! returns the light data
//! sets the light data
void CLightSceneNode::setLightData(const video::SLight& light)
{
LightData = light;
ISceneNode::setPosition(light.Position);
ISceneNode::updateAbsolutePosition ();
ISceneNode::updateAbsolutePosition();
}
......@@ -111,24 +111,24 @@ void CLightSceneNode::doLightRecalc()
case video::ELT_POINT:
{
f32 r = LightData.Radius * LightData.Radius * 0.5f;
BBox.MaxEdge.set ( r, r, r );
BBox.MinEdge.set ( -r, -r, -r );
setAutomaticCulling ( scene::EAC_BOX );
BBox.MaxEdge.set( r, r, r );
BBox.MinEdge.set( -r, -r, -r );
setAutomaticCulling( scene::EAC_BOX );
LightData.Position = getAbsolutePosition();
} break;
case video::ELT_DIRECTIONAL:
BBox.reset ( 0, 0, 0 );
setAutomaticCulling ( scene::EAC_OFF );
BBox.reset( 0, 0, 0 );
setAutomaticCulling( scene::EAC_OFF );
// misuse Position as direction..
LightData.Position = getAbsolutePosition();
LightData.Position.invert();
if ( LightData.Position.getLengthSQ() == 0.0 )
{
LightData.Position.set ( 0.f, -1.f, 0.f );
os::Printer::log ( "Invalid Directional Light Direction" );
LightData.Position.set( 0.f, -1.f, 0.f );
os::Printer::log( "Invalid Directional Light Direction" );
}
else
{
......@@ -171,8 +171,10 @@ void CLightSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttributeR
//! Creates a clone of this scene node and its children.
ISceneNode* CLightSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
{
if (!newParent) newParent = Parent;
if (!newManager) newManager = SceneManager;
if (!newParent)
newParent = Parent;
if (!newManager)
newManager = SceneManager;
CLightSceneNode* nb = new CLightSceneNode(newParent,
newManager, ID, RelativeTranslation, LightData.DiffuseColor, LightData.Radius);
......
......@@ -63,7 +63,7 @@ IImageWriter* createImageWriterPPM();
//! constructor
CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<s32>& screenSize)
: FileSystem(io), ViewPort(0,0,0,0), ScreenSize(screenSize),
PrimitivesDrawn(0), TextureCreationFlags(0)
PrimitivesDrawn(0), TextureCreationFlags(0)
{
#ifdef _DEBUG
setDebugName("CNullDriver");
......@@ -406,7 +406,7 @@ ITexture* CNullDriver::addTexture(const c8* name, IImage* image)
//! creates a Texture
ITexture* CNullDriver::addTexture(const core::dimension2d<s32>& size,
const c8* name, ECOLOR_FORMAT format)
const c8* name, ECOLOR_FORMAT format)
{
if (!name)
return 0;
......@@ -439,7 +439,7 @@ ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const char*
//! sets a render target
bool CNullDriver::setRenderTarget(video::ITexture* texture, bool clearBackBuffer,
bool clearZBuffer, SColor color)
bool clearZBuffer, SColor color)
{
return false;
}
......@@ -587,7 +587,7 @@ void CNullDriver::draw2DImage(video::ITexture* texture,
bool useAlphaChannelOfTexture)
{
core::position2d<s32> target(pos);
for (u32 i=0; i<indices.size(); ++i)
{
draw2DImage(texture, target, sourceRects[indices[i]],
......@@ -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.
void CNullDriver::draw2DImage(video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture)
const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture)
{
}
......@@ -678,7 +678,7 @@ core::dimension2d<s32> CNullDriver::getScreenSize()
return ScreenSize;
}
//! returns the current render target size,
//! returns the current render target size,
//! or the screen size if render targets are not implemented
core::dimension2d<s32> CNullDriver::getCurrentRenderTargetSize()
{
......@@ -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
//! into the stencil buffer using IVideoDriver::drawStencilShadowVolume(), use this
//! to draw the color of the shadow.
void CNullDriver::drawStencilShadow(bool clearStencilBuffer, video::SColor leftUpEdge,
video::SColor rightUpEdge, video::SColor leftDownEdge, video::SColor rightDownEdge)
void CNullDriver::drawStencilShadow(bool clearStencilBuffer,
video::SColor leftUpEdge, video::SColor rightUpEdge,
video::SColor leftDownEdge, video::SColor rightDownEdge)
{
}
......@@ -745,7 +746,6 @@ void CNullDriver::deleteAllDynamicLights()
}
//! adds a dynamic light
void CNullDriver::addDynamicLight(const SLight& light)
{
......@@ -760,6 +760,7 @@ u32 CNullDriver::getMaximalDynamicLightAmount()
return 0;
}
//! Returns current amount of dynamic lights set
//! \return Current amount of dynamic lights set
u32 CNullDriver::getDynamicLightCount()
......@@ -767,16 +768,17 @@ u32 CNullDriver::getDynamicLightCount()
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
//! than IVideoDriver()::getDynamicLightCount.
//! \return Light data.
const SLight& CNullDriver::getDynamicLight(u32 idx)
{
if ( idx < Lights.size() )
return Lights[idx];
return *((SLight*)0);
return Lights[idx];
else
return *((SLight*)0);
}
......@@ -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.
void CNullDriver::makeColorKeyTexture(video::ITexture* texture,
core::position2d<s32> colorKeyPixelPos)
core::position2d<s32> colorKeyPixelPos)
{
if (!texture)
return;
......
......@@ -1632,7 +1632,6 @@ void COpenGLDriver::setRenderStates2DMode(bool alpha, bool texture, bool alphaCh
glDisable(GL_BLEND);
}
}
}
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