Merged revisions 2695:2780 from trunk.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@2781 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
e90ac51539
commit
2061a3862f
33
changes.txt
33
changes.txt
|
@ -1,4 +1,16 @@
|
|||
Changes in 1.6 (??.??.2009)
|
||||
Changes in 1.6.1
|
||||
|
||||
- Fix another (OldValue == NewValue) before drop()/grap(), this time in CTextureAttribute::setTexture.
|
||||
|
||||
- Bugfix: CGUIToolBar::addButton does no longer mess up when no image is set and does now actually work with the text.
|
||||
|
||||
- Fix ninja animation range which got messed up a little when b3d animations got fixed (thx gbox for finding)
|
||||
|
||||
Changes in 1.6 (23.09.2009)
|
||||
|
||||
- Added IFileSystem::createEmptyFileList, exposed IFileList::sort, addItem and added getID
|
||||
|
||||
- Fix MAKE_IRR_ID so it can be used from outside the irr namespace (Micha's patch)
|
||||
|
||||
- Renamed some methods in ISkinnedMesh to match the official Irrlicht naming scheme according to createXXX()
|
||||
|
||||
|
@ -645,10 +657,27 @@ Changes in 1.6 (??.??.2009)
|
|||
- Add a hitPosition out parameter to ISceneCollisionManager::getCollisionResultPosition() - this is a (small) API breaking change.
|
||||
|
||||
-------------------------------------
|
||||
Changes in version 1.5.1 (??.?? 2009)
|
||||
Changes in version 1.5.2 (??.??.2009)
|
||||
|
||||
- Fix terrain smoothing, bug found by loverlinfish
|
||||
|
||||
- SOLARIS recognition removed. Please specify the platform define manually. This allows for compilation under sparc/Linux and sparc/Solaris
|
||||
|
||||
- Some uninitialized variables fixed
|
||||
|
||||
- FreeBSD joystick support added (for Debian package)
|
||||
|
||||
- Fix cursor problems found by buffer and by rvl2 as described in http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=34823&highlight=
|
||||
|
||||
- OSX/XCode updates
|
||||
|
||||
- MS3D loader bug fixed
|
||||
|
||||
- Float parse bug fixed
|
||||
|
||||
-------------------------------------
|
||||
Changes in version 1.5.1 (05.08.2009)
|
||||
|
||||
- Make sure a missing font does not corrupt the skin.
|
||||
|
||||
- Fix getAngle in vector2d as suggested by xray. This has only a minor impact on s32 vectors.
|
||||
|
|
|
@ -176,7 +176,7 @@ int main()
|
|||
*/
|
||||
anms->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
|
||||
anms->setFrameLoop(0, 14);
|
||||
anms->setFrameLoop(0, 13);
|
||||
anms->setAnimationSpeed(15);
|
||||
// anms->setMD2Animation(scene::EMAT_RUN);
|
||||
|
||||
|
|
|
@ -556,11 +556,9 @@ public:
|
|||
Most of the hard work is done. We only need to create the Irrlicht Engine
|
||||
device and all the buttons, menus and toolbars. We start up the engine as
|
||||
usual, using createDevice(). To make our application catch events, we set our
|
||||
eventreceiver as parameter. The #ifdef WIN32 preprocessor commands are not
|
||||
necessary, but I included them to make the tutorial use DirectX on Windows and
|
||||
OpenGL on all other platforms like Linux. As you can see, there is also a
|
||||
unusual call to IrrlichtDevice::setResizeAble(). This makes the render window
|
||||
resizeable, which is quite useful for a mesh viewer.
|
||||
eventreceiver as parameter. As you can see, there is also a call to
|
||||
IrrlichtDevice::setResizeable(). This makes the render window resizeable, which
|
||||
is quite useful for a mesh viewer.
|
||||
*/
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
|
|
@ -1,227 +1,160 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="7.10"
|
||||
Name="20.ManagedLights"
|
||||
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
||||
>
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/ManagedLights.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Debug/ManagedLights.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\20.ManagedLights.exe"
|
||||
LinkIncremental="0"
|
||||
SuppressStartupBanner="true"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
GenerateDebugInformation="true"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/ManagedLights.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/ManagedLights.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/ManagedLights.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/ManagedLights.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\bin\Win32-VisualStudio\20.ManagedLights.exe"
|
||||
LinkIncremental="0"
|
||||
SuppressStartupBanner="true"
|
||||
SuppressStartupBanner="TRUE"
|
||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||
ProgramDatabaseFile=".\Release/ManagedLights.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/ManagedLights.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="3079"/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="main.cpp"
|
||||
>
|
||||
RelativePath="main.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
/>
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
/** Example 020 Managed Lights
|
||||
|
||||
// Written by Colin MacDonald
|
||||
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
Written by Colin MacDonald. This tutorial explains the use of the Light Manager
|
||||
of Irrlicht. It enables the use of more dynamic light sources than the actual
|
||||
hardware supports. Further applications of the Light Manager, such as per scene
|
||||
node callbacks, are left out for simplicity of the example.
|
||||
*/
|
||||
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
|
@ -273,7 +275,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/*!
|
||||
/*
|
||||
*/
|
||||
int main(int argumentCount, char * argumentValues[])
|
||||
{
|
||||
|
@ -328,7 +330,9 @@ int main(int argumentCount, char * argumentValues[])
|
|||
guienv->addStaticText(L"2 - Closest 3 lights", core::rect<s32>(10,30,200,50));
|
||||
guienv->addStaticText(L"3 - Lights in zone", core::rect<s32>(10,50,200,70));
|
||||
|
||||
// Add several "zones". You could use this technique to light individual rooms, for example.
|
||||
/*
|
||||
Add several "zones". You could use this technique to light individual rooms, for example.
|
||||
*/
|
||||
for(f32 zoneX = -100.f; zoneX <= 100.f; zoneX += 50.f)
|
||||
for(f32 zoneY = -60.f; zoneY <= 60.f; zoneY += 60.f)
|
||||
{
|
||||
|
@ -403,3 +407,7 @@ int main(int argumentCount, char * argumentValues[])
|
|||
device->drop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
**/
|
||||
|
||||
|
|
|
@ -126,6 +126,15 @@
|
|||
<File
|
||||
RelativePath=".\main.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\q3factory.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\q3factory.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sound.cpp">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
|
|
|
@ -23,12 +23,17 @@ Copyright 2006-2009 Burningwater, Thomas Alten
|
|||
#include "sound.h"
|
||||
#include <iostream>
|
||||
|
||||
/*!
|
||||
/*
|
||||
Game Data is used to hold Data which is needed to drive the game
|
||||
*/
|
||||
struct GameData
|
||||
{
|
||||
GameData ( const path &startupDir);
|
||||
GameData ( const path &startupDir) :
|
||||
retVal(0), createExDevice(0), Device(0), StartupDir(startupDir)
|
||||
{
|
||||
setDefault ();
|
||||
}
|
||||
|
||||
void setDefault ();
|
||||
s32 save ( const path &filename );
|
||||
s32 load ( const path &filename );
|
||||
|
@ -58,18 +63,7 @@ struct GameData
|
|||
IrrlichtDevice *Device;
|
||||
};
|
||||
|
||||
/*!
|
||||
*/
|
||||
GameData::GameData ( const path &startupDir)
|
||||
{
|
||||
retVal = 0;
|
||||
createExDevice = 0;
|
||||
Device = 0;
|
||||
StartupDir = startupDir;
|
||||
setDefault ();
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
set default settings
|
||||
*/
|
||||
void GameData::setDefault ()
|
||||
|
@ -92,7 +86,7 @@ void GameData::setDefault ()
|
|||
deviceParam.WindowSize.Height = 600;
|
||||
deviceParam.Fullscreen = false;
|
||||
deviceParam.Bits = 32;
|
||||
deviceParam.ZBufferBits = 32;
|
||||
deviceParam.ZBufferBits = 16;
|
||||
deviceParam.Vsync = false;
|
||||
deviceParam.AntiAlias = false;
|
||||
|
||||
|
@ -112,19 +106,17 @@ void GameData::setDefault ()
|
|||
CurrentMapName = "";
|
||||
CurrentArchiveList.clear ();
|
||||
|
||||
//! Explorer Media directory
|
||||
// Explorer Media directory
|
||||
CurrentArchiveList.push_back ( StartupDir + "../../media/" );
|
||||
|
||||
//! Add the original quake3 files before you load your custom map
|
||||
//! Most mods are using the original shaders, models&items&weapons
|
||||
CurrentArchiveList.push_back ( "/q/baseq3/" );
|
||||
|
||||
|
||||
CurrentArchiveList.push_back ( StartupDir + "../../media/map-20kdm2.pk3" );
|
||||
// Add the original quake3 files before you load your custom map
|
||||
// Most mods are using the original shaders, models&items&weapons
|
||||
CurrentArchiveList.push_back("/q/baseq3/");
|
||||
|
||||
CurrentArchiveList.push_back(StartupDir + "../../media/map-20kdm2.pk3");
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
Load the current game State from a typical quake3 cfg file
|
||||
*/
|
||||
s32 GameData::load ( const path &filename )
|
||||
|
@ -132,7 +124,7 @@ s32 GameData::load ( const path &filename )
|
|||
if (!Device)
|
||||
return 0;
|
||||
|
||||
//! the quake3 mesh loader can also handle *.shader and *.cfg file
|
||||
// the quake3 mesh loader can also handle *.shader and *.cfg file
|
||||
IQ3LevelMesh* mesh = (IQ3LevelMesh*) Device->getSceneManager()->getMesh ( filename );
|
||||
if (!mesh)
|
||||
return 0;
|
||||
|
@ -171,7 +163,7 @@ s32 GameData::load ( const path &filename )
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
Store the current game State in a quake3 configuration file
|
||||
*/
|
||||
s32 GameData::save ( const path &filename )
|
||||
|
@ -217,7 +209,7 @@ s32 GameData::save ( const path &filename )
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
Representing a player
|
||||
*/
|
||||
struct Q3Player : public IAnimationEndCallBack
|
||||
|
@ -254,7 +246,7 @@ struct Q3Player : public IAnimationEndCallBack
|
|||
};
|
||||
|
||||
|
||||
/*!
|
||||
/* End player
|
||||
*/
|
||||
void Q3Player::shutdown ()
|
||||
{
|
||||
|
@ -274,13 +266,15 @@ void Q3Player::shutdown ()
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
/* create a new player
|
||||
*/
|
||||
void Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *mapNode, IMetaTriangleSelector *meta )
|
||||
{
|
||||
setTimeFire ( Anim + 0, 200, FIRED );
|
||||
setTimeFire ( Anim + 1, 5000 );
|
||||
|
||||
if (!device)
|
||||
return;
|
||||
// load FPS weapon to Camera
|
||||
Device = device;
|
||||
Mesh = mesh;
|
||||
|
@ -371,12 +365,14 @@ void Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
/*
|
||||
so we need a good starting Position in the level.
|
||||
we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
|
||||
*/
|
||||
void Q3Player::respawn ()
|
||||
{
|
||||
if (!Device)
|
||||
return;
|
||||
ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera();
|
||||
|
||||
Device->getLogger()->log( "respawn" );
|
||||
|
@ -395,6 +391,8 @@ void Q3Player::respawn ()
|
|||
*/
|
||||
void Q3Player::setpos ( const vector3df &pos, const vector3df &rotation )
|
||||
{
|
||||
if (!Device)
|
||||
return;
|
||||
Device->getLogger()->log( "setpos" );
|
||||
|
||||
ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera();
|
||||
|
@ -407,7 +405,7 @@ void Q3Player::setpos ( const vector3df &pos, const vector3df &rotation )
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
/* set the Animation of the player and weapon
|
||||
*/
|
||||
void Q3Player::setAnim ( const c8 *name )
|
||||
{
|
||||
|
@ -431,8 +429,7 @@ void Q3Player::setAnim ( const c8 *name )
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
// Callback
|
||||
void Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node)
|
||||
{
|
||||
setAnim ( 0 );
|
||||
|
@ -440,7 +437,8 @@ void Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node)
|
|||
|
||||
|
||||
|
||||
//! GUIElements
|
||||
/* GUI Elements
|
||||
*/
|
||||
struct GUI
|
||||
{
|
||||
GUI ()
|
||||
|
@ -483,11 +481,10 @@ struct GUI
|
|||
IGUIStaticText* StatusLine;
|
||||
IGUIImage* Logo;
|
||||
IGUIWindow* Window;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
/*
|
||||
CQuake3EventHandler controls the game
|
||||
*/
|
||||
class CQuake3EventHandler : public IEventReceiver
|
||||
|
@ -547,14 +544,14 @@ private:
|
|||
void dropMap ();
|
||||
};
|
||||
|
||||
/*!
|
||||
/* Constructor
|
||||
*/
|
||||
CQuake3EventHandler::CQuake3EventHandler( GameData *game )
|
||||
: Game(game), Mesh(0), MapParent(0), ShaderParent(0), ItemParent(0), UnresolvedParent(0),
|
||||
BulletParent(0), FogParent(0), SkyNode(0), Meta(0)
|
||||
{
|
||||
buf[0]=0;
|
||||
//! Also use 16 Bit Textures for 16 Bit RenderDevice
|
||||
// Also use 16 Bit Textures for 16 Bit RenderDevice
|
||||
if ( Game->deviceParam.Bits == 16 )
|
||||
{
|
||||
game->Device->getVideoDriver()->setTextureCreationFlag(ETCF_ALWAYS_16_BIT, true);
|
||||
|
@ -572,6 +569,7 @@ CQuake3EventHandler::CQuake3EventHandler( GameData *game )
|
|||
}
|
||||
|
||||
|
||||
// destructor
|
||||
CQuake3EventHandler::~CQuake3EventHandler ()
|
||||
{
|
||||
Player[0].shutdown ();
|
||||
|
@ -583,7 +581,7 @@ CQuake3EventHandler::~CQuake3EventHandler ()
|
|||
}
|
||||
|
||||
|
||||
//! create runtime textures smog, fog
|
||||
// create runtime textures smog, fog
|
||||
void CQuake3EventHandler::createTextures ()
|
||||
{
|
||||
IVideoDriver * driver = Game->Device->getVideoDriver();
|
||||
|
@ -636,7 +634,7 @@ void CQuake3EventHandler::createTextures ()
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
/*
|
||||
create the GUI
|
||||
*/
|
||||
void CQuake3EventHandler::CreateGUI()
|
||||
|
@ -829,8 +827,7 @@ void CQuake3EventHandler::CreateGUI()
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
/*
|
||||
Add an Archive to the FileSystems und updates the GUI
|
||||
*/
|
||||
void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
||||
|
@ -916,7 +913,7 @@ void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
|||
u32 g = 0;
|
||||
core::stringw s;
|
||||
|
||||
//! browse the attached file system
|
||||
// browse the attached file system
|
||||
fs->setFileListSystem ( FILESYSTEM_VIRTUAL );
|
||||
fs->changeWorkingDirectoryTo ( "/maps/" );
|
||||
IFileList *fileList = fs->createFileList ();
|
||||
|
@ -994,7 +991,7 @@ void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
|||
|
||||
}
|
||||
|
||||
/*!
|
||||
/*
|
||||
clears the Map in Memory
|
||||
*/
|
||||
void CQuake3EventHandler::dropMap ()
|
||||
|
@ -1031,7 +1028,7 @@ void CQuake3EventHandler::dropMap ()
|
|||
Mesh = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
/* Load new map
|
||||
*/
|
||||
void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
||||
{
|
||||
|
@ -1128,9 +1125,6 @@ void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
|||
}
|
||||
|
||||
/*
|
||||
**/
|
||||
|
||||
/*!
|
||||
Adds a SceneNode with an icon to the Scene Tree
|
||||
*/
|
||||
void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent)
|
||||
|
@ -1203,13 +1197,13 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
|
|||
}
|
||||
|
||||
|
||||
//! Adds life!
|
||||
// Adds life!
|
||||
void CQuake3EventHandler::CreatePlayers()
|
||||
{
|
||||
Player[0].create ( Game->Device, Mesh, MapParent, Meta );
|
||||
}
|
||||
|
||||
//! Adds a skydome to the scene
|
||||
// Adds a skydome to the scene
|
||||
void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
||||
{
|
||||
ISceneManager *smgr = Game->Device->getSceneManager ();
|
||||
|
@ -1229,10 +1223,13 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
|||
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
|
||||
SkyNode = smgr->addSkyBoxSceneNode( driver->getTexture ( buf ), 0, 0, 0, 0, 0 );
|
||||
|
||||
for ( i = 0; i < 6; ++i )
|
||||
if (SkyNode)
|
||||
{
|
||||
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
|
||||
SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) );
|
||||
for ( i = 0; i < 6; ++i )
|
||||
{
|
||||
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
|
||||
SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1264,7 +1261,8 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
|||
);
|
||||
}
|
||||
|
||||
SkyNode->setName ( "Skydome" );
|
||||
if (SkyNode)
|
||||
SkyNode->setName("Skydome");
|
||||
//SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL;
|
||||
|
||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
|
||||
|
@ -1272,8 +1270,7 @@ void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
*/
|
||||
// enable GUI elements
|
||||
void CQuake3EventHandler::SetGUIActive( s32 command)
|
||||
{
|
||||
bool inputState = false;
|
||||
|
@ -1315,7 +1312,7 @@ void CQuake3EventHandler::SetGUIActive( s32 command)
|
|||
|
||||
|
||||
|
||||
/*!
|
||||
/*
|
||||
Handle game input
|
||||
*/
|
||||
bool CQuake3EventHandler::OnEvent(const SEvent& eve)
|
||||
|
@ -1525,7 +1522,7 @@ bool CQuake3EventHandler::OnEvent(const SEvent& eve)
|
|||
else
|
||||
if (eve.KeyInput.Key == KEY_F11)
|
||||
{
|
||||
//! screenshot are taken without gamma!
|
||||
// screenshot are taken without gamma!
|
||||
IImage* image = Game->Device->getVideoDriver()->createScreenShot();
|
||||
if (image)
|
||||
{
|
||||
|
@ -1824,8 +1821,7 @@ void CQuake3EventHandler::useItem( Q3Player * player)
|
|||
// play sound
|
||||
}
|
||||
|
||||
/*!
|
||||
*/
|
||||
// rendered when bullets hit something
|
||||
void CQuake3EventHandler::createParticleImpacts( u32 now )
|
||||
{
|
||||
ISceneManager* sm = Game->Device->getSceneManager();
|
||||
|
@ -1969,7 +1965,7 @@ void CQuake3EventHandler::Animate()
|
|||
|
||||
IAttributes * attr = smgr->getParameters();
|
||||
swprintf ( msg, 128,
|
||||
L"Q3 %s [%s], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)",
|
||||
L"Q3 %s [%ls], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)",
|
||||
Game->CurrentMapName.c_str(),
|
||||
driver->getName(),
|
||||
driver->getFPS (),
|
||||
|
@ -2006,7 +2002,7 @@ void CQuake3EventHandler::Animate()
|
|||
}
|
||||
|
||||
|
||||
/*!
|
||||
/* The main game states
|
||||
*/
|
||||
void runGame ( GameData *game )
|
||||
{
|
||||
|
@ -2024,10 +2020,10 @@ void runGame ( GameData *game )
|
|||
// create an event receiver based on current game data
|
||||
CQuake3EventHandler *eventHandler = new CQuake3EventHandler( game );
|
||||
|
||||
//! load stored config
|
||||
// load stored config
|
||||
game->load ( "explorer.cfg" );
|
||||
|
||||
//! add our media directory and archive to the file system
|
||||
// add our media directory and archive to the file system
|
||||
for ( u32 i = 0; i < game->CurrentArchiveList.size(); ++i )
|
||||
{
|
||||
eventHandler->AddArchive ( game->CurrentArchiveList[i] );
|
||||
|
@ -2078,7 +2074,7 @@ void runGame ( GameData *game )
|
|||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
/* The main routine, doing all setup
|
||||
*/
|
||||
int IRRCALLCONV main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -2130,4 +2126,3 @@ int IRRCALLCONV main(int argc, char* argv[])
|
|||
/*
|
||||
**/
|
||||
|
||||
|
||||
|
|
|
@ -78,15 +78,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "19.MouseAndJoystick", "19.M
|
|||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "20.ManagedLights\ManagedLights_vc7.vcproj", "{16007FE2-142B-47F8-93E1-519BA3F39E71}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer", "21.Quake3Explorer\Quake3Explorer_vc7.vcproj", "{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "20.ManagedLights\ManagedLights.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
|
@ -167,14 +167,14 @@ Global
|
|||
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.ActiveCfg = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug.Build.0 = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.ActiveCfg = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release.Build.0 = Release|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.ActiveCfg = Debug|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.Build.0 = Debug|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.ActiveCfg = Release|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.Build.0 = Release|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.Build.0 = Debug|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|Win32
|
||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
|
|
@ -181,8 +181,11 @@ Global
|
|||
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release|Win32.Build.0 = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{16007FE2-142B-47F8-93E1-519BA3F39E71}.Release|Win32.Build.0 = Release|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
|
|
|
@ -81,10 +81,14 @@ namespace scene
|
|||
\return True if successful, false if not. */
|
||||
virtual bool setFrameLoop(s32 begin, s32 end) = 0;
|
||||
|
||||
//! Sets the speed with witch the animation is played.
|
||||
//! Sets the speed with which the animation is played.
|
||||
/** \param framesPerSecond: Frames per second played. */
|
||||
virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
|
||||
|
||||
//! Gets the speed with which the animation is played.
|
||||
/** \return Frames per second played. */
|
||||
virtual f32 getAnimationSpeed() const =0;
|
||||
|
||||
//! Creates shadow volume scene node as child of this node.
|
||||
/** The shadow can be rendered using the ZPass or the zfail
|
||||
method. ZPass is a little bit faster because the shadow volume
|
||||
|
|
|
@ -313,7 +313,7 @@ struct SEvent
|
|||
* each connected joystick once per run() of the device. Joystick events will
|
||||
* not be generated by default. If joystick support is available for the
|
||||
* active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
|
||||
* @ref IrrlichtDevice::activateJoysticks() has been called, an event of
|
||||
* @ref irr::IrrlichtDevice::activateJoysticks() has been called, an event of
|
||||
* this type will be generated once per joystick per @ref IrrlichtDevice::run()
|
||||
* regardless of whether the state of the joystick has actually changed. */
|
||||
struct SJoystickEvent
|
||||
|
@ -420,7 +420,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
//! Information on a joystick, returned from @ref IrrlichtDevice::activateJoysticks()
|
||||
//! Information on a joystick, returned from @ref irr::IrrlichtDevice::activateJoysticks()
|
||||
struct SJoystickInfo
|
||||
{
|
||||
//! The ID of the joystick
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
or 0 on failure. */
|
||||
virtual IReadFile* createAndOpenFile(const path& filename) =0;
|
||||
|
||||
//! Opens a file based on its position.
|
||||
//! Opens a file based on its position in the file list.
|
||||
/** Creates and returns
|
||||
\param index The zero based index of the file.
|
||||
\return Returns a pointer to the created file on success, or 0 on failure. */
|
||||
|
@ -80,7 +80,7 @@ class IArchiveLoader : public virtual IReferenceCounted
|
|||
public:
|
||||
//! Check if the file might be loaded by this class
|
||||
/** Check based on the file extension (e.g. ".zip")
|
||||
\param fileName Name of file to check.
|
||||
\param filename Name of file to check.
|
||||
\return True if file seems to be loadable. */
|
||||
virtual bool isALoadableFileFormat(const path& filename) const =0;
|
||||
|
||||
|
@ -97,12 +97,16 @@ public:
|
|||
virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
|
||||
|
||||
//! Creates an archive from the filename
|
||||
/** \param file File handle to check.
|
||||
/** \param filename File to use.
|
||||
\param ignoreCase Searching is performed without regarding the case
|
||||
\param ignorePaths Files are searched for without checking for the directories
|
||||
\return Pointer to newly created archive, or 0 upon error. */
|
||||
virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
|
||||
|
||||
//! Creates an archive from the file
|
||||
/** \param file File handle to check.
|
||||
/** \param file File handle to use.
|
||||
\param ignoreCase Searching is performed without regarding the case
|
||||
\param ignorePaths Files are searched for without checking for the directories
|
||||
\return Pointer to newly created archive, or 0 upon error. */
|
||||
virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const =0;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
//! Gets the full name of a file in the list including the path, based on an index.
|
||||
/** \param index is the zero based index of the file which name should
|
||||
be returned. The index must be less than the amount getFileCount() returns.
|
||||
\return File name of the file. Returns 0, if an error occured. */
|
||||
\return File name of the file. Returns 0 if an error occured. */
|
||||
virtual const io::path& getFullFileName(u32 index) const = 0;
|
||||
|
||||
//! Returns the size of a file in the file list, based on an index.
|
||||
|
@ -42,6 +42,15 @@ public:
|
|||
\return The size of the file in bytes. */
|
||||
virtual u32 getFileSize(u32 index) const = 0;
|
||||
|
||||
//! Returns the ID of a file in the file list, based on an index.
|
||||
/** This optional ID can be used to link the file list entry to information held
|
||||
elsewhere. For example this could be an index in an IFileArchive, linking the entry
|
||||
to its data offset, uncompressed size and CRC.
|
||||
\param index is the zero based index of the file which should be returned.
|
||||
The index must be less than the amount getFileCount() returns.
|
||||
\return The ID of the file. */
|
||||
virtual u32 getID(u32 index) const = 0;
|
||||
|
||||
//! Check if the file is a directory
|
||||
/** \param index The zero based index which will be checked. The index
|
||||
must be less than the amount getFileCount() returns.
|
||||
|
@ -58,6 +67,16 @@ public:
|
|||
|
||||
//! Returns the base path of the file list
|
||||
virtual const io::path& getPath() const = 0;
|
||||
|
||||
//! Add as a file or folder to the list
|
||||
/** \param fullPath The file name including path, from the root of the file list.
|
||||
\param isDirectory True if this is a directory rather than a file.
|
||||
\param size The size of the file in bytes.
|
||||
\param id The ID of the file in the archive which owns it */
|
||||
virtual u32 addItem(const io::path& fullPath, u32 size, bool isDirectory, u32 id=0) = 0;
|
||||
|
||||
//! Sorts the file list. You should call this after adding any items to the file list
|
||||
virtual void sort() = 0;
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
|
|
@ -125,9 +125,10 @@ public:
|
|||
virtual bool removeFileArchive(u32 index) =0;
|
||||
|
||||
//! Removes an archive from the file system.
|
||||
/** This will close the archive and free any file handles, but will not close resources which have already
|
||||
been loaded and are now cached, for example textures and meshes.
|
||||
\param index: The index of the archive to remove
|
||||
/** This will close the archive and free any file handles, but will not
|
||||
close resources which have already been loaded and are now cached, for
|
||||
example textures and meshes.
|
||||
\param filename The archive of the given name will be removed
|
||||
\return Returns true on success, false on failure */
|
||||
virtual bool removeFileArchive(const path& filename) =0;
|
||||
|
||||
|
@ -226,6 +227,12 @@ public:
|
|||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IFileList* createFileList() =0;
|
||||
|
||||
//! Creates an empty filelist
|
||||
/** \return a Pointer to the created IFileList is returned. After the list has been used
|
||||
it has to be deleted using its IFileList::drop() method.
|
||||
See IReferenceCounted::drop() for more information. */
|
||||
virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths) =0;
|
||||
|
||||
//! Set the active type of file system.
|
||||
virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
|
||||
|
||||
|
|
|
@ -11,6 +11,21 @@ namespace irr
|
|||
{
|
||||
namespace gui
|
||||
{
|
||||
//! Close behaviour.
|
||||
//! Default is ECMC_REMOVE
|
||||
enum ECONTEXT_MENU_CLOSE
|
||||
{
|
||||
//! do nothing - menu stays open
|
||||
ECMC_IGNORE = 0,
|
||||
|
||||
//! remove the gui element
|
||||
ECMC_REMOVE = 1,
|
||||
|
||||
//! call setVisible(false)
|
||||
ECMC_HIDE = 2,
|
||||
|
||||
// note to implementors - this is planned as bitset, so continue with 4 if you need to add further flags.
|
||||
};
|
||||
|
||||
//! GUI Context menu interface.
|
||||
class IGUIContextMenu : public IGUIElement
|
||||
|
@ -21,6 +36,12 @@ namespace gui
|
|||
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
|
||||
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, rectangle) {}
|
||||
|
||||
//! set behaviour when menus are closed
|
||||
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose) = 0;
|
||||
|
||||
//! get current behaviour when the menue will be closed
|
||||
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const = 0;
|
||||
|
||||
//! Get amount of menu items
|
||||
virtual u32 getItemCount() const = 0;
|
||||
|
||||
|
@ -36,7 +57,30 @@ namespace gui
|
|||
\param checked: Specifies if the menu item should be initially checked.
|
||||
\return Returns the index of the new item */
|
||||
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
|
||||
bool hasSubMenu=false, bool checked=false) = 0;
|
||||
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
|
||||
|
||||
//! Insert a menu item at specified position.
|
||||
/** \param idx: Position to insert the new element,
|
||||
should be smaller than itemcount otherwise the item is added to the end.
|
||||
\param text: Text of menu item. Set this to 0 to create
|
||||
an separator instead of a real item, which is the same like
|
||||
calling addSeparator();
|
||||
\param commandId: Command id of menu item, a simple id you may
|
||||
set to whatever you want.
|
||||
\param enabled: Specifies if the menu item should be enabled.
|
||||
\param hasSubMenu: Set this to true if there should be a submenu
|
||||
at this item. You can acess this submenu via getSubMenu().
|
||||
\param checked: Specifies if the menu item should be initially checked.
|
||||
\return Returns the index of the new item */
|
||||
virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId=-1, bool enabled=true,
|
||||
bool hasSubMenu=false, bool checked=false, bool autoChecking=false) = 0;
|
||||
|
||||
//! Find an item by it's CommandID
|
||||
/**
|
||||
\param commandId: We are looking for the first item which has this commandID
|
||||
\param idxStartSearch: Start searching from this index.
|
||||
\return Returns the index of the item when found or otherwise -1. */
|
||||
virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch=0) const = 0;
|
||||
|
||||
//! Adds a separator item to the menu
|
||||
virtual void addSeparator() = 0;
|
||||
|
@ -94,6 +138,15 @@ namespace gui
|
|||
\param idx: Zero based index of the menu item
|
||||
\return Returns a pointer to the submenu of an item. */
|
||||
virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
|
||||
|
||||
//! should the element change the checked status on clicking
|
||||
virtual void setItemAutoChecking(u32 idx, bool autoChecking) = 0;
|
||||
|
||||
//! does the element change the checked status on clicking
|
||||
virtual bool getItemAutoChecking(u32 idx) const = 0;
|
||||
|
||||
//! When an eventparent is set it receives events instead of the usual parent element
|
||||
virtual void setEventParent(IGUIElement *parent) = 0;
|
||||
};
|
||||
|
||||
} // end namespace gui
|
||||
|
|
|
@ -252,7 +252,7 @@ public:
|
|||
DesiredRect.UpperLeftCorner.X += diffx/2;
|
||||
break;
|
||||
case EGUIA_SCALE:
|
||||
DesiredRect.UpperLeftCorner.X = (s32)(ScaleRect.UpperLeftCorner.X * fw);
|
||||
DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public:
|
|||
DesiredRect.LowerRightCorner.X += diffx/2;
|
||||
break;
|
||||
case EGUIA_SCALE:
|
||||
DesiredRect.LowerRightCorner.X = (s32)(ScaleRect.LowerRightCorner.X * fw);
|
||||
DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ public:
|
|||
DesiredRect.UpperLeftCorner.Y += diffy/2;
|
||||
break;
|
||||
case EGUIA_SCALE:
|
||||
DesiredRect.UpperLeftCorner.Y = (s32)(ScaleRect.UpperLeftCorner.Y * fh);
|
||||
DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public:
|
|||
DesiredRect.LowerRightCorner.Y += diffy/2;
|
||||
break;
|
||||
case EGUIA_SCALE:
|
||||
DesiredRect.LowerRightCorner.Y = (s32)(ScaleRect.LowerRightCorner.Y * fh);
|
||||
DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,9 @@ public:
|
|||
|
||||
|
||||
//! Creates the image list from the given texture.
|
||||
/** Loads the font if it was not loaded before.
|
||||
\param filename Filename of the Font.
|
||||
/** \param texture Texture to split into images
|
||||
\param imageSize Dimension of each image
|
||||
\param useAlphaChannel Flag whether alpha channel of the texture should be honored.
|
||||
\return Pointer to the font. Returns 0 if the font could not be loaded.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
|
@ -240,11 +241,12 @@ public:
|
|||
to (EMBF_OK | EMBF_CANCEL).
|
||||
\param parent Parent gui element of the message box.
|
||||
\param id Id with which the gui element can be identified.
|
||||
\param image Optional texture which will be displayed beside the text as an image
|
||||
\return Pointer to the created message box. Returns 0 if an error
|
||||
occured. This pointer should not be dropped. See
|
||||
IReferenceCounted::drop() for more information. */
|
||||
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
|
||||
bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1) = 0;
|
||||
bool modal = true, s32 flags = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0) = 0;
|
||||
|
||||
//! Adds a scrollbar.
|
||||
/** \param horizontal Specifies if the scroll bar is drawn horizontal
|
||||
|
@ -313,6 +315,8 @@ public:
|
|||
\param parent Parent gui element of the list box.
|
||||
\param id Id to identify the gui element.
|
||||
\param drawBackground Flag whether the background should be drawn.
|
||||
\param scrollBarVertical Flag whether a vertical scrollbar should be used
|
||||
\param scrollBarHorizontal Flag whether a horizontal scrollbar should be used
|
||||
\return Pointer to the created list box. Returns 0 if an error occured.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||
more information. */
|
||||
|
@ -395,6 +399,7 @@ public:
|
|||
/** An edit box with up and down buttons
|
||||
\param text Text to be displayed. Can be altered after creation by setText().
|
||||
\param rectangle Rectangle specifying the borders of the spin box.
|
||||
\param border Set to true if the spin box should have a 3d border.
|
||||
\param parent Parent item of the element, e.g. a window.
|
||||
Set it to 0 to place the spin box directly in the environment.
|
||||
\param id The ID of the element.
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
//! Define which characters should not be drawn by the font.
|
||||
/** For example " " would not draw any space which is usually blank in
|
||||
most fonts.
|
||||
\param invisible: string of symbols, which are not send down to the videodriver
|
||||
\param s String of symbols which are not send down to the videodriver
|
||||
*/
|
||||
virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
|
||||
};
|
||||
|
|
|
@ -139,9 +139,9 @@ namespace gui
|
|||
EGDS_WINDOW_BUTTON_WIDTH,
|
||||
//! width of a checkbox check
|
||||
EGDS_CHECK_BOX_WIDTH,
|
||||
//! width of a messagebox
|
||||
//! deprecated
|
||||
EGDS_MESSAGE_BOX_WIDTH,
|
||||
//! height of a messagebox
|
||||
//! deprecated
|
||||
EGDS_MESSAGE_BOX_HEIGHT,
|
||||
//! width of a default button
|
||||
EGDS_BUTTON_WIDTH,
|
||||
|
@ -155,6 +155,17 @@ namespace gui
|
|||
EGDS_TITLEBARTEXT_DISTANCE_X,
|
||||
//! distance for text in the title bar, from the top of the window rect
|
||||
EGDS_TITLEBARTEXT_DISTANCE_Y,
|
||||
//! free space in a messagebox between borders and contents on all sides
|
||||
EGDS_MESSAGE_BOX_GAP_SPACE,
|
||||
//! minimal space to reserve for messagebox text-width
|
||||
EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH,
|
||||
//! maximal space to reserve for messagebox text-width
|
||||
EGDS_MESSAGE_BOX_MAX_TEST_WIDTH,
|
||||
//! minimal space to reserve for messagebox text-height
|
||||
EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT,
|
||||
//! maximal space to reserve for messagebox text-height
|
||||
EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT,
|
||||
|
||||
//! this value is not used, it only specifies the amount of default sizes
|
||||
//! available.
|
||||
EGDS_COUNT
|
||||
|
@ -174,7 +185,14 @@ namespace gui
|
|||
"ButtonHeight",
|
||||
"TextDistanceX",
|
||||
"TextDistanceY",
|
||||
0,
|
||||
"TitleBarTextX",
|
||||
"TitleBarTextY",
|
||||
"MessageBoxGapSpace",
|
||||
"MessageBoxMinTextWidth",
|
||||
"MessageBoxMaxTextWidth",
|
||||
"MessageBoxMinTextHeight",
|
||||
"MessageBoxMaxTextHeight",
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
|
@ -212,7 +230,7 @@ namespace gui
|
|||
"WindowButtonMaximize",
|
||||
"WindowButtonMinimize",
|
||||
"WindowButtonRestore",
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
//! Customizable symbols for GUI
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace gui
|
|||
virtual IGUITreeView* getOwner() const = 0;
|
||||
|
||||
//! Returns the parent node of this node.
|
||||
//! For the root node this will return 0.
|
||||
/** For the root node this will return 0. */
|
||||
virtual IGUITreeViewNode* getParent() const = 0;
|
||||
|
||||
//! returns the text of the node
|
||||
|
@ -79,118 +79,114 @@ namespace gui
|
|||
virtual bool hasChilds() const = 0;
|
||||
|
||||
//! Adds a new node behind the last child node.
|
||||
//! \param text text of the new node
|
||||
//! \param icon icon text of the new node
|
||||
//! \param imageIndex index of the image for the new node (-1 = none)
|
||||
//! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
//! \param data user data (void*) of the new node
|
||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
||||
//! \return
|
||||
//! returns the new node
|
||||
/** \param text text of the new node
|
||||
\param icon icon text of the new node
|
||||
\param imageIndex index of the image for the new node (-1 = none)
|
||||
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
\param data user data (void*) of the new node
|
||||
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||
\return The new node
|
||||
*/
|
||||
virtual IGUITreeViewNode* addChildBack(
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
|
||||
//! Adds a new node before the first child node.
|
||||
//! \param text text of the new node
|
||||
//! \param icon icon text of the new node
|
||||
//! \param imageIndex index of the image for the new node (-1 = none)
|
||||
//! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
//! \param data user data (void*) of the new node
|
||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
||||
//! \return
|
||||
//! returns the new node
|
||||
/** \param text text of the new node
|
||||
\param icon icon text of the new node
|
||||
\param imageIndex index of the image for the new node (-1 = none)
|
||||
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
\param data user data (void*) of the new node
|
||||
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||
\return The new node
|
||||
*/
|
||||
virtual IGUITreeViewNode* addChildFront(
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
|
||||
//! Adds a new node behind the other node.
|
||||
//! The other node has also te be a child node from this node.
|
||||
//! \param text text of the new node
|
||||
//! \param icon icon text of the new node
|
||||
//! \param imageIndex index of the image for the new node (-1 = none)
|
||||
//! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
//! \param data user data (void*) of the new node
|
||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
||||
//! \return
|
||||
//! returns the new node or 0 if other is no child node from this
|
||||
/** The other node has also te be a child node from this node.
|
||||
\param other Node to insert after
|
||||
\param text text of the new node
|
||||
\param icon icon text of the new node
|
||||
\param imageIndex index of the image for the new node (-1 = none)
|
||||
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
\param data user data (void*) of the new node
|
||||
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||
\return The new node or 0 if other is no child node from this
|
||||
*/
|
||||
virtual IGUITreeViewNode* insertChildAfter(
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
|
||||
//! Adds a new node before the other node.
|
||||
//! The other node has also te be a child node from this node.
|
||||
//! \param text text of the new node
|
||||
//! \param icon icon text of the new node
|
||||
//! \param imageIndex index of the image for the new node (-1 = none)
|
||||
//! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
//! \param data user data (void*) of the new node
|
||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
||||
//! \return
|
||||
//! returns the new node or 0 if other is no child node from this
|
||||
/** The other node has also te be a child node from this node.
|
||||
\param other Node to insert before
|
||||
\param text text of the new node
|
||||
\param icon icon text of the new node
|
||||
\param imageIndex index of the image for the new node (-1 = none)
|
||||
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||
\param data user data (void*) of the new node
|
||||
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||
\return The new node or 0 if other is no child node from this
|
||||
*/
|
||||
virtual IGUITreeViewNode* insertChildBefore(
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
IGUITreeViewNode* other,
|
||||
const wchar_t* text,
|
||||
const wchar_t* icon = 0,
|
||||
s32 imageIndex = -1,
|
||||
s32 selectedImageIndex = -1,
|
||||
void* data = 0,
|
||||
IReferenceCounted* data2 = 0 ) = 0;
|
||||
|
||||
//! Return the first child node from this node.
|
||||
//! \return
|
||||
//! Returns the first child node or 0 if this node has no childs.
|
||||
/** \return The first child node or 0 if this node has no childs. */
|
||||
virtual IGUITreeViewNode* getFirstChild() const = 0;
|
||||
|
||||
//! Return the last child node from this node.
|
||||
//! \return
|
||||
//! Returns the last child node or 0 if this node has no childs.
|
||||
/** \return The last child node or 0 if this node has no childs. */
|
||||
virtual IGUITreeViewNode* getLastChild() const = 0;
|
||||
|
||||
//! Returns the preverse sibling node from this node.
|
||||
//! \return
|
||||
//! Returns the preverse sibling node from this node or 0 if this is
|
||||
//! the first node from the parent node.
|
||||
//! Returns the previous sibling node from this node.
|
||||
/** \return The previous sibling node from this node or 0 if this is
|
||||
the first node from the parent node.
|
||||
*/
|
||||
virtual IGUITreeViewNode* getPrevSibling() const = 0;
|
||||
|
||||
//! Returns the next sibling node from this node.
|
||||
//! \return
|
||||
//! Returns the next sibling node from this node or 0 if this is
|
||||
//! the last node from the parent node.
|
||||
/** \return The next sibling node from this node or 0 if this is
|
||||
the last node from the parent node.
|
||||
*/
|
||||
virtual IGUITreeViewNode* getNextSibling() const = 0;
|
||||
|
||||
//! Returns the next visible (expanded, may be out of scrolling) node from this node.
|
||||
//! \return
|
||||
//! Returns the next visible node from this node or 0 if this is
|
||||
//! the last visible node.
|
||||
/** \return The next visible node from this node or 0 if this is
|
||||
the last visible node. */
|
||||
virtual IGUITreeViewNode* getNextVisible() const = 0;
|
||||
|
||||
//! Deletes a child node.
|
||||
// \return
|
||||
//! Returns true if the node was found as a child and is deleted.
|
||||
/** \return Returns true if the node was found as a child and is deleted. */
|
||||
virtual bool deleteChild( IGUITreeViewNode* child ) = 0;
|
||||
|
||||
//! Moves a child node one position up.
|
||||
//! \return
|
||||
//! Returns true if the node was found as achild node and was not already the first child.
|
||||
/** \return True if the node was found as achild node and was not already the first child. */
|
||||
virtual bool moveChildUp( IGUITreeViewNode* child ) = 0;
|
||||
|
||||
//! Moves a child node one position down.
|
||||
//! \return
|
||||
//! Returns true if the node was found as achild node and was not already the last child.
|
||||
/** \return True if the node was found as achild node and was not already the last child. */
|
||||
virtual bool moveChildDown( IGUITreeViewNode* child ) = 0;
|
||||
|
||||
//! Returns true if the node is expanded (childs are visible).
|
||||
|
@ -209,7 +205,7 @@ namespace gui
|
|||
virtual bool isRoot() const = 0;
|
||||
|
||||
//! Returns the level of this node.
|
||||
//! The root node has level 0. Direct childs of the root has level 1 ...
|
||||
/** The root node has level 0. Direct childs of the root has level 1 ... */
|
||||
virtual s32 getLevel() const = 0;
|
||||
|
||||
//! Returns true if this node is visible (all parents are expanded).
|
||||
|
@ -218,9 +214,10 @@ namespace gui
|
|||
|
||||
|
||||
//! Default tree view GUI element.
|
||||
//! Displays a windows like tree buttons to expand/collaps the child nodes of an node
|
||||
//! and optional tree lines.
|
||||
//! Each node consits of an text, an icon text and a void pointer for user data.
|
||||
/** Displays a windows like tree buttons to expand/collaps the child nodes of an node
|
||||
and optional tree lines.
|
||||
Each node consits of an text, an icon text and a void pointer for user data.
|
||||
*/
|
||||
class IGUITreeView : public IGUIElement
|
||||
{
|
||||
public:
|
||||
|
@ -242,17 +239,20 @@ namespace gui
|
|||
virtual bool getLinesVisible() const = 0;
|
||||
|
||||
//! sets if the tree lines are visible
|
||||
//! \param visible true for visible, false for invisible
|
||||
/** \param visible true for visible, false for invisible */
|
||||
virtual void setLinesVisible( bool visible ) = 0;
|
||||
|
||||
//! Sets the font which should be used as icon font. This font is set to the Irrlicht engine
|
||||
//! built-in-font by default. Icons can be displayed in front of every list item.
|
||||
//! An icon is a string, displayed with the icon font. When using the build-in-font of the
|
||||
//! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used.
|
||||
//! Sets the font which should be used as icon font.
|
||||
/** This font is set to the Irrlicht engine built-in-font by
|
||||
default. Icons can be displayed in front of every list item.
|
||||
An icon is a string, displayed with the icon font. When using
|
||||
the build-in-font of the Irrlicht engine as icon font, the icon
|
||||
strings defined in GUIIcons.h can be used.
|
||||
*/
|
||||
virtual void setIconFont( IGUIFont* font ) = 0;
|
||||
|
||||
//! Sets the image list which should be used for the image and selected image of every node.
|
||||
//! The default is 0 (no images).
|
||||
/** The default is 0 (no images). */
|
||||
virtual void setImageList( IGUIImageList* imageList ) = 0;
|
||||
|
||||
//! Returns the image list which is used for the nodes.
|
||||
|
@ -265,7 +265,7 @@ namespace gui
|
|||
virtual bool getImageLeftOfIcon() const = 0;
|
||||
|
||||
//! Returns the node which is associated to the last event.
|
||||
//! This pointer is only valid inside the OnEvent call!
|
||||
/** This pointer is only valid inside the OnEvent call! */
|
||||
virtual IGUITreeViewNode* getLastEventNode() const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
|
||||
//! Check if the file might be loaded by this class
|
||||
/** Check is based on the file extension (e.g. ".tga")
|
||||
\param fileName Name of file to check.
|
||||
\param filename Name of file to check.
|
||||
\return True if file seems to be loadable. */
|
||||
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class IImageWriter : public IReferenceCounted
|
|||
{
|
||||
public:
|
||||
//! Check if this writer can write a file with the given extension
|
||||
/** \param fileName Name of the file to check.
|
||||
/** \param filename Name of the file to check.
|
||||
\return True if file extension specifies a writable type. */
|
||||
virtual bool isAWriteableFileExtension(const io::path& filename) const = 0;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Written by Colin MacDonald - all rights assigned to Nikolaus Gebhardt
|
||||
// Copyright (C) 2008 Nikolaus Gebhardt
|
||||
// Copyright (C) 2008-2009 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
|
@ -15,43 +15,45 @@ namespace scene
|
|||
{
|
||||
class ILightSceneNode;
|
||||
|
||||
//! ILightManager provides an interface for user applications to manipulate the list
|
||||
//! of lights in the scene. The light list can be trimmed or re-ordered before device/
|
||||
//! hardware lights are created, and/or individual lights can be switched on and off
|
||||
//! before or after each scene node is rendered.
|
||||
//! It is assumed that the ILightManager implementation will store any data that it wishes
|
||||
//! to retain, i.e. the ISceneManager to which it is assigned, the lightList, the current
|
||||
//! render pass, and the current scene node.
|
||||
//! ILightManager provides an interface for user applications to manipulate the list of lights in the scene.
|
||||
/** The light list can be trimmed or re-ordered before device/ hardware
|
||||
lights are created, and/or individual lights can be switched on and off
|
||||
before or after each scene node is rendered. It is assumed that the
|
||||
ILightManager implementation will store any data that it wishes to
|
||||
retain, i.e. the ISceneManager to which it is assigned, the lightList,
|
||||
the current render pass, and the current scene node. */
|
||||
class ILightManager : public IReferenceCounted
|
||||
{
|
||||
public:
|
||||
//! Called after the scene's light list has been built, but before rendering has begun.
|
||||
//! As actual device/hardware lights are not created until the ESNRP_LIGHT render pass,
|
||||
//! this provides an opportunity for the light manager to trim or re-order the light
|
||||
//! list, before any device/hardware lights have actually been created.
|
||||
//! \param[in] smgr: the Scene Manager
|
||||
//! \param[inout] lightLight: the Scene Manager's light list, which the light manager may
|
||||
//! modify. This reference will remain valid until OnPostRender().
|
||||
/** As actual device/hardware lights are not created until the
|
||||
ESNRP_LIGHT render pass, this provides an opportunity for the
|
||||
light manager to trim or re-order the light list, before any
|
||||
device/hardware lights have actually been created.
|
||||
\param lightList: the Scene Manager's light list, which
|
||||
the light manager may modify. This reference will remain valid
|
||||
until OnPostRender().
|
||||
*/
|
||||
virtual void OnPreRender(core::array<ILightSceneNode*> & lightList) = 0;
|
||||
|
||||
//! Called after the last scene node is rendered.
|
||||
//! After this call returns, the lightList passed to OnPreRender() becomes invalid.
|
||||
/** After this call returns, the lightList passed to OnPreRender() becomes invalid. */
|
||||
virtual void OnPostRender(void) = 0;
|
||||
|
||||
//! Called before a render pass begins
|
||||
//! \param[in] renderPass: the render pass that's about to begin
|
||||
/** \param renderPass: the render pass that's about to begin */
|
||||
virtual void OnRenderPassPreRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
|
||||
|
||||
//! Called after the render pass specified in OnRenderPassPreRender() ends
|
||||
//! \param[in] renderPass: the render pass that has finished
|
||||
/** \param[in] renderPass: the render pass that has finished */
|
||||
virtual void OnRenderPassPostRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
|
||||
|
||||
//! Called before the given scene node is rendered
|
||||
//! \param[in] node: the scene node that's about to be rendered
|
||||
/** \param[in] node: the scene node that's about to be rendered */
|
||||
virtual void OnNodePreRender(ISceneNode* node) = 0;
|
||||
|
||||
//! Called after the the node specified in OnNodePreRender() has been rendered
|
||||
//! \param[in] node: the scene node that has just been rendered
|
||||
/** \param[in] node: the scene node that has just been rendered */
|
||||
virtual void OnNodePostRender(ISceneNode* node) = 0;
|
||||
};
|
||||
} // end namespace scene
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
//! Returns true if the file might be loaded by this class.
|
||||
/** This decision should be based on the file extension (e.g. ".cob")
|
||||
only.
|
||||
\param fileName Name of the file to test.
|
||||
\param filename Name of the file to test.
|
||||
\return True if the file might be loaded by this class. */
|
||||
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace scene
|
|||
virtual void scale(IMeshBuffer* buffer, const core::vector3df& factor) const = 0;
|
||||
|
||||
//! Scales the actual mesh, not a scene node.
|
||||
/** \deprecated
|
||||
/** \deprecated Use scale() instead
|
||||
\param mesh Mesh on which the operation is performed.
|
||||
\param factor Scale factor for each axis. */
|
||||
virtual void scaleMesh(IMesh* mesh, const core::vector3df& factor) const {return scale(mesh,factor);}
|
||||
|
@ -98,7 +98,7 @@ namespace scene
|
|||
virtual void transform(IMeshBuffer* buffer, const core::matrix4& m) const = 0;
|
||||
|
||||
//! Applies a transformation to a mesh
|
||||
/** \deprecated
|
||||
/** \deprecated Use transform() instead
|
||||
\param mesh Mesh on which the operation is performed.
|
||||
\param m transformation matrix. */
|
||||
virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const {return transform(mesh,m);}
|
||||
|
@ -128,7 +128,7 @@ namespace scene
|
|||
|
||||
//! Creates a planar texture mapping on the meshbuffer
|
||||
/** This method is currently implemented towards the LWO planar mapping. A more general biasing might be required.
|
||||
\param meshbuffer Buffer on which the operation is performed.
|
||||
\param buffer Buffer on which the operation is performed.
|
||||
\param resolutionS Resolution of the planar mapping in horizontal direction. This is the ratio between object space and texture space.
|
||||
\param resolutionT Resolution of the planar mapping in vertical direction. This is the ratio between object space and texture space.
|
||||
\param axis The axis along which the texture is projected. The allowed values are 0 (X), 1(Y), and 2(Z).
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace scene
|
|||
public:
|
||||
|
||||
//! Finds the collision point of a line and lots of triangles, if there is one.
|
||||
/** \param ray: Line with witch collisions are tested.
|
||||
/** \param ray: Line with which collisions are tested.
|
||||
\param selector: TriangleSelector containing the triangles. It
|
||||
can be created for example using
|
||||
ISceneManager::createTriangleSelector() or
|
||||
|
@ -58,6 +58,7 @@ namespace scene
|
|||
movement of the ellipsoid.
|
||||
\param triout: Optional parameter where the last triangle
|
||||
causing a collision is stored, if there is a collision.
|
||||
\param hitPosition: Return value for the position of the collision
|
||||
\param outFalling: Is set to true if the ellipsoid is falling
|
||||
down, caused by gravity.
|
||||
\param outNode: the node with which the ellipoid collided (if any)
|
||||
|
|
|
@ -209,7 +209,7 @@ namespace scene
|
|||
* a dummy object in this mode. Meshes included in the
|
||||
* scene will be added into the scene manager with the
|
||||
* following naming scheme:
|
||||
* path/to/file/file.dea#meshname. The loading of such
|
||||
* "path/to/file/file.dea#meshname". The loading of such
|
||||
* meshes is logged. Currently, this loader is able to
|
||||
* create meshes (made of only polygons), lights, and
|
||||
* cameras. Materials and animations are currently not
|
||||
|
@ -398,13 +398,12 @@ namespace scene
|
|||
const core::vector3df& rotation = core::vector3df(0,0,0),
|
||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
|
||||
|
||||
//! Adds a test scene node for test purposes to the scene.
|
||||
/** It is a simple cube of (1,1,1) size.
|
||||
\param size: Size of the cube.
|
||||
\param parent: Parent of the scene node. Can be NULL if no parent.
|
||||
//! Adds a cube scene node
|
||||
/** \param size: Size of the cube, uniformly in each dimension.
|
||||
\param parent: Parent of the scene node. Can be 0 if no parent.
|
||||
\param id: Id of the node. This id can be used to identify the scene node.
|
||||
\param position: Position of the space relative to its parent where the
|
||||
scene node will be placed.
|
||||
\param position: Position of the space relative to its parent
|
||||
where the scene node will be placed.
|
||||
\param rotation: Initital rotation of the scene node.
|
||||
\param scale: Initial scale of the scene node.
|
||||
\return Pointer to the created test scene node. This
|
||||
|
@ -415,14 +414,14 @@ namespace scene
|
|||
const core::vector3df& rotation = core::vector3df(0,0,0),
|
||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 0;
|
||||
|
||||
//! Adds a sphere scene node for test purposes to the scene.
|
||||
/** It is a simple sphere.
|
||||
\param radius: Radius of the sphere.
|
||||
\param polyCount: Polycount of the sphere.
|
||||
\param parent: Parent of the scene node. Can be NULL if no parent.
|
||||
//! Adds a sphere scene node of the given radius and detail
|
||||
/** \param radius: Radius of the sphere.
|
||||
\param polyCount: Polycount of the sphere, i.e. subdivision in
|
||||
horizontal and vertical direction.
|
||||
\param parent: Parent of the scene node. Can be 0 if no parent.
|
||||
\param id: Id of the node. This id can be used to identify the scene node.
|
||||
\param position: Position of the space relative to its parent where the
|
||||
scene node will be placed.
|
||||
\param position: Position of the space relative to its parent
|
||||
where the scene node will be placed.
|
||||
\param rotation: Initital rotation of the scene node.
|
||||
\param scale: Initial scale of the scene node.
|
||||
\return Pointer to the created test scene node. This
|
||||
|
@ -537,25 +536,31 @@ namespace scene
|
|||
\param parent: Parent scene node of the camera. Can be null. If the parent moves,
|
||||
the camera will move too.
|
||||
\param id: id of the camera. This id can be used to identify the camera.
|
||||
\param makeActive Flag whether this camera should become the active one.
|
||||
Make sure you always have one active camera.
|
||||
\return Pointer to interface to camera if successful, otherwise 0.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
|
||||
const core::vector3df& position = core::vector3df(0,0,0),
|
||||
const core::vector3df& lookat = core::vector3df(0,0,100), s32 id=-1) = 0;
|
||||
const core::vector3df& lookat = core::vector3df(0,0,100),
|
||||
s32 id=-1, bool makeActive=true) = 0;
|
||||
|
||||
//! Adds a maya style user controlled camera scene node to the scene graph.
|
||||
/** This is a standard camera with an animator that provides mouse control similar
|
||||
to camera in the 3D Software Maya by Alias Wavefront.
|
||||
\param parent: Parent scene node of the camera. Can be null.
|
||||
\param rotateSpeed: Rotation speed of the camera.
|
||||
\param zoomSpeed: Zoom speed of the camera.
|
||||
\param translationSpeed: TranslationSpeed of the camera.
|
||||
\param id: id of the camera. This id can be used to identify the camera.
|
||||
\return Returns a pointer to the interface of the camera if successful, otherwise 0.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||
to camera in the 3D Software Maya by Alias Wavefront.
|
||||
\param parent: Parent scene node of the camera. Can be null.
|
||||
\param rotateSpeed: Rotation speed of the camera.
|
||||
\param zoomSpeed: Zoom speed of the camera.
|
||||
\param translationSpeed: TranslationSpeed of the camera.
|
||||
\param id: id of the camera. This id can be used to identify the camera.
|
||||
\param makeActive Flag whether this camera should become the active one.
|
||||
Make sure you always have one active camera.
|
||||
\return Returns a pointer to the interface of the camera if successful, otherwise 0.
|
||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
|
||||
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
|
||||
f32 translationSpeed = 1500.0f, s32 id=-1) = 0;
|
||||
f32 translationSpeed = 1500.0f, s32 id=-1,
|
||||
bool makeActive=true) = 0;
|
||||
|
||||
//! Adds a camera scene node with an animator which provides mouse and keyboard control appropriate for first person shooters (FPS).
|
||||
/** This FPS camera is intended to provide a demonstration of a
|
||||
|
@ -616,13 +621,16 @@ namespace scene
|
|||
up when the mouse is moved down and down when the mouse is
|
||||
moved up, the default is 'false' which means it will follow the
|
||||
movement of the mouse cursor.
|
||||
\param makeActive Flag whether this camera should become the active one.
|
||||
Make sure you always have one active camera.
|
||||
\return Pointer to the interface of the camera if successful,
|
||||
otherwise 0. This pointer should not be dropped. See
|
||||
IReferenceCounted::drop() for more information. */
|
||||
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
|
||||
f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
|
||||
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
|
||||
f32 jumpSpeed = 0.f, bool invertMouse=false) = 0;
|
||||
f32 jumpSpeed = 0.f, bool invertMouse=false,
|
||||
bool makeActive=true) = 0;
|
||||
|
||||
//! Adds a dynamic light scene node to the scene graph.
|
||||
/** The light will cast dynamic light on all
|
||||
|
@ -692,6 +700,7 @@ namespace scene
|
|||
\param spherePercentage: How much of the sphere is drawn.
|
||||
Value should be between 0 and 2, where 1 is an exact
|
||||
half-sphere and 2 is a full sphere.
|
||||
\param radius The Radius of the sphere
|
||||
\param parent: Parent scene node of the dome. A dome usually has no parent,
|
||||
so this should be null. Note: If a parent is set, the dome will not
|
||||
change how it is drawn.
|
||||
|
@ -1098,6 +1107,8 @@ namespace scene
|
|||
move from the start point to the end point.
|
||||
\param loop: If set to false, the node stops when the end point is reached.
|
||||
If loop is true, the node begins again at the start.
|
||||
\param pingpong Flag to set whether the animator should fly
|
||||
back from end to start again.
|
||||
\return The animator. Attach it to a scene node with ISceneNode::addAnimator()
|
||||
and the animator will animate it.
|
||||
If you no longer need the animator, you should call ISceneNodeAnimator::drop().
|
||||
|
@ -1199,10 +1210,11 @@ namespace scene
|
|||
virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
|
||||
|
||||
//! Creates a simple ITriangleSelector, based on an animated mesh scene node.
|
||||
//! Details of the mesh associated with the node will be extracted internally.
|
||||
//! Call ITriangleSelector::update() to have the triangle selector updated based
|
||||
//! on the current frame of the animated mesh scene node.
|
||||
//! \param: The animated mesh scene node from which to build the selector
|
||||
/** Details of the mesh associated with the node will be extracted internally.
|
||||
Call ITriangleSelector::update() to have the triangle selector updated based
|
||||
on the current frame of the animated mesh scene node.
|
||||
\param node The animated mesh scene node from which to build the selector
|
||||
*/
|
||||
virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
|
||||
|
||||
|
||||
|
|
|
@ -132,6 +132,14 @@ namespace video
|
|||
EFT_FOG_EXP2
|
||||
};
|
||||
|
||||
const c8* const FogTypeNames[] =
|
||||
{
|
||||
"FogExp",
|
||||
"FogLinear",
|
||||
"FogExp2",
|
||||
0
|
||||
};
|
||||
|
||||
struct SOverrideMaterial
|
||||
{
|
||||
//! The Material values
|
||||
|
@ -396,7 +404,7 @@ namespace video
|
|||
example in picture edit programs. To avoid this problem, you
|
||||
could use the makeColorKeyTexture method, which takes the
|
||||
position of a pixel instead a color value.
|
||||
\param \deprecated zeroTexels If set to true, then any texels that match
|
||||
\param zeroTexels \deprecated If set to true, then any texels that match
|
||||
the color key will have their color, as well as their alpha, set to zero
|
||||
(i.e. black). This behaviour matches the legacy (buggy) behaviour prior
|
||||
to release 1.5 and is provided for backwards compatibility only.*/
|
||||
|
@ -412,7 +420,7 @@ namespace video
|
|||
\param colorKeyPixelPos Position of a pixel with the color key
|
||||
color. Every texel with this color will become fully transparent as
|
||||
described above.
|
||||
\param \deprecated zeroTexels If set to true, then any texels that match
|
||||
\param zeroTexels \deprecated If set to true, then any texels that match
|
||||
the color key will have their color, as well as their alpha, set to zero
|
||||
(i.e. black). This behaviour matches the legacy (buggy) behaviour prior
|
||||
to release 1.5 and is provided for backwards compatibility only.*/
|
||||
|
@ -548,8 +556,11 @@ namespace video
|
|||
\param vertexCount Amount of vertices in the array.
|
||||
\param indexList Pointer to array of indices.
|
||||
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
||||
virtual void drawIndexedTriangleList(const S3DVertex* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
||||
void drawIndexedTriangleList(const S3DVertex* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
//! Draws an indexed triangle list.
|
||||
/** Note that there may be at maximum 65536 vertices, because
|
||||
|
@ -560,8 +571,11 @@ namespace video
|
|||
\param vertexCount Amount of vertices in the array.
|
||||
\param indexList Pointer to array of indices.
|
||||
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
||||
virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
||||
void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
//! Draws an indexed triangle list.
|
||||
/** Note that there may be at maximum 65536 vertices, because
|
||||
|
@ -572,8 +586,11 @@ namespace video
|
|||
\param vertexCount Amount of vertices in the array.
|
||||
\param indexList Pointer to array of indices.
|
||||
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
||||
virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
||||
void drawIndexedTriangleList(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
/** Note that there may be at maximum 65536 vertices, because
|
||||
|
@ -584,8 +601,11 @@ namespace video
|
|||
\param vertexCount Amount of vertices in the array.
|
||||
\param indexList Pointer to array of indices.
|
||||
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
||||
virtual void drawIndexedTriangleFan(const S3DVertex* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
||||
void drawIndexedTriangleFan(const S3DVertex* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
|
||||
}
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
/** Note that there may be at maximum 65536 vertices, because
|
||||
|
@ -596,18 +616,36 @@ namespace video
|
|||
\param vertexCount Amount of vertices in the array.
|
||||
\param indexList Pointer to array of indices.
|
||||
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
||||
virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
||||
void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
|
||||
}
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
/** Note that there may be at maximum 65536 vertices, because
|
||||
the index list is an array of 16 bit values each with a maximum
|
||||
value of 65536. If there are more than 65536 vertices in the
|
||||
list, results of this operation are not defined.
|
||||
\param vertices Pointer to array of vertices.
|
||||
\param vertexCount Amount of vertices in the array.
|
||||
\param indexList Pointer to array of indices.
|
||||
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
||||
void drawIndexedTriangleFan(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
|
||||
}
|
||||
|
||||
//! Draws a 3d line.
|
||||
/** For some implementations, this method simply calls
|
||||
drawIndexedTriangles for some triangles.
|
||||
drawVertexPrimitiveList for some triangles.
|
||||
Note that the line is drawn using the current transformation
|
||||
matrix and material. So if you need to draw the 3D line
|
||||
independently of the current transformation, use
|
||||
\code
|
||||
driver->setMaterial(unlitMaterial);
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
||||
driver->setMaterial(someMaterial);
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||
\endcode
|
||||
for some properly set up material before drawing the line.
|
||||
Some drivers support line thickness set in the material.
|
||||
|
@ -618,15 +656,15 @@ namespace video
|
|||
const core::vector3df& end, SColor color = SColor(255,255,255,255)) =0;
|
||||
|
||||
//! Draws a 3d triangle.
|
||||
/** This method calls drawIndexedTriangles for some triangles.
|
||||
/** This method calls drawVertexPrimitiveList for some triangles.
|
||||
This method works with all drivers because it simply calls
|
||||
drawIndexedTriangleList but it is hence not very fast.
|
||||
drawVertexPrimitiveList, but it is hence not very fast.
|
||||
Note that the triangle is drawn using the current
|
||||
transformation matrix and material. So if you need to draw it
|
||||
independently of the current transformation, use
|
||||
\code
|
||||
driver->setMaterial(unlitMaterial);
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
||||
driver->setMaterial(someMaterial);
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||
\endcode
|
||||
for some properly set up material before drawing the triangle.
|
||||
\param triangle The triangle to draw.
|
||||
|
@ -640,8 +678,8 @@ namespace video
|
|||
matrix and material. So if you need to draw it independently of
|
||||
the current transformation, use
|
||||
\code
|
||||
driver->setMaterial(unlitMaterial);
|
||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
||||
driver->setMaterial(someMaterial);
|
||||
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||
\endcode
|
||||
for some properly set up material before drawing the box.
|
||||
\param box The axis aligned box to draw
|
||||
|
@ -864,8 +902,7 @@ namespace video
|
|||
/** These are global values attached to each 3d object rendered,
|
||||
which has the fog flag enabled in its material.
|
||||
\param color Color of the fog
|
||||
\param linearFog Set this to true for linear fog, otherwise
|
||||
exponential fog is applied.
|
||||
\param fogType Type of fog used
|
||||
\param start Only used in linear fog mode (linearFog=true).
|
||||
Specifies where fog starts.
|
||||
\param end Only used in linear fog mode (linearFog=true).
|
||||
|
@ -883,6 +920,11 @@ namespace video
|
|||
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
|
||||
bool pixelFog=false, bool rangeFog=false) =0;
|
||||
|
||||
//! Gets the fog mode.
|
||||
virtual void getFog(SColor& color, E_FOG_TYPE& fogType,
|
||||
f32& start, f32& end, f32& density,
|
||||
bool& pixelFog, bool& rangeFog) = 0;
|
||||
|
||||
//! Get the current color format of the color buffer
|
||||
/** \return Color format of the color buffer. */
|
||||
virtual ECOLOR_FORMAT getColorFormat() const =0;
|
||||
|
@ -965,7 +1007,7 @@ namespace video
|
|||
|
||||
//! Returns the maximum amount of primitives
|
||||
/** (mostly vertices) which the device is able to render with
|
||||
one drawIndexedTriangleList call.
|
||||
one drawVertexPrimitiveList call.
|
||||
\return Maximum amount of primitives. */
|
||||
virtual u32 getMaximalPrimitiveCount() const =0;
|
||||
|
||||
|
@ -1253,6 +1295,9 @@ namespace video
|
|||
Use the SceneManager attribute to set this value from your app.
|
||||
\param flag Default behavior is to disable ZWrite, i.e. false. */
|
||||
virtual void setAllowZWriteOnTransparent(bool flag) =0;
|
||||
|
||||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const =0;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#define IRRLICHT_VERSION_REVISION 0
|
||||
// This flag will be defined only in SVN, the official release code will have
|
||||
// it undefined
|
||||
#define IRRLICHT_VERSION_SVN
|
||||
#define IRRLICHT_SDK_VERSION "1.6-SVN"
|
||||
//#define IRRLICHT_VERSION_SVN
|
||||
#define IRRLICHT_SDK_VERSION "1.6"
|
||||
|
||||
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
|
||||
|
||||
|
@ -92,10 +92,7 @@
|
|||
#endif
|
||||
|
||||
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
|
||||
#if defined(__sparc__) || defined(__sun__)
|
||||
#define __BIG_ENDIAN__
|
||||
#define _IRR_SOLARIS_PLATFORM_
|
||||
#else
|
||||
#ifndef _IRR_SOLARIS_PLATFORM_
|
||||
#define _IRR_LINUX_PLATFORM_
|
||||
#endif
|
||||
#define _IRR_POSIX_API_
|
||||
|
@ -126,7 +123,7 @@ headers, e.g. Summer 2004. This is a Microsoft issue, not an Irrlicht one.
|
|||
#if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
|
||||
|
||||
//! Only define _IRR_COMPILE_WITH_DIRECT3D_8_ if you have an appropriate DXSDK, e.g. Summer 2004
|
||||
//#define _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
#define _IRR_COMPILE_WITH_DIRECT3D_8_
|
||||
#define _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||
|
||||
#endif
|
||||
|
@ -509,6 +506,10 @@ precision will be lower but speed higher. currently X86 only
|
|||
#undef _IRR_WCHAR_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if defined(__sparc__) || defined(__sun__)
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
#if defined(_IRR_SOLARIS_PLATFORM_)
|
||||
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
#endif
|
||||
|
|
|
@ -191,13 +191,19 @@ namespace video
|
|||
0 means no blue, 255 means full blue. */
|
||||
u32 getBlue() const { return color & 0xff; }
|
||||
|
||||
//! Returns the luminance of the color.
|
||||
//! Get lightness of the color in the range [0,255]
|
||||
f32 getLightness() const
|
||||
{
|
||||
return 0.5f*(core::max_(core::max_(getRed(),getGreen()),getBlue())+core::min_(core::min_(getRed(),getGreen()),getBlue()));
|
||||
}
|
||||
|
||||
//! Get luminance of the color in the range [0,255].
|
||||
f32 getLuminance() const
|
||||
{
|
||||
return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
|
||||
}
|
||||
|
||||
//! Returns the average intensity of the color.
|
||||
//! Get average intensity of the color in the range [0,255].
|
||||
u32 getAverage() const
|
||||
{
|
||||
return ( getRed() + getGreen() + getBlue() ) / 3;
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace scene
|
|||
const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const;
|
||||
|
||||
//! clips a line to the view frustum.
|
||||
//! \Return: Returns true if the line was clipped, false if not
|
||||
/** \return True if the line was clipped, false if not */
|
||||
bool clipLine(core::line3d<f32>& line) const;
|
||||
|
||||
//! the position of the camera
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
//! set a new allocation strategy
|
||||
/** if the maximum size of the array is unknown, you can define how big the
|
||||
allocation should happen.
|
||||
\param element: newStratgey to applay to this array. */
|
||||
\param newStrategy New strategy to apply to this array. */
|
||||
void setAllocStrategy ( eAllocStrategy newStrategy = ALLOC_STRATEGY_DOUBLE )
|
||||
{
|
||||
strategy = newStrategy;
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace core
|
|||
|
||||
//! Rounding error constant often used when comparing f32 values.
|
||||
|
||||
const s32 ROUNDING_ERROR_S32 = 1;
|
||||
const s32 ROUNDING_ERROR_S32 = 0;
|
||||
const f32 ROUNDING_ERROR_f32 = 0.000001f;
|
||||
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
||||
|
||||
|
@ -450,7 +450,6 @@ namespace core
|
|||
// calculate: 1 / x
|
||||
REALINLINE f32 reciprocal( const f32 f )
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(f==0.f); //divide by zero
|
||||
#if defined (IRRLICHT_FAST_MATH)
|
||||
|
||||
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
||||
|
@ -484,7 +483,6 @@ namespace core
|
|||
// calculate: 1 / x
|
||||
REALINLINE f64 reciprocal ( const f64 f )
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(f==0.); //divide by zero
|
||||
return 1.0 / f;
|
||||
}
|
||||
|
||||
|
@ -492,7 +490,6 @@ namespace core
|
|||
// calculate: 1 / x, low precision allowed
|
||||
REALINLINE f32 reciprocal_approxim ( const f32 f )
|
||||
{
|
||||
_IRR_DEBUG_BREAK_IF(f==0.f); //divide by zero
|
||||
#if defined( IRRLICHT_FAST_MATH)
|
||||
|
||||
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
||||
|
|
|
@ -124,8 +124,7 @@ public:
|
|||
|
||||
// temporary buffer for 16 numbers
|
||||
|
||||
c8 tmpbuf[16];
|
||||
tmpbuf[15] = 0;
|
||||
c8 tmpbuf[16]={0};
|
||||
u32 idx = 15;
|
||||
|
||||
// special case '0'
|
||||
|
@ -164,8 +163,7 @@ public:
|
|||
{
|
||||
// temporary buffer for 16 numbers
|
||||
|
||||
c8 tmpbuf[16];
|
||||
tmpbuf[15] = 0;
|
||||
c8 tmpbuf[16]={0};
|
||||
u32 idx = 15;
|
||||
|
||||
// special case '0'
|
||||
|
@ -222,7 +220,7 @@ public:
|
|||
|
||||
|
||||
//! Destructor
|
||||
virtual ~string()
|
||||
~string()
|
||||
{
|
||||
allocator.deallocate(array); // delete [] array;
|
||||
}
|
||||
|
@ -737,10 +735,11 @@ public:
|
|||
|
||||
//! finds another string in this string
|
||||
/** \param str: Another string
|
||||
\param start: Start position of the search
|
||||
\return Positions where the string has been found,
|
||||
or -1 if not found. */
|
||||
template <class B>
|
||||
s32 find(const B* const str) const
|
||||
s32 find(const B* const str, const u32 start = 0) const
|
||||
{
|
||||
if (str && *str)
|
||||
{
|
||||
|
@ -752,7 +751,7 @@ public:
|
|||
if (len > used-1)
|
||||
return -1;
|
||||
|
||||
for (u32 i=0; i<used-len; ++i)
|
||||
for (u32 i=start; i<used-len; ++i)
|
||||
{
|
||||
u32 j=0;
|
||||
|
||||
|
@ -886,6 +885,87 @@ public:
|
|||
}
|
||||
|
||||
|
||||
//! Removes characters from a string.
|
||||
/** \param c: Character to remove. */
|
||||
void remove(T c)
|
||||
{
|
||||
u32 pos = 0;
|
||||
u32 found = 0;
|
||||
for (u32 i=0; i<used; ++i)
|
||||
{
|
||||
if (array[i] == c)
|
||||
{
|
||||
++found;
|
||||
continue;
|
||||
}
|
||||
|
||||
array[pos++] = array[i];
|
||||
}
|
||||
used -= found;
|
||||
array[used] = 0;
|
||||
}
|
||||
|
||||
|
||||
//! Removes a string from the string.
|
||||
/** \param toRemove: String to remove. */
|
||||
void remove(const string<T> toRemove)
|
||||
{
|
||||
u32 size = toRemove.size();
|
||||
u32 pos = 0;
|
||||
u32 found = 0;
|
||||
for (u32 i=0; i<used; ++i)
|
||||
{
|
||||
u32 j = 0;
|
||||
while (j < size)
|
||||
{
|
||||
if (array[i + j] != toRemove[j])
|
||||
break;
|
||||
++j;
|
||||
}
|
||||
if (j == size)
|
||||
{
|
||||
found += size;
|
||||
i += size - 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
array[pos++] = array[i];
|
||||
}
|
||||
used -= found;
|
||||
array[used] = 0;
|
||||
}
|
||||
|
||||
|
||||
//! Removes characters from a string.
|
||||
/** \param characters: Characters to remove. */
|
||||
void removeChars(const string<T> & characters)
|
||||
{
|
||||
u32 pos = 0;
|
||||
u32 found = 0;
|
||||
for (u32 i=0; i<used; ++i)
|
||||
{
|
||||
// Don't use characters.findFirst as it finds the \0,
|
||||
// causing used to become incorrect.
|
||||
bool docontinue = false;
|
||||
for (u32 j=0; j<characters.size(); ++j)
|
||||
{
|
||||
if (characters[j] == array[i])
|
||||
{
|
||||
++found;
|
||||
docontinue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (docontinue)
|
||||
continue;
|
||||
|
||||
array[pos++] = array[i];
|
||||
}
|
||||
used -= found;
|
||||
array[used] = 0;
|
||||
}
|
||||
|
||||
|
||||
//! Trims the string.
|
||||
/** Removes the specified characters (by default, Latin-1 whitespace)
|
||||
from the begining and the end of the string. */
|
||||
|
@ -942,7 +1022,7 @@ public:
|
|||
}
|
||||
|
||||
//! gets the last char of a string or null
|
||||
inline T lastChar() const
|
||||
T lastChar() const
|
||||
{
|
||||
return used > 1 ? array[used-2] : 0;
|
||||
}
|
||||
|
|
|
@ -122,12 +122,15 @@ typedef unsigned short wchar_t;
|
|||
namespace irr
|
||||
{
|
||||
|
||||
//! Should the wide character version of the FileSystem be used
|
||||
//! Type name for character type used by the file system.
|
||||
/** Should the wide character version of the FileSystem be used it is a
|
||||
16 bit character variable. Used for unicode Filesystem and unicode strings.
|
||||
Else it is a 8 bit character variable. Used for ansi Filesystem and non-unicode
|
||||
strings
|
||||
*/
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||
//! 16 bit character variable. Used for unicode Filesystem and unicode strings
|
||||
typedef wchar_t fschar_t;
|
||||
#else
|
||||
//! 8 bit character variable. Used for ansi Filesystem and non-unicode strings
|
||||
typedef char fschar_t;
|
||||
#endif
|
||||
|
||||
|
@ -211,8 +214,8 @@ Compiler version defines: VC6.0 : 1200, VC7.0 : 1300, VC7.1 : 1310, VC8.0 : 1400
|
|||
/** some compilers can create those by directly writing the
|
||||
code like 'code', but some generate warnings so we use this macro here */
|
||||
#define MAKE_IRR_ID(c0, c1, c2, c3) \
|
||||
((u32)(u8)(c0) | ((u32)(u8)(c1) << 8) | \
|
||||
((u32)(u8)(c2) << 16) | ((u32)(u8)(c3) << 24 ))
|
||||
((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
|
||||
((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
|
||||
|
||||
#endif // __IRR_TYPES_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
Here you'll find any information you'll need to develop applications with
|
||||
irrXML. If you look for a tutorial on how to start, take a look at the \ref irrxmlexample,
|
||||
at the homepage of irrXML at <A HREF="http://www.ambiera.com/irrxml/">www.ambiera.com/irrxml/</A>
|
||||
or into the SDK in the directory \example.
|
||||
or into the SDK in the directory example.
|
||||
|
||||
irrXML is intended to be a high speed and easy-to-use XML Parser for C++, and
|
||||
this documentation is an important part of it. If you have any questions or
|
||||
|
@ -522,7 +522,7 @@ namespace io
|
|||
bool deleteCallback = false);
|
||||
|
||||
|
||||
/*! \file irrxml.h
|
||||
/*! \file irrXML.h
|
||||
\brief Header file of the irrXML, the Irrlicht XML parser.
|
||||
|
||||
This file includes everything needed for using irrXML,
|
||||
|
@ -534,7 +534,7 @@ namespace io
|
|||
\endcode
|
||||
|
||||
It is also common to use the two namespaces in which irrXML is included,
|
||||
directly after #including irrXML.h:
|
||||
directly after including irrXML.h:
|
||||
|
||||
\code
|
||||
#include <irrXML.h>
|
||||
|
|
|
@ -184,7 +184,7 @@
|
|||
#include "vector2d.h"
|
||||
#include "vector3d.h"
|
||||
|
||||
/*! \mainpage Irrlicht Engine 1.5 API documentation
|
||||
/*! \mainpage Irrlicht Engine 1.6 API documentation
|
||||
*
|
||||
* <div align="center"><img src="logobig.png" ></div>
|
||||
*
|
||||
|
@ -357,7 +357,7 @@ namespace irr
|
|||
// THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
|
||||
// EXISTING ONLY FOR THE DOCUMENTATION SOFTWARE DOXYGEN.
|
||||
|
||||
//! In this namespace can be found basic classes like vectors, planes, arrays, lists and so on.
|
||||
//! Basic classes such as vectors, planes, arrays, lists, and so on can be found in this namespace.
|
||||
namespace core
|
||||
{
|
||||
}
|
||||
|
@ -367,14 +367,12 @@ namespace irr
|
|||
{
|
||||
}
|
||||
|
||||
//! This namespace provides interfaces for input/output: Reading and
|
||||
//! writing files, accessing zip archives, xml files, ...
|
||||
//! This namespace provides interfaces for input/output: Reading and writing files, accessing zip archives, xml files, ...
|
||||
namespace io
|
||||
{
|
||||
}
|
||||
|
||||
//! All scene management can be found in this namespace: Mesh loading,
|
||||
//! special scene nodes like octrees and billboards, ...
|
||||
//! All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees and billboards, ...
|
||||
namespace scene
|
||||
{
|
||||
}
|
||||
|
@ -391,4 +389,3 @@ namespace irr
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -310,9 +310,9 @@ namespace core
|
|||
*/
|
||||
CMatrix4<T>& buildRotateFromTo(const core::vector3df& from, const core::vector3df& to);
|
||||
|
||||
//! Builds a combined matrix which translate to a center before rotation and translate afterwards
|
||||
/** \param from: vector to rotate from
|
||||
\param to: vector to rotate to
|
||||
//! Builds a combined matrix which translates to a center before rotation and translates from origin afterwards
|
||||
/** \param center Position to rotate around
|
||||
\param translate Translation applied after the rotation
|
||||
*/
|
||||
void setRotationCenter(const core::vector3df& center, const core::vector3df& translate);
|
||||
|
||||
|
@ -1922,9 +1922,6 @@ namespace core
|
|||
|
||||
|
||||
//! Builds a combined matrix which translate to a center before rotation and translate afterwards
|
||||
/** \param from: vector to rotate from
|
||||
\param to: vector to rotate to
|
||||
*/
|
||||
template <class T>
|
||||
inline void CMatrix4<T>::setRotationCenter(const core::vector3df& center, const core::vector3df& translation)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace irr
|
|||
namespace io
|
||||
{
|
||||
|
||||
//! Type used for all file system related strings.
|
||||
/** This type will transparently handle different file system encodings. */
|
||||
typedef core::string<fschar_t> path;
|
||||
|
||||
} // io
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace irr
|
|||
{
|
||||
namespace core
|
||||
{
|
||||
|
||||
// Use typedefs where possible as they are more explicit...
|
||||
|
||||
//! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly.
|
||||
|
@ -28,3 +29,4 @@ typedef vector2d<s32> position2di;
|
|||
#define position2d vector2d
|
||||
|
||||
#endif // __IRR_POSITION_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class quaternion
|
|||
matrix4 getMatrix() const;
|
||||
|
||||
//! Creates a matrix from this quaternion
|
||||
void getMatrix( matrix4 &dest, const vector3df &translation ) const;
|
||||
void getMatrix( matrix4 &dest, const core::vector3df &translation ) const;
|
||||
|
||||
/*!
|
||||
Creates a matrix from this quaternion
|
||||
|
@ -102,7 +102,7 @@ class quaternion
|
|||
lookat *= m3;
|
||||
|
||||
*/
|
||||
void getMatrixCenter( matrix4 &dest, const vector3df ¢er, const vector3df &translation ) const;
|
||||
void getMatrixCenter( matrix4 &dest, const core::vector3df ¢er, const core::vector3df &translation ) const;
|
||||
|
||||
//! Creates a matrix from this quaternion
|
||||
inline void getMatrix_transposed( matrix4 &dest ) const;
|
||||
|
@ -339,10 +339,9 @@ inline void quaternion::getMatrix( matrix4 &dest, const core::vector3df ¢er
|
|||
m2.setInverseTranslation ( center );
|
||||
lookat *= m2;
|
||||
*/
|
||||
inline void quaternion::getMatrixCenter( matrix4 &dest,
|
||||
const core::vector3df ¢er,
|
||||
const core::vector3df &translation
|
||||
) const
|
||||
inline void quaternion::getMatrixCenter(matrix4 &dest,
|
||||
const core::vector3df ¢er,
|
||||
const core::vector3df &translation) const
|
||||
{
|
||||
f32 * m = dest.pointer();
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 24 KiB |
|
@ -32,3 +32,5 @@ Feel free to use however you like, commercial etc, credits are Appreciated as a
|
|||
Psionic
|
||||
|
||||
http://www.psionic3d.co.uk
|
||||
|
||||
Note for Irrlicht: Irrlicht uses a 0-based frame index. So subtract 1 from each of the loops!
|
|
@ -21,7 +21,11 @@ rem for /F %%i in ('dir ..\..\..\examples\[01]*\main.cpp') DO ..\sed.exe -f tuto
|
|||
..\sed.exe -f tutorials.sed ..\..\..\examples\14.Win32Window\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\15.LoadIrrFile\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\16.Quake3MapShader\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\17.SplitScreen\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\17.HelloWorld_Mobile\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\18.SplitScreen\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\19.MouseAndJoystick\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\20.ManagedLights\main.cpp >>tut.txt
|
||||
..\sed.exe -f tutorials.sed ..\..\..\examples\21.Quake3Explorer\main.cpp >>tut.txt
|
||||
|
||||
..\doxygen.exe doxygen.cfg
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
rm tut.txt || true;
|
||||
for i in ../../../examples/[01]*/main.cpp; do
|
||||
for i in ../../../examples/[012]*/main.cpp; do
|
||||
sed -f tutorials.sed $i >>tut.txt;
|
||||
done
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ namespace scene
|
|||
virtual void calculateBoundingBox();
|
||||
|
||||
u32 FrameCount;
|
||||
s32 TriangleCount;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -349,6 +349,7 @@ void CAnimatedMeshSceneNode::render()
|
|||
{
|
||||
video::SMaterial debug_mat;
|
||||
debug_mat.Lighting = false;
|
||||
debug_mat.AntiAliasing=0;
|
||||
driver->setMaterial(debug_mat);
|
||||
// show normals
|
||||
if (DebugDataVisible & scene::EDS_NORMALS)
|
||||
|
@ -523,6 +524,12 @@ void CAnimatedMeshSceneNode::setAnimationSpeed(f32 framesPerSecond)
|
|||
}
|
||||
|
||||
|
||||
f32 CAnimatedMeshSceneNode::getAnimationSpeed() const
|
||||
{
|
||||
return FramesPerSecond * 1000.f;
|
||||
}
|
||||
|
||||
|
||||
//! returns the axis aligned bounding box of this node
|
||||
const core::aabbox3d<f32>& CAnimatedMeshSceneNode::getBoundingBox() const
|
||||
{
|
||||
|
@ -767,8 +774,8 @@ void CAnimatedMeshSceneNode::serializeAttributes(io::IAttributes* out, io::SAttr
|
|||
out->addBool("Looping", Looping);
|
||||
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
|
||||
out->addFloat("FramesPerSecond", FramesPerSecond);
|
||||
|
||||
// TODO: write animation names instead of frame begin and ends
|
||||
out->addInt("StartFrame", StartFrame);
|
||||
out->addInt("EndFrame", EndFrame);
|
||||
}
|
||||
|
||||
|
||||
|
@ -783,6 +790,8 @@ void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAtt
|
|||
Looping = in->getAttributeAsBool("Looping");
|
||||
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
|
||||
FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");
|
||||
StartFrame = in->getAttributeAsInt("StartFrame");
|
||||
EndFrame = in->getAttributeAsInt("EndFrame");
|
||||
|
||||
if (newMeshStr != "" && oldMeshStr != newMeshStr)
|
||||
{
|
||||
|
|
|
@ -57,9 +57,12 @@ namespace scene
|
|||
//! playback has ended. Set this to 0 to disable the callback again.
|
||||
virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0);
|
||||
|
||||
//! sets the speed with witch the animation is played
|
||||
//! sets the speed with which the animation is played
|
||||
virtual void setAnimationSpeed(f32 framesPerSecond);
|
||||
|
||||
//! gets the speed with which the animation is played
|
||||
virtual f32 getAnimationSpeed() const;
|
||||
|
||||
//! returns the material based on the zero based index i. To get the amount
|
||||
//! of materials used by this scene node, use getMaterialCount().
|
||||
//! This function is needed for inserting the node into the scene hirachy on a
|
||||
|
|
|
@ -1850,6 +1850,9 @@ public:
|
|||
|
||||
virtual void setTexture(video::ITexture* value)
|
||||
{
|
||||
if ( value == Value )
|
||||
return;
|
||||
|
||||
if (Value)
|
||||
Value->drop();
|
||||
|
||||
|
|
|
@ -234,6 +234,16 @@ void CCameraSceneNode::recalculateProjectionMatrix()
|
|||
//! prerender
|
||||
void CCameraSceneNode::OnRegisterSceneNode()
|
||||
{
|
||||
if ( SceneManager->getActiveCamera () == this )
|
||||
SceneManager->registerNodeForRendering(this, ESNRP_CAMERA);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
|
||||
|
||||
//! render
|
||||
void CCameraSceneNode::render()
|
||||
{
|
||||
core::vector3df pos = getAbsolutePosition();
|
||||
core::vector3df tgtv = Target - pos;
|
||||
tgtv.normalize();
|
||||
|
@ -245,7 +255,7 @@ void CCameraSceneNode::OnRegisterSceneNode()
|
|||
|
||||
f32 dp = tgtv.dotProduct(up);
|
||||
|
||||
if ( core::equals(fabsf(dp), 1.f) )
|
||||
if ( core::equals(core::abs_<f32>(dp), 1.f) )
|
||||
{
|
||||
up.X += 0.5f;
|
||||
}
|
||||
|
@ -254,16 +264,6 @@ void CCameraSceneNode::OnRegisterSceneNode()
|
|||
ViewArea.getTransform(video::ETS_VIEW) *= Affector;
|
||||
recalculateViewArea();
|
||||
|
||||
if ( SceneManager->getActiveCamera () == this )
|
||||
SceneManager->registerNodeForRendering(this, ESNRP_CAMERA);
|
||||
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
|
||||
|
||||
//! render
|
||||
void CCameraSceneNode::render()
|
||||
{
|
||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||
if ( driver)
|
||||
{
|
||||
|
@ -345,6 +345,24 @@ bool CCameraSceneNode::getTargetAndRotationBinding(void) const
|
|||
}
|
||||
|
||||
|
||||
//! Creates a clone of this scene node and its children.
|
||||
ISceneNode* CCameraSceneNode::clone(ISceneNode* newParent, ISceneManager* newManager)
|
||||
{
|
||||
if (!newParent)
|
||||
newParent = Parent;
|
||||
if (!newManager)
|
||||
newManager = SceneManager;
|
||||
|
||||
CCameraSceneNode* nb = new CCameraSceneNode(newParent,
|
||||
newManager, ID, RelativeTranslation, Target);
|
||||
|
||||
nb->cloneMembers(this, newManager);
|
||||
|
||||
nb->drop();
|
||||
return nb;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
||||
|
|
|
@ -142,6 +142,9 @@ namespace scene
|
|||
//! Queries if the camera scene node's rotation and its target position are bound together.
|
||||
virtual bool getTargetAndRotationBinding(void) const;
|
||||
|
||||
//! Creates a clone of this scene node and its children.
|
||||
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
|
||||
|
||||
protected:
|
||||
|
||||
void recalculateProjectionMatrix();
|
||||
|
|
|
@ -151,7 +151,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
|||
#if defined( _IRR_XBOX_PLATFORM_)
|
||||
D3DCREATETYPE d3dCreate = (D3DCREATETYPE) &Direct3DCreate8;
|
||||
#else
|
||||
D3DLibrary = LoadLibrary( "d3d8.dll" );
|
||||
D3DLibrary = LoadLibrary( __TEXT("d3d8.dll") );
|
||||
|
||||
if (!D3DLibrary)
|
||||
{
|
||||
|
@ -904,7 +904,19 @@ void CD3D8Driver::draw2D3DVertexPrimitiveList(const void* vertices,
|
|||
return;
|
||||
}
|
||||
else
|
||||
setRenderStates2DMode(true, (Material.getTexture(0) != 0), true);
|
||||
{
|
||||
if (Material.MaterialType==EMT_ONETEXTURE_BLEND)
|
||||
{
|
||||
E_BLEND_FACTOR srcFact;
|
||||
E_BLEND_FACTOR dstFact;
|
||||
E_MODULATE_FUNC modulo;
|
||||
u32 alphaSource;
|
||||
unpack_texureBlendFunc ( srcFact, dstFact, modulo, alphaSource, Material.MaterialTypeParam);
|
||||
setRenderStates2DMode(alphaSource&video::EAS_VERTEX_COLOR, (Material.getTexture(0) != 0), alphaSource&video::EAS_TEXTURE);
|
||||
}
|
||||
else
|
||||
setRenderStates2DMode(Material.MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA, (Material.getTexture(0) != 0), Material.MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL);
|
||||
}
|
||||
|
||||
switch (pType)
|
||||
{
|
||||
|
@ -2296,6 +2308,12 @@ void CD3D8Driver::enableClipPlane(u32 index, bool enable)
|
|||
}
|
||||
|
||||
|
||||
core::dimension2du CD3D8Driver::getMaxTextureSize() const
|
||||
{
|
||||
return core::dimension2du(Caps.MaxTextureWidth, Caps.MaxTextureHeight);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -217,6 +217,9 @@ namespace video
|
|||
//! \param enable: If true, enable the clipping plane else disable it.
|
||||
virtual void enableClipPlane(u32 index, bool enable);
|
||||
|
||||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const;
|
||||
|
||||
virtual bool checkDriverReset() {return DriverWasReset;}
|
||||
private:
|
||||
|
||||
|
|
|
@ -401,10 +401,10 @@ public:
|
|||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||
else
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M4)
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M4 || material.MaterialType == EMT_LIGHTMAP_LIGHTING_M4)
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE4X);
|
||||
else
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M2)
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M2 || material.MaterialType == EMT_LIGHTMAP_LIGHTING_M2)
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE2X);
|
||||
else
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
|
|
@ -163,7 +163,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
|||
|
||||
if (!pID3D)
|
||||
{
|
||||
D3DLibrary = LoadLibrary( "d3d9.dll" );
|
||||
D3DLibrary = LoadLibrary( __TEXT("d3d9.dll") );
|
||||
|
||||
if (!D3DLibrary)
|
||||
{
|
||||
|
@ -1173,7 +1173,19 @@ void CD3D9Driver::draw2D3DVertexPrimitiveList(const void* vertices,
|
|||
return;
|
||||
}
|
||||
else
|
||||
setRenderStates2DMode(true, (Material.getTexture(0) != 0), true);
|
||||
{
|
||||
if (Material.MaterialType==EMT_ONETEXTURE_BLEND)
|
||||
{
|
||||
E_BLEND_FACTOR srcFact;
|
||||
E_BLEND_FACTOR dstFact;
|
||||
E_MODULATE_FUNC modulo;
|
||||
u32 alphaSource;
|
||||
unpack_texureBlendFunc ( srcFact, dstFact, modulo, alphaSource, Material.MaterialTypeParam);
|
||||
setRenderStates2DMode(alphaSource&video::EAS_VERTEX_COLOR, (Material.getTexture(0) != 0), (alphaSource&video::EAS_TEXTURE) != 0);
|
||||
}
|
||||
else
|
||||
setRenderStates2DMode(Material.MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA, (Material.getTexture(0) != 0), Material.MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL);
|
||||
}
|
||||
|
||||
switch (pType)
|
||||
{
|
||||
|
@ -3111,6 +3123,12 @@ void CD3D9Driver::removeDepthSurface(SDepthSurface* depth)
|
|||
}
|
||||
|
||||
|
||||
core::dimension2du CD3D9Driver::getMaxTextureSize() const
|
||||
{
|
||||
return core::dimension2du(Caps.MaxTextureWidth, Caps.MaxTextureHeight);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
|
|
@ -272,6 +272,9 @@ namespace video
|
|||
/** \return Color format of the color buffer. */
|
||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||
|
||||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const;
|
||||
|
||||
//! Get the current color format of the color buffer
|
||||
/** \return Color format of the color buffer as D3D color value. */
|
||||
D3DFORMAT getD3DColorFormat() const;
|
||||
|
|
|
@ -377,7 +377,7 @@ public:
|
|||
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
|
||||
// 127 is required by EMT_TRANSPARENT_ALPHA_CHANNEL_REF
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAREF, 127);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAREF, 127);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
|
||||
pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
|
||||
}
|
||||
|
@ -431,10 +431,10 @@ public:
|
|||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||
else
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M4)
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M4 || material.MaterialType == EMT_LIGHTMAP_LIGHTING_M4)
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE4X);
|
||||
else
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M2)
|
||||
if (material.MaterialType == EMT_LIGHTMAP_M2 || material.MaterialType == EMT_LIGHTMAP_LIGHTING_M2)
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE2X);
|
||||
else
|
||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
|
|
|
@ -325,7 +325,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXAssembleShader(LPCSTR pSrcData,
|
|||
if (!pFn && !LoadFailed)
|
||||
{
|
||||
// try to load dll
|
||||
core::stringc strDllName = "d3dx9_";
|
||||
io::path strDllName = "d3dx9_";
|
||||
strDllName += (int)D3DX_SDK_VERSION;
|
||||
strDllName += ".dll";
|
||||
|
||||
|
@ -368,7 +368,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXAssembleShaderFromFile(LPCSTR pSrcF
|
|||
#endif
|
||||
|
||||
// invoke static linked function
|
||||
return D3DXAssembleShaderFromFile(pSrcFile, pDefines, pInclude, Flags,
|
||||
return D3DXAssembleShaderFromFileA(pSrcFile, pDefines, pInclude, Flags,
|
||||
ppShader, ppErrorMsgs);
|
||||
#else
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXAssembleShaderFromFile(LPCSTR pSrcF
|
|||
if (!pFn && !LoadFailed)
|
||||
{
|
||||
// try to load dll
|
||||
core::stringc strDllName = "d3dx9_";
|
||||
io::path strDllName = "d3dx9_";
|
||||
strDllName += (int)D3DX_SDK_VERSION;
|
||||
strDllName += ".dll";
|
||||
|
||||
|
@ -446,7 +446,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXCompileShader(LPCSTR pSrcData, UINT
|
|||
if (!pFn && !LoadFailed)
|
||||
{
|
||||
// try to load dll
|
||||
core::stringc strDllName = "d3dx9_";
|
||||
io::path strDllName = "d3dx9_";
|
||||
strDllName += (int)D3DX_SDK_VERSION;
|
||||
strDllName += ".dll";
|
||||
|
||||
|
@ -489,7 +489,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXCompileShaderFromFile(LPCSTR pSrcFi
|
|||
#endif
|
||||
|
||||
// invoke static linked function
|
||||
return D3DXCompileShaderFromFile(pSrcFile, pDefines, pInclude, pFunctionName, pProfile, Flags, ppShader, ppErrorMsgs, ppConstantTable);
|
||||
return D3DXCompileShaderFromFileA(pSrcFile, pDefines, pInclude, pFunctionName, pProfile, Flags, ppShader, ppErrorMsgs, ppConstantTable);
|
||||
#else
|
||||
{
|
||||
// try to load shader functions from the dll and print error if failed.
|
||||
|
@ -506,7 +506,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXCompileShaderFromFile(LPCSTR pSrcFi
|
|||
if (!pFn && !LoadFailed)
|
||||
{
|
||||
// try to load dll
|
||||
core::stringc strDllName = "d3dx9_";
|
||||
io::path strDllName = "d3dx9_";
|
||||
strDllName += (int)D3DX_SDK_VERSION;
|
||||
strDllName += ".dll";
|
||||
|
||||
|
|
|
@ -94,6 +94,12 @@ u32 CFileList::addItem(const io::path& fullPath, u32 size, bool isDirectory, u32
|
|||
return Files.size() - 1;
|
||||
}
|
||||
|
||||
//! Returns the ID of a file in the file list, based on an index.
|
||||
u32 CFileList::getID(u32 index) const
|
||||
{
|
||||
return index < Files.size() ? Files[index].ID : 0;
|
||||
}
|
||||
|
||||
bool CFileList::isDirectory(u32 index) const
|
||||
{
|
||||
bool ret = false;
|
||||
|
@ -107,7 +113,7 @@ bool CFileList::isDirectory(u32 index) const
|
|||
//! Returns the size of a file
|
||||
u32 CFileList::getFileSize(u32 index) const
|
||||
{
|
||||
return index < Files.size() ? Files[index].IsDirectory : 0;
|
||||
return index < Files.size() ? Files[index].Size : 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,10 +80,8 @@ public:
|
|||
\param id The ID of the file in the archive which owns it */
|
||||
virtual u32 addItem(const io::path& fullPath, u32 size, bool isDirectory, u32 id=0);
|
||||
|
||||
//! Sorts the file list
|
||||
void sort();
|
||||
|
||||
// IFileList methods
|
||||
//! Sorts the file list. You should call this after adding any items to the file list
|
||||
virtual void sort();
|
||||
|
||||
//! Returns the amount of files in the filelist.
|
||||
virtual u32 getFileCount() const;
|
||||
|
@ -94,6 +92,9 @@ public:
|
|||
//! Gets the full name of a file in the list, path included, based on an index.
|
||||
virtual const io::path& getFullFileName(u32 index) const;
|
||||
|
||||
//! Returns the ID of a file in the file list, based on an index.
|
||||
virtual u32 getID(u32 index) const;
|
||||
|
||||
//! Returns true if the file is a directory
|
||||
virtual bool isDirectory(u32 index) const;
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#if defined (_IRR_WINDOWS_API_)
|
||||
#if !defined ( _WIN32_WCE )
|
||||
#include <direct.h> // for _chdir
|
||||
#include <io.h> // for _access
|
||||
#endif
|
||||
#include <io.h> // for _access
|
||||
#else
|
||||
#if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
|
||||
#include <stdio.h>
|
||||
|
@ -438,7 +438,7 @@ io::path CFileSystem::getAbsolutePath(const io::path& filename) const
|
|||
#elif defined(_IRR_WINDOWS_API_)
|
||||
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM )
|
||||
c16 fpath[_MAX_PATH];
|
||||
wchar_t fpath[_MAX_PATH];
|
||||
p = _wfullpath(fpath, filename.c_str(), _MAX_PATH);
|
||||
#else
|
||||
c8 fpath[_MAX_PATH];
|
||||
|
@ -689,6 +689,13 @@ IFileList* CFileSystem::createFileList()
|
|||
return r;
|
||||
}
|
||||
|
||||
//! Creates an empty filelist
|
||||
IFileList* CFileSystem::createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths)
|
||||
{
|
||||
return new CFileList(path, ignoreCase, ignorePaths);
|
||||
}
|
||||
|
||||
|
||||
//! determines if a file exists and would be able to be opened.
|
||||
bool CFileSystem::existFile(const io::path& filename) const
|
||||
{
|
||||
|
@ -696,14 +703,31 @@ bool CFileSystem::existFile(const io::path& filename) const
|
|||
if (FileArchives[i]->getFileList()->findFile(filename)!=-1)
|
||||
return true;
|
||||
|
||||
#if defined(_IRR_WINDOWS_CE_PLATFORM_)
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||
HANDLE hFile = CreateFileW(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
#else
|
||||
HANDLE hFile = CreateFileA(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
#endif
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||
return (_waccess(filename.c_str(), 0) != -1);
|
||||
#elif defined(_MSC_VER)
|
||||
#else
|
||||
return (_access(filename.c_str(), 0) != -1);
|
||||
#endif
|
||||
#else
|
||||
return (access(filename.c_str(), F_OK) != -1);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,9 @@ public:
|
|||
//! and returns it.
|
||||
virtual IFileList* createFileList();
|
||||
|
||||
//! Creates an empty filelist
|
||||
virtual IFileList* createEmptyFileList(const io::path& path, bool ignoreCase, bool ignorePaths);
|
||||
|
||||
//! determines if a file exists and would be able to be opened.
|
||||
virtual bool existFile(const io::path& filename) const;
|
||||
|
||||
|
|
|
@ -131,6 +131,8 @@ CGUIColorSelectDialog::CGUIColorSelectDialog(const wchar_t* title, IGUIEnvironme
|
|||
}
|
||||
|
||||
SBatteryItem item;
|
||||
item.Incoming=0.f;
|
||||
item.Outgoing=0.f;
|
||||
|
||||
r.UpperLeftCorner.X = Template[i].x + 15;
|
||||
r.UpperLeftCorner.Y = Template[i].y;
|
||||
|
@ -218,7 +220,7 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d<u32> & dim,
|
|||
const f32 r = sqrtf((f32) r2);
|
||||
|
||||
// normalize, dotproduct = xnorm
|
||||
const f32 xn = -p.X * core::reciprocal(r);
|
||||
const f32 xn = r == 0.f ? 0.f : -p.X * core::reciprocal(r);
|
||||
|
||||
hsl.Hue = acosf(xn);
|
||||
if ( p.Y > 0 )
|
||||
|
|
|
@ -24,7 +24,7 @@ CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment,
|
|||
IGUIElement* parent, s32 id,
|
||||
core::rect<s32> rectangle, bool getFocus, bool allowFocus)
|
||||
: IGUIContextMenu(environment, parent, id, rectangle), EventParent(0), LastFont(0),
|
||||
HighLighted(-1), ChangeTime(0), AllowFocus(allowFocus)
|
||||
CloseHandling(ECMC_REMOVE), HighLighted(-1), ChangeTime(0), AllowFocus(allowFocus)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CGUIContextMenu");
|
||||
|
@ -51,6 +51,17 @@ CGUIContextMenu::~CGUIContextMenu()
|
|||
LastFont->drop();
|
||||
}
|
||||
|
||||
//! set behaviour when menus are closed
|
||||
void CGUIContextMenu::setCloseHandling(ECONTEXT_MENU_CLOSE onClose)
|
||||
{
|
||||
CloseHandling = onClose;
|
||||
}
|
||||
|
||||
//! get current behaviour when the menue will be closed
|
||||
ECONTEXT_MENU_CLOSE CGUIContextMenu::getCloseHandling() const
|
||||
{
|
||||
return CloseHandling;
|
||||
}
|
||||
|
||||
//! Returns amount of menu items
|
||||
u32 CGUIContextMenu::getItemCount() const
|
||||
|
@ -60,29 +71,57 @@ u32 CGUIContextMenu::getItemCount() const
|
|||
|
||||
|
||||
//! Adds a menu item.
|
||||
u32 CGUIContextMenu::addItem(const wchar_t* text, s32 id, bool enabled, bool hasSubMenu, bool checked)
|
||||
u32 CGUIContextMenu::addItem(const wchar_t* text, s32 commandId, bool enabled, bool hasSubMenu, bool checked, bool autoChecking)
|
||||
{
|
||||
return insertItem(Items.size(), text, commandId, enabled, hasSubMenu, checked, autoChecking);
|
||||
}
|
||||
|
||||
//! Insert a menu item at specified position.
|
||||
u32 CGUIContextMenu::insertItem(u32 idx, const wchar_t* text, s32 commandId, bool enabled,
|
||||
bool hasSubMenu, bool checked, bool autoChecking)
|
||||
{
|
||||
SItem s;
|
||||
s.Enabled = enabled;
|
||||
s.Checked = checked;
|
||||
s.AutoChecking = autoChecking;
|
||||
s.Text = text;
|
||||
s.IsSeparator = (text == 0);
|
||||
s.SubMenu = 0;
|
||||
s.CommandId = id;
|
||||
s.CommandId = commandId;
|
||||
|
||||
if (hasSubMenu)
|
||||
{
|
||||
s.SubMenu = new CGUIContextMenu(Environment, this, id,
|
||||
s.SubMenu = new CGUIContextMenu(Environment, this, commandId,
|
||||
core::rect<s32>(0,0,100,100), false, false);
|
||||
s.SubMenu->setVisible(false);
|
||||
}
|
||||
|
||||
Items.push_back(s);
|
||||
u32 result = idx;
|
||||
if ( idx < Items.size() )
|
||||
{
|
||||
Items.insert(s, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
Items.push_back(s);
|
||||
result = Items.size() - 1;
|
||||
}
|
||||
|
||||
recalculateSize();
|
||||
return Items.size() - 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 CGUIContextMenu::findItemWithCommandId(s32 commandId, u32 idxStartSearch) const
|
||||
{
|
||||
for ( u32 i=idxStartSearch; i<Items.size(); ++i )
|
||||
{
|
||||
if ( Items[i].CommandId == commandId )
|
||||
{
|
||||
return (s32)i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! Adds a sub menu from an element that already exists.
|
||||
void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
||||
|
@ -114,7 +153,7 @@ void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
|||
//! Adds a separator item to the menu
|
||||
void CGUIContextMenu::addSeparator()
|
||||
{
|
||||
addItem(0, -1, true, false, false);
|
||||
addItem(0, -1, true, false, false, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,6 +177,24 @@ void CGUIContextMenu::setItemText(u32 idx, const wchar_t* text)
|
|||
recalculateSize();
|
||||
}
|
||||
|
||||
//! should the element change the checked status on clicking
|
||||
void CGUIContextMenu::setItemAutoChecking(u32 idx, bool autoChecking)
|
||||
{
|
||||
if ( idx >= Items.size())
|
||||
return;
|
||||
|
||||
Items[idx].AutoChecking = autoChecking;
|
||||
}
|
||||
|
||||
//! does the element change the checked status on clicking
|
||||
bool CGUIContextMenu::getItemAutoChecking(u32 idx) const
|
||||
{
|
||||
if (idx >= Items.size())
|
||||
return false;
|
||||
|
||||
return Items[idx].AutoChecking;
|
||||
}
|
||||
|
||||
|
||||
//! Returns if a menu item is enabled
|
||||
bool CGUIContextMenu::isItemEnabled(u32 idx) const
|
||||
|
@ -231,8 +288,17 @@ bool CGUIContextMenu::OnEvent(const SEvent& event)
|
|||
if (event.GUIEvent.Caller == this && !isMyChild(event.GUIEvent.Element) && AllowFocus)
|
||||
{
|
||||
// set event parent of submenus
|
||||
setEventParent(Parent);
|
||||
remove();
|
||||
setEventParent(EventParent ? EventParent : Parent);
|
||||
|
||||
if ( CloseHandling & ECMC_HIDE )
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
if ( CloseHandling & ECMC_REMOVE )
|
||||
{
|
||||
remove();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -326,16 +392,20 @@ u32 CGUIContextMenu::sendClick(const core::position2d<s32>& p)
|
|||
Items[HighLighted].SubMenu)
|
||||
return 2;
|
||||
|
||||
if ( Items[HighLighted].AutoChecking )
|
||||
{
|
||||
Items[HighLighted].Checked = Items[HighLighted].Checked ? false : true;
|
||||
}
|
||||
|
||||
SEvent event;
|
||||
event.EventType = EET_GUI_EVENT;
|
||||
event.GUIEvent.Caller = this;
|
||||
event.GUIEvent.Element = 0;
|
||||
event.GUIEvent.EventType = EGET_MENU_ITEM_SELECTED;
|
||||
if (Parent)
|
||||
Parent->OnEvent(event);
|
||||
else
|
||||
if (EventParent)
|
||||
EventParent->OnEvent(event);
|
||||
EventParent->OnEvent(event);
|
||||
else if (Parent)
|
||||
Parent->OnEvent(event);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -644,6 +714,8 @@ void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeRe
|
|||
out->addInt("ParentItem", i);
|
||||
}
|
||||
|
||||
out->addInt("CloseHandling", (s32)CloseHandling);
|
||||
|
||||
// write out the item list
|
||||
out->addInt("ItemCount", Items.size());
|
||||
|
||||
|
@ -662,6 +734,10 @@ void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeRe
|
|||
out->addInt(tmp.c_str(), Items[i].CommandId);
|
||||
tmp = "Enabled"; tmp += i;
|
||||
out->addBool(tmp.c_str(), Items[i].Enabled);
|
||||
tmp = "Checked"; tmp += i;
|
||||
out->addBool(tmp.c_str(), Items[i].Checked);
|
||||
tmp = "AutoChecking"; tmp += i;
|
||||
out->addBool(tmp.c_str(), Items[i].AutoChecking);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -678,6 +754,7 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
|
|||
if (Parent && ( Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) )
|
||||
((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this);
|
||||
|
||||
CloseHandling = (ECONTEXT_MENU_CLOSE)in->getAttributeAsInt("CloseHandling");
|
||||
|
||||
removeAllItems();
|
||||
|
||||
|
@ -688,28 +765,37 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
|
|||
{
|
||||
core::stringc tmp;
|
||||
core::stringw txt;
|
||||
s32 commandid;
|
||||
bool enabled;
|
||||
bool checked;
|
||||
s32 commandid=-1;
|
||||
bool enabled=true;
|
||||
bool checked=false;
|
||||
bool autochecking=false;
|
||||
|
||||
tmp = "IsSeparator"; tmp += i;
|
||||
if ( in->getAttributeAsBool(tmp.c_str()) )
|
||||
if ( in->existsAttribute(tmp.c_str()) && in->getAttributeAsBool(tmp.c_str()) )
|
||||
addSeparator();
|
||||
else
|
||||
{
|
||||
tmp = "Text"; tmp += i;
|
||||
txt = in->getAttributeAsStringW(tmp.c_str());
|
||||
if ( in->existsAttribute(tmp.c_str()) )
|
||||
txt = in->getAttributeAsStringW(tmp.c_str());
|
||||
|
||||
tmp = "CommandID"; tmp += i;
|
||||
commandid = in->getAttributeAsInt(tmp.c_str());
|
||||
if ( in->existsAttribute(tmp.c_str()) )
|
||||
commandid = in->getAttributeAsInt(tmp.c_str());
|
||||
|
||||
tmp = "Enabled"; tmp += i;
|
||||
enabled = in->getAttributeAsBool(tmp.c_str());
|
||||
if ( in->existsAttribute(tmp.c_str()) )
|
||||
enabled = in->getAttributeAsBool(tmp.c_str());
|
||||
|
||||
tmp = "Checked"; tmp += i;
|
||||
checked = in->getAttributeAsBool(tmp.c_str());
|
||||
if ( in->existsAttribute(tmp.c_str()) )
|
||||
checked = in->getAttributeAsBool(tmp.c_str());
|
||||
|
||||
addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked);
|
||||
tmp = "AutoChecking"; tmp += i;
|
||||
if ( in->existsAttribute(tmp.c_str()) )
|
||||
autochecking = in->getAttributeAsBool(tmp.c_str());
|
||||
|
||||
addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked, autochecking);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,12 +31,25 @@ namespace gui
|
|||
//! destructor
|
||||
virtual ~CGUIContextMenu();
|
||||
|
||||
//! set behaviour when menus are closed
|
||||
virtual void setCloseHandling(ECONTEXT_MENU_CLOSE onClose);
|
||||
|
||||
//! get current behaviour when the menue will be closed
|
||||
virtual ECONTEXT_MENU_CLOSE getCloseHandling() const;
|
||||
|
||||
//! Returns amount of menu items
|
||||
virtual u32 getItemCount() const;
|
||||
|
||||
//! Adds a menu item.
|
||||
virtual u32 addItem(const wchar_t* text, s32 commandid,
|
||||
bool enabled, bool hasSubMenu, bool checked);
|
||||
bool enabled, bool hasSubMenu, bool checked, bool autoChecking);
|
||||
|
||||
//! Insert a menu item at specified position.
|
||||
virtual u32 insertItem(u32 idx, const wchar_t* text, s32 commandId, bool enabled,
|
||||
bool hasSubMenu, bool checked, bool autoChecking);
|
||||
|
||||
//! Find a item which has the given CommandId starting from given index
|
||||
virtual s32 findItemWithCommandId(s32 commandId, u32 idxStartSearch) const;
|
||||
|
||||
//! Adds a separator item to the menu
|
||||
virtual void addSeparator();
|
||||
|
@ -81,6 +94,12 @@ namespace gui
|
|||
//! Sets the visible state of this element.
|
||||
virtual void setVisible(bool visible);
|
||||
|
||||
//! should the element change the checked status on clicking
|
||||
virtual void setItemAutoChecking(u32 idx, bool autoChecking);
|
||||
|
||||
//! does the element change the checked status on clicking
|
||||
virtual bool getItemAutoChecking(u32 idx) const;
|
||||
|
||||
//! Returns command id of a menu item
|
||||
virtual s32 getItemCommandId(u32 idx) const;
|
||||
|
||||
|
@ -90,6 +109,9 @@ namespace gui
|
|||
//! Adds a sub menu from an element that already exists.
|
||||
virtual void setSubMenu(u32 index, CGUIContextMenu* menu);
|
||||
|
||||
//! When an eventparent is set it receives events instead of the usual parent element
|
||||
virtual void setEventParent(IGUIElement *parent);
|
||||
|
||||
//! Writes attributes of the element.
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
||||
|
||||
|
@ -107,6 +129,7 @@ namespace gui
|
|||
bool IsSeparator;
|
||||
bool Enabled;
|
||||
bool Checked;
|
||||
bool AutoChecking;
|
||||
core::dimension2d<u32> Dim;
|
||||
s32 PosY;
|
||||
CGUIContextMenu* SubMenu;
|
||||
|
@ -130,12 +153,12 @@ namespace gui
|
|||
//! Gets drawing rect of Item
|
||||
virtual core::rect<s32> getRect(const SItem& i, const core::rect<s32>& absolute) const;
|
||||
|
||||
void setEventParent(IGUIElement *parent);
|
||||
|
||||
core::array<SItem> Items;
|
||||
core::position2d<s32> Pos;
|
||||
IGUIElement* EventParent;
|
||||
IGUIFont *LastFont;
|
||||
ECONTEXT_MENU_CLOSE CloseHandling;
|
||||
s32 HighLighted;
|
||||
u32 ChangeTime;
|
||||
bool AllowFocus;
|
||||
|
|
|
@ -978,7 +978,7 @@ IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)
|
|||
|
||||
//! Adds a message box.
|
||||
IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t* text,
|
||||
bool modal, s32 flag, IGUIElement* parent, s32 id)
|
||||
bool modal, s32 flag, IGUIElement* parent, s32 id, video::ITexture* image)
|
||||
{
|
||||
if (!CurrentSkin)
|
||||
return 0;
|
||||
|
@ -990,8 +990,8 @@ IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t
|
|||
|
||||
screenDim.Width = parent->getAbsolutePosition().getWidth();
|
||||
screenDim.Height = parent->getAbsolutePosition().getHeight();
|
||||
msgBoxDim.Width = CurrentSkin->getSize(gui::EGDS_MESSAGE_BOX_WIDTH);
|
||||
msgBoxDim.Height = CurrentSkin->getSize(gui::EGDS_MESSAGE_BOX_HEIGHT);
|
||||
msgBoxDim.Width = 2;
|
||||
msgBoxDim.Height = 2;
|
||||
|
||||
rect.UpperLeftCorner.X = (screenDim.Width - msgBoxDim.Width) / 2;
|
||||
rect.UpperLeftCorner.Y = (screenDim.Height - msgBoxDim.Height) / 2;
|
||||
|
@ -1005,7 +1005,7 @@ IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t
|
|||
}
|
||||
|
||||
IGUIWindow* win = new CGUIMessageBox(this, caption, text, flag,
|
||||
parent, id, rect);
|
||||
parent, id, rect, image);
|
||||
|
||||
win->drop();
|
||||
return win;
|
||||
|
|
|
@ -96,7 +96,7 @@ public:
|
|||
|
||||
//! Adds a message box.
|
||||
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
|
||||
bool modal = true, s32 flag = EMBF_OK, IGUIElement* parent=0, s32 id=-1);
|
||||
bool modal = true, s32 flag = EMBF_OK, IGUIElement* parent=0, s32 id=-1, video::ITexture* image=0);
|
||||
|
||||
//! adds a scrollbar. The returned pointer must not be dropped.
|
||||
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
|
||||
|
|
|
@ -327,7 +327,9 @@ void CGUIFileOpenDialog::fillListBox()
|
|||
FileList = FileSystem->createFileList();
|
||||
core::stringw s;
|
||||
|
||||
#if !defined(_IRR_WINDOWS_CE_PLATFORM_)
|
||||
setlocale(LC_ALL,"");
|
||||
#endif
|
||||
|
||||
if (FileList)
|
||||
{
|
||||
|
@ -339,7 +341,7 @@ void CGUIFileOpenDialog::fillListBox()
|
|||
int len = mbstowcs(ws,cs,strlen(cs));
|
||||
ws[len] = 0;
|
||||
s = ws;
|
||||
delete ws;
|
||||
delete [] ws;
|
||||
#else
|
||||
s = FileList->getFileName(i).c_str();
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "IGUIEnvironment.h"
|
||||
#include "IGUIButton.h"
|
||||
#include "IGUIFont.h"
|
||||
#include "ITexture.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -18,9 +19,10 @@ namespace gui
|
|||
//! constructor
|
||||
CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption,
|
||||
const wchar_t* text, s32 flags,
|
||||
IGUIElement* parent, s32 id, core::rect<s32> rectangle)
|
||||
IGUIElement* parent, s32 id, core::rect<s32> rectangle, video::ITexture* image)
|
||||
: CGUIWindow(environment, parent, id, rectangle),
|
||||
OkButton(0), CancelButton(0), YesButton(0), NoButton(0), StaticText(0),
|
||||
Icon(0), IconTexture(image),
|
||||
Flags(flags), MessageText(text), Pressed(false)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -43,6 +45,9 @@ CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* capt
|
|||
|
||||
Environment->setFocus(this);
|
||||
|
||||
if ( IconTexture )
|
||||
IconTexture->grab();
|
||||
|
||||
refreshControls();
|
||||
}
|
||||
|
||||
|
@ -64,62 +69,134 @@ CGUIMessageBox::~CGUIMessageBox()
|
|||
|
||||
if (NoButton)
|
||||
NoButton->drop();
|
||||
|
||||
if (Icon)
|
||||
Icon->drop();
|
||||
|
||||
if ( IconTexture )
|
||||
IconTexture->drop();
|
||||
}
|
||||
|
||||
void CGUIMessageBox::setButton(IGUIButton*& button, bool isAvailable, const core::rect<s32> & btnRect, const wchar_t * text, IGUIElement*& focusMe)
|
||||
{
|
||||
// add/remove ok button
|
||||
if (isAvailable)
|
||||
{
|
||||
if (!button)
|
||||
{
|
||||
button = Environment->addButton(btnRect, this);
|
||||
button->setSubElement(true);
|
||||
button->grab();
|
||||
}
|
||||
else
|
||||
button->setRelativePosition(btnRect);
|
||||
|
||||
button->setText(text);
|
||||
|
||||
focusMe = button;
|
||||
}
|
||||
else if (button)
|
||||
{
|
||||
button->drop();
|
||||
button->remove();
|
||||
button =0;
|
||||
}
|
||||
}
|
||||
|
||||
void CGUIMessageBox::refreshControls()
|
||||
{
|
||||
// Layout can be seen as 4 boxes (a layoutmanager would be nice)
|
||||
// One box at top over the whole width for title
|
||||
// Two boxes with same height at the middle beside each other for icon and for text
|
||||
// One box at the bottom for the buttons
|
||||
|
||||
const IGUISkin* skin = Environment->getSkin();
|
||||
IGUIElement* focusMe = 0;
|
||||
|
||||
const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT);
|
||||
const s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH);
|
||||
const s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2;
|
||||
const s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2; // titlebar has no own constant
|
||||
const s32 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
|
||||
const s32 borderWidth = skin->getSize(EGDS_MESSAGE_BOX_GAP_SPACE);
|
||||
|
||||
// add static multiline text
|
||||
|
||||
core::dimension2d<s32> dim(AbsoluteClippingRect.getWidth() - buttonWidth,
|
||||
AbsoluteClippingRect.getHeight() - (buttonHeight * 2));
|
||||
const core::position2d<s32> pos((AbsoluteClippingRect.getWidth() - dim.Width) / 2,
|
||||
buttonHeight / 2 + titleHeight);
|
||||
|
||||
// add the static text for the message
|
||||
core::rect<s32> staticRect;
|
||||
staticRect.UpperLeftCorner.X = borderWidth;
|
||||
staticRect.UpperLeftCorner.Y = titleHeight + borderWidth;
|
||||
staticRect.LowerRightCorner.X = staticRect.UpperLeftCorner.X + skin->getSize(EGDS_MESSAGE_BOX_MAX_TEST_WIDTH);
|
||||
staticRect.LowerRightCorner.Y = staticRect.UpperLeftCorner.Y + skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT);
|
||||
if (!StaticText)
|
||||
{
|
||||
StaticText = Environment->addStaticText(MessageText.c_str(),
|
||||
core::rect<s32>(pos, dim), false, false, this);
|
||||
StaticText = Environment->addStaticText(MessageText.c_str(), staticRect, false, false, this);
|
||||
|
||||
StaticText->setWordWrap(true);
|
||||
StaticText->setSubElement(true);
|
||||
StaticText->grab();
|
||||
}
|
||||
else
|
||||
{
|
||||
StaticText->setRelativePosition(core::rect<s32>(pos, dim));
|
||||
StaticText->setRelativePosition(staticRect);
|
||||
StaticText->setText(MessageText.c_str());
|
||||
}
|
||||
|
||||
// adjust static text height
|
||||
s32 textHeight = StaticText->getTextHeight();
|
||||
s32 textWidth = StaticText->getTextWidth() + 6; // +6 because the static itself needs that
|
||||
const s32 iconHeight = IconTexture ? IconTexture->getOriginalSize().Height : 0;
|
||||
|
||||
const s32 textHeight = StaticText->getTextHeight();
|
||||
core::rect<s32> tmp = StaticText->getRelativePosition();
|
||||
tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + textHeight;
|
||||
StaticText->setRelativePosition(tmp);
|
||||
dim.Height = dim.Height - buttonHeight < tmp.getHeight() ? tmp.getHeight() : dim.Height - buttonHeight;
|
||||
if ( textWidth < skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH) )
|
||||
textWidth = skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH) + 6;
|
||||
// no neeed to check for max because it couldn't get larger due to statictextbox.
|
||||
if ( textHeight < skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT) )
|
||||
textHeight = skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT);
|
||||
if ( textHeight > skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT) )
|
||||
textHeight = skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT);
|
||||
|
||||
// adjust message box height if required
|
||||
// content is text + icons + borders (but not titlebar)
|
||||
s32 contentHeight = textHeight > iconHeight ? textHeight : iconHeight;
|
||||
contentHeight += borderWidth;
|
||||
s32 contentWidth = 0;
|
||||
|
||||
tmp = getRelativePosition();
|
||||
s32 msgBoxHeight = textHeight + core::floor32(2.5f * buttonHeight) + titleHeight;
|
||||
msgBoxHeight = tmp.getHeight() < msgBoxHeight ? msgBoxHeight : tmp.getHeight();
|
||||
// add icon
|
||||
if ( IconTexture )
|
||||
{
|
||||
core::position2d<s32> iconPos;
|
||||
iconPos.Y = titleHeight + borderWidth;
|
||||
if ( iconHeight < textHeight )
|
||||
iconPos.Y += (textHeight-iconHeight) / 2;
|
||||
iconPos.X = borderWidth;
|
||||
|
||||
// adjust message box position
|
||||
if (!Icon)
|
||||
{
|
||||
Icon = Environment->addImage(IconTexture, iconPos, true, this);
|
||||
Icon->setSubElement(true);
|
||||
Icon->grab();
|
||||
}
|
||||
else
|
||||
{
|
||||
core::rect<s32> iconRect( iconPos.X, iconPos.Y, iconPos.X + IconTexture->getOriginalSize().Width, iconPos.Y + IconTexture->getOriginalSize().Height );
|
||||
Icon->setRelativePosition(iconRect);
|
||||
}
|
||||
|
||||
tmp.UpperLeftCorner.Y = (Parent->getAbsolutePosition().getHeight() - msgBoxHeight) / 2;
|
||||
tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + msgBoxHeight;
|
||||
setRelativePosition(tmp);
|
||||
contentWidth += borderWidth + IconTexture->getOriginalSize().Width;
|
||||
}
|
||||
else if ( Icon )
|
||||
{
|
||||
Icon->drop();
|
||||
Icon->remove();
|
||||
Icon = 0;
|
||||
}
|
||||
|
||||
// add buttons
|
||||
// position text
|
||||
core::rect<s32> textRect;
|
||||
textRect.UpperLeftCorner.X = contentWidth + borderWidth;
|
||||
textRect.UpperLeftCorner.Y = titleHeight + borderWidth;
|
||||
if ( textHeight < iconHeight )
|
||||
textRect.UpperLeftCorner.Y += (iconHeight-textHeight) / 2;
|
||||
textRect.LowerRightCorner.X = textRect.UpperLeftCorner.X + textWidth;
|
||||
textRect.LowerRightCorner.Y = textRect.UpperLeftCorner.Y + textHeight;
|
||||
contentWidth += 2*borderWidth + textWidth;
|
||||
StaticText->setRelativePosition( textRect );
|
||||
|
||||
// find out button size needs
|
||||
s32 countButtons = 0;
|
||||
if (Flags & EMBF_OK)
|
||||
++countButtons;
|
||||
|
@ -130,123 +207,44 @@ void CGUIMessageBox::refreshControls()
|
|||
if (Flags & EMBF_NO)
|
||||
++countButtons;
|
||||
|
||||
s32 buttonBoxWidth = countButtons * buttonWidth + 2 * borderWidth;
|
||||
if ( countButtons > 1 )
|
||||
buttonBoxWidth += (countButtons-1) * buttonDistance;
|
||||
s32 buttonBoxHeight = buttonHeight + 2 * borderWidth;
|
||||
|
||||
// calc new message box sizes
|
||||
core::rect<s32> tmp = getRelativePosition();
|
||||
s32 msgBoxHeight = titleHeight + contentHeight + buttonBoxHeight;
|
||||
s32 msgBoxWidth = contentWidth > buttonBoxWidth ? contentWidth : buttonBoxWidth;
|
||||
|
||||
// adjust message box position
|
||||
tmp.UpperLeftCorner.Y = (Parent->getAbsolutePosition().getHeight() - msgBoxHeight) / 2;
|
||||
tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + msgBoxHeight;
|
||||
tmp.UpperLeftCorner.X = (Parent->getAbsolutePosition().getWidth() - msgBoxWidth) / 2;
|
||||
tmp.LowerRightCorner.X = tmp.UpperLeftCorner.X + msgBoxWidth;
|
||||
setRelativePosition(tmp);
|
||||
|
||||
// add buttons
|
||||
|
||||
core::rect<s32> btnRect;
|
||||
btnRect.UpperLeftCorner.Y = pos.Y + dim.Height + buttonHeight / 2;
|
||||
btnRect.UpperLeftCorner.Y = titleHeight + contentHeight + borderWidth;
|
||||
btnRect.LowerRightCorner.Y = btnRect.UpperLeftCorner.Y + buttonHeight;
|
||||
btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() -
|
||||
(buttonWidth*countButtons + (buttonDistance*countButtons+1))) / 2 +
|
||||
buttonDistance / 2;
|
||||
btnRect.UpperLeftCorner.X = borderWidth;
|
||||
if ( contentWidth > buttonBoxWidth )
|
||||
btnRect.UpperLeftCorner.X += (contentWidth - buttonBoxWidth) / 2; // center buttons
|
||||
btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth;
|
||||
|
||||
// add/remove ok button
|
||||
if (Flags & EMBF_OK)
|
||||
{
|
||||
if (!OkButton)
|
||||
{
|
||||
OkButton = Environment->addButton(btnRect, this);
|
||||
OkButton->setSubElement(true);
|
||||
OkButton->grab();
|
||||
}
|
||||
else
|
||||
OkButton->setRelativePosition(btnRect);
|
||||
|
||||
OkButton->setText(skin->getDefaultText(EGDT_MSG_BOX_OK));
|
||||
|
||||
btnRect.LowerRightCorner.X += buttonWidth + buttonDistance;
|
||||
btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance;
|
||||
|
||||
focusMe = OkButton;
|
||||
}
|
||||
else if (OkButton)
|
||||
{
|
||||
OkButton->drop();
|
||||
OkButton->remove();
|
||||
OkButton = 0;
|
||||
}
|
||||
|
||||
// add cancel button
|
||||
if (Flags & EMBF_CANCEL)
|
||||
{
|
||||
if (!CancelButton)
|
||||
{
|
||||
CancelButton = Environment->addButton(btnRect, this);
|
||||
CancelButton->setSubElement(true);
|
||||
CancelButton->grab();
|
||||
}
|
||||
else
|
||||
CancelButton->setRelativePosition(btnRect);
|
||||
|
||||
CancelButton->setText(skin->getDefaultText(EGDT_MSG_BOX_CANCEL));
|
||||
|
||||
btnRect.LowerRightCorner.X += buttonWidth + buttonDistance;
|
||||
btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance;
|
||||
|
||||
if (!focusMe)
|
||||
focusMe = CancelButton;
|
||||
|
||||
}
|
||||
else if (CancelButton)
|
||||
{
|
||||
CancelButton->drop();
|
||||
CancelButton->remove();
|
||||
CancelButton = 0;
|
||||
}
|
||||
|
||||
|
||||
// add/remove yes button
|
||||
if (Flags & EMBF_YES)
|
||||
{
|
||||
if (!YesButton)
|
||||
{
|
||||
YesButton = Environment->addButton(btnRect, this);
|
||||
YesButton->setSubElement(true);
|
||||
YesButton->grab();
|
||||
}
|
||||
else
|
||||
YesButton->setRelativePosition(btnRect);
|
||||
|
||||
YesButton->setText(skin->getDefaultText(EGDT_MSG_BOX_YES));
|
||||
|
||||
btnRect.LowerRightCorner.X += buttonWidth + buttonDistance;
|
||||
btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance;
|
||||
|
||||
if (!focusMe)
|
||||
focusMe = YesButton;
|
||||
}
|
||||
else if (YesButton)
|
||||
{
|
||||
YesButton->drop();
|
||||
YesButton->remove();
|
||||
YesButton = 0;
|
||||
}
|
||||
|
||||
// add no button
|
||||
if (Flags & EMBF_NO)
|
||||
{
|
||||
if (!NoButton)
|
||||
{
|
||||
NoButton = Environment->addButton(btnRect, this);
|
||||
NoButton->setSubElement(true);
|
||||
NoButton->grab();
|
||||
}
|
||||
else
|
||||
NoButton->setRelativePosition(btnRect);
|
||||
|
||||
NoButton->setText(skin->getDefaultText(EGDT_MSG_BOX_NO));
|
||||
|
||||
btnRect.LowerRightCorner.X += buttonWidth + buttonDistance;
|
||||
btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance;
|
||||
|
||||
if (!focusMe)
|
||||
focusMe = NoButton;
|
||||
|
||||
}
|
||||
else if (NoButton)
|
||||
{
|
||||
NoButton->drop();
|
||||
NoButton->remove();
|
||||
NoButton = 0;
|
||||
}
|
||||
IGUIElement* focusMe = 0;
|
||||
setButton(OkButton, (Flags & EMBF_OK) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_OK), focusMe);
|
||||
if ( Flags & EMBF_OK )
|
||||
btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0);
|
||||
setButton(CancelButton, (Flags & EMBF_CANCEL) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_CANCEL), focusMe);
|
||||
if ( Flags & EMBF_CANCEL )
|
||||
btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0);
|
||||
setButton(YesButton, (Flags & EMBF_YES) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_YES), focusMe);
|
||||
if ( Flags & EMBF_YES )
|
||||
btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0);
|
||||
setButton(NoButton, (Flags & EMBF_NO) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_NO), focusMe);
|
||||
|
||||
if (Environment->hasFocus(this) && focusMe)
|
||||
Environment->setFocus(focusMe);
|
||||
|
@ -409,6 +407,7 @@ void CGUIMessageBox::serializeAttributes(io::IAttributes* out, io::SAttributeRea
|
|||
out->addBool ("CancelButton", (Flags & EMBF_CANCEL) != 0 );
|
||||
out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );
|
||||
out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );
|
||||
out->addTexture ("Texture", IconTexture);
|
||||
|
||||
out->addString ("MessageText", MessageText.c_str());
|
||||
}
|
||||
|
@ -424,6 +423,15 @@ void CGUIMessageBox::deserializeAttributes(io::IAttributes* in, io::SAttributeRe
|
|||
Flags |= in->getAttributeAsBool("YesButton") ? EMBF_YES : 0;
|
||||
Flags |= in->getAttributeAsBool("NoButton") ? EMBF_NO : 0;
|
||||
|
||||
if ( IconTexture )
|
||||
{
|
||||
IconTexture->drop();
|
||||
IconTexture = NULL;
|
||||
}
|
||||
IconTexture = in->getAttributeAsTexture("Texture");
|
||||
if ( IconTexture )
|
||||
IconTexture->grab();
|
||||
|
||||
MessageText = in->getAttributeAsStringW("MessageText").c_str();
|
||||
|
||||
CGUIWindow::deserializeAttributes(in,options);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "CGUIWindow.h"
|
||||
#include "IGUIStaticText.h"
|
||||
#include "IGUIImage.h"
|
||||
#include "irrArray.h"
|
||||
|
||||
namespace irr
|
||||
|
@ -23,7 +24,7 @@ namespace gui
|
|||
//! constructor
|
||||
CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption,
|
||||
const wchar_t* text, s32 flag,
|
||||
IGUIElement* parent, s32 id, core::rect<s32> rectangle);
|
||||
IGUIElement* parent, s32 id, core::rect<s32> rectangle, video::ITexture* image=0);
|
||||
|
||||
//! destructor
|
||||
virtual ~CGUIMessageBox();
|
||||
|
@ -40,12 +41,15 @@ namespace gui
|
|||
private:
|
||||
|
||||
void refreshControls();
|
||||
void setButton(IGUIButton*& button, bool isAvailable, const core::rect<s32> & btnRect, const wchar_t * text, IGUIElement*& focusMe);
|
||||
|
||||
IGUIButton* OkButton;
|
||||
IGUIButton* CancelButton;
|
||||
IGUIButton* YesButton;
|
||||
IGUIButton* NoButton;
|
||||
IGUIStaticText* StaticText;
|
||||
IGUIImage * Icon;
|
||||
video::ITexture * IconTexture;
|
||||
|
||||
s32 Flags;
|
||||
core::stringw MessageText;
|
||||
|
|
|
@ -104,6 +104,12 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
|
|||
Sizes[EGDS_TITLEBARTEXT_DISTANCE_Y] = 2;
|
||||
}
|
||||
|
||||
Sizes[EGDS_MESSAGE_BOX_GAP_SPACE] = 15;
|
||||
Sizes[EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH] = 0;
|
||||
Sizes[EGDS_MESSAGE_BOX_MAX_TEST_WIDTH] = 500;
|
||||
Sizes[EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT] = 0;
|
||||
Sizes[EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT] = 99999;
|
||||
|
||||
Texts[EGDT_MSG_BOX_OK] = L"OK";
|
||||
Texts[EGDT_MSG_BOX_CANCEL] = L"Cancel";
|
||||
Texts[EGDT_MSG_BOX_YES] = L"Yes";
|
||||
|
|
|
@ -121,13 +121,27 @@ IGUIButton* CGUIToolBar::addButton(s32 id, const wchar_t* text,const wchar_t* to
|
|||
{
|
||||
ButtonX += 3;
|
||||
|
||||
core::rect<s32> rectangle(ButtonX,2,0,0);
|
||||
core::rect<s32> rectangle(ButtonX,2,ButtonX+1,3);
|
||||
if ( img )
|
||||
{
|
||||
const core::dimension2du &size = img->getOriginalSize();
|
||||
rectangle.LowerRightCorner.X = rectangle.UpperLeftCorner.X + size.Width + 8;
|
||||
rectangle.LowerRightCorner.Y = rectangle.UpperLeftCorner.Y + size.Height + 6;
|
||||
}
|
||||
|
||||
if ( text )
|
||||
{
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
IGUIFont * font = skin->getFont(EGDF_BUTTON);
|
||||
if ( font )
|
||||
{
|
||||
core::dimension2d<u32> dim = font->getDimension(text);
|
||||
if ( (s32)dim.Width > rectangle.getWidth() )
|
||||
rectangle.LowerRightCorner.X = rectangle.UpperLeftCorner.X + dim.Width + 8;
|
||||
if ( (s32)dim.Height > rectangle.getHeight() )
|
||||
rectangle.LowerRightCorner.Y = rectangle.UpperLeftCorner.Y + dim.Height + 6;
|
||||
}
|
||||
}
|
||||
|
||||
ButtonX += rectangle.getWidth();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ BOOL WINAPI ConsoleHandler(DWORD CEvent)
|
|||
DeviceToClose->closeDevice();
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
#elif defined(_IRR_POSIX_API_)
|
||||
// sigterm handler
|
||||
#include <signal.h>
|
||||
|
||||
|
@ -64,7 +64,7 @@ const u16 ASCIIArtCharsCount = 32;
|
|||
|
||||
//! constructor
|
||||
CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
|
||||
: CIrrDeviceStub(params), IsDeviceRunning(true), IsWindowFocused(true), ConsoleFont(0), OutFile(stdout)
|
||||
: CIrrDeviceStub(params), IsWindowFocused(true), ConsoleFont(0), OutFile(stdout)
|
||||
{
|
||||
DeviceToClose = this;
|
||||
|
||||
|
@ -94,9 +94,9 @@ CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
|
|||
// catch windows close/break signals
|
||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE);
|
||||
|
||||
#else
|
||||
#elif defined(_IRR_POSIX_API_)
|
||||
// catch other signals
|
||||
signal(SIGABRT, &sighandler);
|
||||
signal(SIGABRT, &sighandler);
|
||||
signal(SIGTERM, &sighandler);
|
||||
signal(SIGINT, &sighandler);
|
||||
|
||||
|
@ -305,7 +305,7 @@ bool CIrrDeviceConsole::run()
|
|||
// todo: keyboard input from terminal in raw mode
|
||||
#endif
|
||||
|
||||
return IsDeviceRunning;
|
||||
return !Close;
|
||||
}
|
||||
|
||||
//! Cause the device to temporarily pause execution and let other processes to run
|
||||
|
@ -346,8 +346,7 @@ void CIrrDeviceConsole::sleep(u32 timeMs, bool pauseTimer)
|
|||
void CIrrDeviceConsole::setWindowCaption(const wchar_t* text)
|
||||
{
|
||||
#ifdef _IRR_WINDOWS_NT_CONSOLE_
|
||||
core::stringc txt(text);
|
||||
SetConsoleTitle(txt.c_str());
|
||||
SetConsoleTitleW(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -413,7 +412,7 @@ bool CIrrDeviceConsole::present(video::IImage* surface, void* windowId, core::re
|
|||
void CIrrDeviceConsole::closeDevice()
|
||||
{
|
||||
// return false next time we run()
|
||||
IsDeviceRunning = false;
|
||||
Close = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -223,8 +223,7 @@ namespace irr
|
|||
core::stringc Text;
|
||||
};
|
||||
|
||||
bool IsDeviceRunning,
|
||||
IsWindowFocused;
|
||||
bool IsWindowFocused;
|
||||
|
||||
core::array<core::stringc> OutputBuffer;
|
||||
gui::IGUIFont *ConsoleFont;
|
||||
|
@ -328,3 +327,4 @@ namespace gui
|
|||
|
||||
#endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __FREE_BSD_
|
||||
#include <sys/joystick.h>
|
||||
#else
|
||||
|
||||
// linux/joystick.h includes linux/input.h, which #defines values for various KEY_FOO keys.
|
||||
// These override the irr::KEY_FOO equivalents, which stops key handling from working.
|
||||
// As a workaround, defining _INPUT_H stops linux/input.h from being included; it
|
||||
|
@ -34,6 +38,8 @@
|
|||
#include <sys/ioctl.h> // Would normally be included in linux/input.h
|
||||
#include <linux/joystick.h>
|
||||
#undef _INPUT_H
|
||||
#endif
|
||||
|
||||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||
|
||||
namespace irr
|
||||
|
@ -73,7 +79,7 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
|||
#endif
|
||||
#endif
|
||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||
Close(false), WindowHasFocus(false), WindowMinimized(false),
|
||||
WindowHasFocus(false), WindowMinimized(false),
|
||||
UseXVidMode(false), UseXRandR(false), UseGLXWindow(false),
|
||||
ExternalWindow(false), AutorepeatSupport(0)
|
||||
{
|
||||
|
@ -128,6 +134,8 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
|
|||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
if (StdHints)
|
||||
XFree(StdHints);
|
||||
// Disable cursor and free it later on
|
||||
CursorControl->setVisible(false);
|
||||
if (display)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
@ -149,21 +157,8 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
|
|||
}
|
||||
#endif // #ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
||||
if (UseXVidMode && CreationParams.Fullscreen)
|
||||
{
|
||||
XF86VidModeSwitchToMode(display, screennr, &oldVideoMode);
|
||||
XF86VidModeSetViewPort(display, screennr, 0, 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef _IRR_LINUX_X11_RANDR_
|
||||
if (UseXRandR && CreationParams.Fullscreen)
|
||||
{
|
||||
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display));
|
||||
XRRSetScreenConfig(display,config,DefaultRootWindow(display),oldRandrMode,oldRandrRotation,CurrentTime);
|
||||
XRRFreeScreenConfigInfo(config);
|
||||
}
|
||||
#endif
|
||||
// Reset fullscreen resolution change
|
||||
switchToFullscreen(true);
|
||||
|
||||
if (SoftwareImage)
|
||||
XDestroyImage(SoftwareImage);
|
||||
|
@ -207,6 +202,109 @@ int IrrPrintXError(Display *display, XErrorEvent *event)
|
|||
#endif
|
||||
|
||||
|
||||
bool CIrrDeviceLinux::switchToFullscreen(bool reset)
|
||||
{
|
||||
if (!CreationParams.Fullscreen)
|
||||
return true;
|
||||
if (reset)
|
||||
{
|
||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
||||
if (UseXVidMode && CreationParams.Fullscreen)
|
||||
{
|
||||
XF86VidModeSwitchToMode(display, screennr, &oldVideoMode);
|
||||
XF86VidModeSetViewPort(display, screennr, 0, 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef _IRR_LINUX_X11_RANDR_
|
||||
if (UseXRandR && CreationParams.Fullscreen)
|
||||
{
|
||||
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display));
|
||||
XRRSetScreenConfig(display,config,DefaultRootWindow(display),oldRandrMode,oldRandrRotation,CurrentTime);
|
||||
XRRFreeScreenConfigInfo(config);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
getVideoModeList();
|
||||
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
|
||||
s32 eventbase, errorbase;
|
||||
s32 bestMode = -1;
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
||||
if (XF86VidModeQueryExtension(display, &eventbase, &errorbase))
|
||||
{
|
||||
// enumerate video modes
|
||||
s32 modeCount;
|
||||
XF86VidModeModeInfo** modes;
|
||||
|
||||
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes);
|
||||
|
||||
// find fitting mode
|
||||
for (s32 i = 0; i<modeCount; ++i)
|
||||
{
|
||||
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
|
||||
bestMode = i;
|
||||
else if (bestMode!=-1 &&
|
||||
modes[i]->hdisplay >= Width &&
|
||||
modes[i]->vdisplay >= Height &&
|
||||
modes[i]->hdisplay < modes[bestMode]->hdisplay &&
|
||||
modes[i]->vdisplay < modes[bestMode]->vdisplay)
|
||||
bestMode = i;
|
||||
}
|
||||
if (bestMode != -1)
|
||||
{
|
||||
os::Printer::log("Starting fullscreen mode...", ELL_INFORMATION);
|
||||
XF86VidModeSwitchToMode(display, screennr, modes[bestMode]);
|
||||
XF86VidModeSetViewPort(display, screennr, 0, 0);
|
||||
UseXVidMode=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Could not find specified video mode, running windowed.", ELL_WARNING);
|
||||
CreationParams.Fullscreen = false;
|
||||
}
|
||||
|
||||
XFree(modes);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef _IRR_LINUX_X11_RANDR_
|
||||
if (XRRQueryExtension(display, &eventbase, &errorbase))
|
||||
{
|
||||
s32 modeCount;
|
||||
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display));
|
||||
XRRScreenSize *modes=XRRConfigSizes(config,&modeCount);
|
||||
for (s32 i = 0; i<modeCount; ++i)
|
||||
{
|
||||
if (bestMode==-1 && (u32)modes[i].width >= Width && (u32)modes[i].height >= Height)
|
||||
bestMode = i;
|
||||
else if (bestMode!=-1 &&
|
||||
(u32)modes[i].width >= Width &&
|
||||
(u32)modes[i].height >= Height &&
|
||||
modes[i].width < modes[bestMode].width &&
|
||||
modes[i].height < modes[bestMode].height)
|
||||
bestMode = i;
|
||||
}
|
||||
if (bestMode != -1)
|
||||
{
|
||||
XRRSetScreenConfig(display,config,DefaultRootWindow(display),bestMode,oldRandrRotation,CurrentTime);
|
||||
UseXRandR=true;
|
||||
}
|
||||
XRRFreeScreenConfigInfo(config);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
os::Printer::log("VidMode or RandR extension must be installed to allow Irrlicht "
|
||||
"to switch to fullscreen mode. Running in windowed mode instead.", ELL_WARNING);
|
||||
CreationParams.Fullscreen = false;
|
||||
}
|
||||
return CreationParams.Fullscreen;
|
||||
}
|
||||
|
||||
|
||||
bool CIrrDeviceLinux::createWindow()
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_X11_
|
||||
|
@ -228,86 +326,7 @@ bool CIrrDeviceLinux::createWindow()
|
|||
|
||||
screennr = DefaultScreen(display);
|
||||
|
||||
// query extension
|
||||
|
||||
if (CreationParams.Fullscreen)
|
||||
{
|
||||
getVideoModeList();
|
||||
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
|
||||
s32 eventbase, errorbase;
|
||||
s32 bestMode = -1;
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
||||
if (XF86VidModeQueryExtension(display, &eventbase, &errorbase))
|
||||
{
|
||||
// enumerate video modes
|
||||
s32 modeCount;
|
||||
XF86VidModeModeInfo** modes;
|
||||
|
||||
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes);
|
||||
|
||||
// find fitting mode
|
||||
for (s32 i = 0; i<modeCount; ++i)
|
||||
{
|
||||
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
|
||||
bestMode = i;
|
||||
else if (bestMode!=-1 &&
|
||||
modes[i]->hdisplay >= Width &&
|
||||
modes[i]->vdisplay >= Height &&
|
||||
modes[i]->hdisplay < modes[bestMode]->hdisplay &&
|
||||
modes[i]->vdisplay < modes[bestMode]->vdisplay)
|
||||
bestMode = i;
|
||||
}
|
||||
if (bestMode != -1)
|
||||
{
|
||||
os::Printer::log("Starting fullscreen mode...", ELL_INFORMATION);
|
||||
XF86VidModeSwitchToMode(display, screennr, modes[bestMode]);
|
||||
XF86VidModeSetViewPort(display, screennr, 0, 0);
|
||||
UseXVidMode=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Could not find specified video mode, running windowed.", ELL_WARNING);
|
||||
CreationParams.Fullscreen = false;
|
||||
}
|
||||
|
||||
XFree(modes);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef _IRR_LINUX_X11_RANDR_
|
||||
if (XRRQueryExtension(display, &eventbase, &errorbase))
|
||||
{
|
||||
s32 modeCount;
|
||||
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display));
|
||||
XRRScreenSize *modes=XRRConfigSizes(config,&modeCount);
|
||||
for (s32 i = 0; i<modeCount; ++i)
|
||||
{
|
||||
if (bestMode==-1 && (u32)modes[i].width >= Width && (u32)modes[i].height >= Height)
|
||||
bestMode = i;
|
||||
else if (bestMode!=-1 &&
|
||||
(u32)modes[i].width >= Width &&
|
||||
(u32)modes[i].height >= Height &&
|
||||
modes[i].width < modes[bestMode].width &&
|
||||
modes[i].height < modes[bestMode].height)
|
||||
bestMode = i;
|
||||
}
|
||||
if (bestMode != -1)
|
||||
{
|
||||
XRRSetScreenConfig(display,config,DefaultRootWindow(display),bestMode,oldRandrRotation,CurrentTime);
|
||||
UseXRandR=true;
|
||||
}
|
||||
XRRFreeScreenConfigInfo(config);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
os::Printer::log("VidMode or RandR extension must be installed to allow Irrlicht "
|
||||
"to switch to fullscreen mode. Running in windowed mode instead.", ELL_WARNING);
|
||||
CreationParams.Fullscreen = false;
|
||||
}
|
||||
}
|
||||
switchToFullscreen();
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
|
@ -563,7 +582,7 @@ bool CIrrDeviceLinux::createWindow()
|
|||
|
||||
attributes.colormap = colormap;
|
||||
attributes.border_pixel = 0;
|
||||
attributes.event_mask = StructureNotifyMask | FocusChangeMask;
|
||||
attributes.event_mask = StructureNotifyMask | FocusChangeMask | ExposureMask;
|
||||
if (!CreationParams.IgnoreInput)
|
||||
attributes.event_mask |= PointerMotionMask |
|
||||
ButtonPressMask | KeyPressMask |
|
||||
|
@ -571,44 +590,27 @@ bool CIrrDeviceLinux::createWindow()
|
|||
|
||||
if (!CreationParams.WindowId)
|
||||
{
|
||||
// create Window, either for Fullscreen or windowed mode
|
||||
// create new Window
|
||||
// Remove window manager decoration in fullscreen
|
||||
attributes.override_redirect = CreationParams.Fullscreen;
|
||||
window = XCreateWindow(display,
|
||||
RootWindow(display, visual->screen),
|
||||
0, 0, Width, Height, 0, visual->depth,
|
||||
InputOutput, visual->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
|
||||
&attributes);
|
||||
XMapRaised(display, window);
|
||||
CreationParams.WindowId = (void*)window;
|
||||
Atom wmDelete;
|
||||
wmDelete = XInternAtom(display, wmDeleteWindow, True);
|
||||
XSetWMProtocols(display, window, &wmDelete, 1);
|
||||
if (CreationParams.Fullscreen)
|
||||
{
|
||||
attributes.override_redirect = True;
|
||||
|
||||
window = XCreateWindow(display,
|
||||
RootWindow(display, visual->screen),
|
||||
0, 0, Width, Height, 0, visual->depth,
|
||||
InputOutput, visual->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
|
||||
&attributes);
|
||||
CreationParams.WindowId = (void*)window;
|
||||
|
||||
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0);
|
||||
XMapRaised(display, window);
|
||||
XGrabKeyboard(display, window, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
XGrabPointer(display, window, True, ButtonPressMask,
|
||||
GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
|
||||
}
|
||||
else
|
||||
{ // we want windowed mode
|
||||
attributes.event_mask |= ExposureMask;
|
||||
attributes.event_mask |= FocusChangeMask;
|
||||
|
||||
window = XCreateWindow(display,
|
||||
RootWindow(display, visual->screen),
|
||||
0, 0, Width, Height, 0, visual->depth,
|
||||
InputOutput, visual->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask,
|
||||
&attributes);
|
||||
|
||||
CreationParams.WindowId = (void*)window;
|
||||
|
||||
Atom wmDelete;
|
||||
wmDelete = XInternAtom(display, wmDeleteWindow, True);
|
||||
XSetWMProtocols(display, window, &wmDelete, 1);
|
||||
XMapRaised(display, window);
|
||||
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1558,15 +1560,26 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
|||
devName = "/dev/input/js";
|
||||
devName += joystick;
|
||||
info.fd = open(devName.c_str(), O_RDONLY);
|
||||
if(-1 == info.fd)
|
||||
{
|
||||
// and BSD here
|
||||
devName = "/dev/joy";
|
||||
devName += joystick;
|
||||
info.fd = open(devName.c_str(), O_RDONLY);
|
||||
}
|
||||
}
|
||||
|
||||
if(-1 == info.fd)
|
||||
continue;
|
||||
|
||||
#ifdef __FREE_BSD_
|
||||
info.axes=2;
|
||||
info.buttons=2;
|
||||
#else
|
||||
ioctl( info.fd, JSIOCGAXES, &(info.axes) );
|
||||
ioctl( info.fd, JSIOCGBUTTONS, &(info.buttons) );
|
||||
|
||||
fcntl( info.fd, F_SETFL, O_NONBLOCK );
|
||||
#endif
|
||||
|
||||
(void)memset(&info.persistentData, 0, sizeof(info.persistentData));
|
||||
info.persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
|
||||
|
@ -1583,9 +1596,11 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
|||
returnInfo.Axes = info.axes;
|
||||
returnInfo.Buttons = info.buttons;
|
||||
|
||||
#ifndef __FREE_BSD_
|
||||
char name[80];
|
||||
ioctl( info.fd, JSIOCGNAME(80), name);
|
||||
returnInfo.Name = name;
|
||||
#endif
|
||||
|
||||
joystickInfo.push_back(returnInfo);
|
||||
}
|
||||
|
@ -1612,11 +1627,19 @@ void CIrrDeviceLinux::pollJoysticks()
|
|||
if(0 == ActiveJoysticks.size())
|
||||
return;
|
||||
|
||||
u32 joystick;
|
||||
for(joystick = 0; joystick < ActiveJoysticks.size(); ++joystick)
|
||||
u32 j;
|
||||
for(j= 0; j< ActiveJoysticks.size(); ++j)
|
||||
{
|
||||
JoystickInfo & info = ActiveJoysticks[joystick];
|
||||
JoystickInfo & info = ActiveJoysticks[j];
|
||||
|
||||
#ifdef __FREE_BSD_
|
||||
struct joystick js;
|
||||
if( read( info.fd, &js, JS_RETURN ) == JS_RETURN )
|
||||
{
|
||||
info.persistentData.JoystickEvent.ButtonStates = js.buttons; /* should be a two-bit field */
|
||||
info.persistentData.JoystickEvent.Axis[0] = js.x; /* X axis */
|
||||
info.persistentData.JoystickEvent.Axis[1] = js.y; /* Y axis */
|
||||
#else
|
||||
struct js_event event;
|
||||
while(sizeof(event) == read(info.fd, &event, sizeof(event)))
|
||||
{
|
||||
|
@ -1637,6 +1660,7 @@ void CIrrDeviceLinux::pollJoysticks()
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Send an irrlicht joystick event once per ::run() even if no new data were received.
|
||||
(void)postEventFromUser(info.persistentData);
|
||||
|
|
|
@ -135,6 +135,8 @@ namespace irr
|
|||
|
||||
void initXAtoms();
|
||||
|
||||
bool switchToFullscreen(bool reset=false);
|
||||
|
||||
//! Implementation of the linux cursor control
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
{
|
||||
|
@ -354,7 +356,6 @@ namespace irr
|
|||
#endif
|
||||
#endif
|
||||
u32 Width, Height;
|
||||
bool Close;
|
||||
bool WindowHasFocus;
|
||||
bool WindowMinimized;
|
||||
bool UseXVidMode;
|
||||
|
|
|
@ -59,8 +59,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
|||
Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_ANYFORMAT),
|
||||
MouseX(0), MouseY(0), MouseButtonStates(0),
|
||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||
Close(0), Resizable(false),
|
||||
WindowHasFocus(false), WindowMinimized(false)
|
||||
Resizable(false), WindowHasFocus(false), WindowMinimized(false)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceSDL");
|
||||
|
@ -75,7 +74,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
|||
SDL_INIT_NOPARACHUTE ) < 0)
|
||||
{
|
||||
os::Printer::log( "Unable to initialize SDL!", SDL_GetError());
|
||||
Close = 1;
|
||||
Close = true;
|
||||
}
|
||||
|
||||
#if defined(_IRR_WINDOWS_)
|
||||
|
|
|
@ -203,7 +203,6 @@ namespace irr
|
|||
|
||||
u32 Width, Height;
|
||||
|
||||
bool Close;
|
||||
bool Resizable;
|
||||
bool WindowHasFocus;
|
||||
bool WindowMinimized;
|
||||
|
|
|
@ -19,7 +19,8 @@ namespace irr
|
|||
CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
||||
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
||||
Timer(0), CursorControl(0), UserReceiver(params.EventReceiver), Logger(0), Operator(0),
|
||||
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params)
|
||||
FileSystem(0), InputReceivingSceneManager(0), CreationParams(params),
|
||||
Close(false)
|
||||
{
|
||||
Timer = new CTimer();
|
||||
if (os::Printer::Logger)
|
||||
|
|
|
@ -147,8 +147,6 @@ namespace irr
|
|||
IOSOperator* Operator;
|
||||
io::IFileSystem* FileSystem;
|
||||
scene::ISceneManager* InputReceivingSceneManager;
|
||||
video::CVideoModeList VideoModeList;
|
||||
SIrrlichtCreationParameters CreationParams;
|
||||
|
||||
struct SMouseMultiClicks
|
||||
{
|
||||
|
@ -162,6 +160,9 @@ namespace irr
|
|||
core::position2di LastClick;
|
||||
};
|
||||
SMouseMultiClicks MouseMultiClicks;
|
||||
video::CVideoModeList VideoModeList;
|
||||
SIrrlichtCreationParameters CreationParams;
|
||||
bool Close;
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
|
|
@ -258,6 +258,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return 0;
|
||||
break;
|
||||
|
||||
case WM_ACTIVATE:
|
||||
// we need to take care for screen changes, e.g. Alt-Tab
|
||||
dev = getDeviceFromHWnd(hWnd);
|
||||
if (dev)
|
||||
{
|
||||
if ((wParam&0xFF)==WA_INACTIVE)
|
||||
dev->switchToFullScreen(true);
|
||||
else
|
||||
dev->switchToFullScreen();
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_USER:
|
||||
event.EventType = irr::EET_USER_EVENT;
|
||||
event.UserEvent.UserData1 = (irr::s32)wParam;
|
||||
|
@ -298,17 +310,17 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
|||
// create the window if we need to and we do not use the null device
|
||||
if (!CreationParams.WindowId && CreationParams.DriverType != video::EDT_NULL)
|
||||
{
|
||||
const c8* ClassName = "CIrrDeviceWin32";
|
||||
const fschar_t* ClassName = __TEXT("CIrrDeviceWin32");
|
||||
|
||||
// Register Class
|
||||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = NULL;
|
||||
wcex.hIcon = NULL;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = 0;
|
||||
|
@ -316,7 +328,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
|||
wcex.hIconSm = 0;
|
||||
|
||||
// if there is an icon, load it
|
||||
wcex.hIcon = (HICON)LoadImage(hInstance, "irrlicht.ico", IMAGE_ICON, 0,0, LR_LOADFROMFILE);
|
||||
wcex.hIcon = (HICON)LoadImage(hInstance, __TEXT("irrlicht.ico"), IMAGE_ICON, 0,0, LR_LOADFROMFILE);
|
||||
|
||||
RegisterClassEx(&wcex);
|
||||
|
||||
|
@ -349,7 +361,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
|||
|
||||
// create window
|
||||
|
||||
HWnd = CreateWindow( ClassName, "", style, windowLeft, windowTop,
|
||||
HWnd = CreateWindow( ClassName, __TEXT(""), style, windowLeft, windowTop,
|
||||
realWidth, realHeight, NULL, NULL, hInstance, NULL);
|
||||
CreationParams.WindowId = HWnd;
|
||||
|
||||
|
@ -414,8 +426,7 @@ CIrrDeviceWin32::~CIrrDeviceWin32()
|
|||
}
|
||||
}
|
||||
|
||||
if (ChangedToFullScreen)
|
||||
ChangeDisplaySettings(NULL,0);
|
||||
switchToFullScreen(true);
|
||||
}
|
||||
|
||||
|
||||
|
@ -463,9 +474,7 @@ void CIrrDeviceWin32::createDriver()
|
|||
case video::EDT_OPENGL:
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
if (CreationParams.Fullscreen)
|
||||
switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
|
||||
switchToFullScreen();
|
||||
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||
if (!VideoDriver)
|
||||
|
@ -501,8 +510,7 @@ void CIrrDeviceWin32::createDriver()
|
|||
case video::EDT_SOFTWARE:
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
||||
if (CreationParams.Fullscreen)
|
||||
switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
|
||||
switchToFullScreen();
|
||||
|
||||
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
||||
#else
|
||||
|
@ -513,8 +521,7 @@ void CIrrDeviceWin32::createDriver()
|
|||
|
||||
case video::EDT_BURNINGSVIDEO:
|
||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||
if (CreationParams.Fullscreen)
|
||||
switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
|
||||
switchToFullScreen();
|
||||
|
||||
VideoDriver = video::createSoftwareDriver2(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
||||
#else
|
||||
|
@ -541,8 +548,6 @@ bool CIrrDeviceWin32::run()
|
|||
|
||||
MSG msg;
|
||||
|
||||
bool quit = false;
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
|
@ -553,17 +558,17 @@ bool CIrrDeviceWin32::run()
|
|||
DispatchMessage(&msg);
|
||||
|
||||
if (msg.message == WM_QUIT)
|
||||
quit = true;
|
||||
Close = true;
|
||||
}
|
||||
|
||||
if (!quit)
|
||||
if (!Close)
|
||||
resizeIfNecessary();
|
||||
|
||||
if(!quit)
|
||||
if(!Close)
|
||||
pollJoysticks();
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return !quit;
|
||||
return !Close;
|
||||
}
|
||||
|
||||
|
||||
|
@ -701,6 +706,7 @@ void CIrrDeviceWin32::closeDevice()
|
|||
PostQuitMessage(0);
|
||||
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
||||
DestroyWindow(HWnd);
|
||||
Close=true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -735,16 +741,26 @@ bool CIrrDeviceWin32::isWindowMinimized() const
|
|||
|
||||
|
||||
//! switches to fullscreen
|
||||
bool CIrrDeviceWin32::switchToFullScreen(s32 width, s32 height, s32 bits)
|
||||
bool CIrrDeviceWin32::switchToFullScreen(bool reset)
|
||||
{
|
||||
if (!CreationParams.Fullscreen)
|
||||
return true;
|
||||
if (reset)
|
||||
{
|
||||
if (ChangedToFullScreen)
|
||||
return (ChangeDisplaySettings(NULL,0)==DISP_CHANGE_SUCCESSFUL);
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
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.dmPelsWidth = CreationParams.WindowSize.Width;
|
||||
dm.dmPelsHeight = CreationParams.WindowSize.Height;
|
||||
dm.dmBitsPerPel = CreationParams.Bits;
|
||||
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
||||
|
||||
LONG res = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
|
||||
|
@ -881,17 +897,17 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
|||
DWORD dwBufLen;
|
||||
|
||||
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
|
||||
__TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
|
||||
0, KEY_QUERY_VALUE, &hKey );
|
||||
RegQueryValueEx( hKey, "ProductType", NULL, NULL,
|
||||
RegQueryValueEx( hKey, __TEXT("ProductType"), NULL, NULL,
|
||||
(LPBYTE) szProductType, &dwBufLen);
|
||||
RegCloseKey( hKey );
|
||||
|
||||
if (lstrcmpi( "WINNT", szProductType) == 0 )
|
||||
if (_strcmpi( "WINNT", szProductType) == 0 )
|
||||
out.append("Professional ");
|
||||
if (lstrcmpi( "LANMANNT", szProductType) == 0)
|
||||
if (_strcmpi( "LANMANNT", szProductType) == 0)
|
||||
out.append("Server ");
|
||||
if (lstrcmpi( "SERVERNT", szProductType) == 0)
|
||||
if (_strcmpi( "SERVERNT", szProductType) == 0)
|
||||
out.append("Advanced Server ");
|
||||
}
|
||||
|
||||
|
|
|
@ -101,14 +101,18 @@ namespace irr
|
|||
return CIrrDeviceStub::checkSuccessiveClicks(mouseX, mouseY);
|
||||
}
|
||||
|
||||
//! switchs to fullscreen
|
||||
bool switchToFullScreen(bool reset=false);
|
||||
|
||||
//! Implementation of the win32 cursor control
|
||||
class CCursorControl : public gui::ICursorControl
|
||||
{
|
||||
public:
|
||||
|
||||
CCursorControl(const core::dimension2d<u32>& wsize, HWND hwnd, bool fullscreen)
|
||||
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f), IsVisible(true),
|
||||
HWnd(hwnd), BorderX(0), BorderY(0), UseReferenceRect(false)
|
||||
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f),
|
||||
HWnd(hwnd), BorderX(0), BorderY(0),
|
||||
UseReferenceRect(false), IsVisible(true)
|
||||
{
|
||||
if (WindowSize.Width!=0)
|
||||
InvWindowSize.Width = 1.0f / WindowSize.Width;
|
||||
|
@ -172,9 +176,9 @@ namespace irr
|
|||
virtual void setPosition(f32 x, f32 y)
|
||||
{
|
||||
if (!UseReferenceRect)
|
||||
setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height));
|
||||
setPosition(core::round32(x*WindowSize.Width), core::round32(y*WindowSize.Height));
|
||||
else
|
||||
setPosition((s32)(x*ReferenceRect.getWidth()), (s32)(y*ReferenceRect.getHeight()));
|
||||
setPosition(core::round32(x*ReferenceRect.getWidth()), core::round32(y*ReferenceRect.getHeight()));
|
||||
}
|
||||
|
||||
//! Sets the new position of the cursor.
|
||||
|
@ -247,6 +251,7 @@ namespace irr
|
|||
/** Used to notify the cursor that the window was resized. */
|
||||
virtual void OnResize(const core::dimension2d<u32>& size)
|
||||
{
|
||||
WindowSize = size;
|
||||
if (size.Width!=0)
|
||||
InvWindowSize.Width = 1.0f / size.Width;
|
||||
else
|
||||
|
@ -297,12 +302,12 @@ namespace irr
|
|||
core::position2d<s32> CursorPos;
|
||||
core::dimension2d<u32> WindowSize;
|
||||
core::dimension2d<f32> InvWindowSize;
|
||||
bool IsVisible;
|
||||
HWND HWnd;
|
||||
|
||||
s32 BorderX, BorderY;
|
||||
bool UseReferenceRect;
|
||||
core::rect<s32> ReferenceRect;
|
||||
bool UseReferenceRect;
|
||||
bool IsVisible;
|
||||
};
|
||||
|
||||
//! returns the win32 cursor control
|
||||
|
@ -313,9 +318,6 @@ namespace irr
|
|||
//! create the driver
|
||||
void createDriver();
|
||||
|
||||
//! switchs to fullscreen
|
||||
bool switchToFullScreen(s32 width, s32 height, s32 bits);
|
||||
|
||||
void getWindowsVersion(core::stringc& version);
|
||||
|
||||
void resizeIfNecessary();
|
||||
|
@ -344,4 +346,3 @@ namespace irr
|
|||
|
||||
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
#endif // __C_IRR_DEVICE_WIN32_H_INCLUDED__
|
||||
|
||||
|
|
|
@ -552,8 +552,6 @@ bool CIrrDeviceWinCE::run()
|
|||
|
||||
MSG msg;
|
||||
|
||||
bool quit = false;
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
|
@ -564,14 +562,14 @@ bool CIrrDeviceWinCE::run()
|
|||
DispatchMessage(&msg);
|
||||
|
||||
if (msg.message == WM_QUIT)
|
||||
quit = true;
|
||||
Close = true;
|
||||
}
|
||||
|
||||
if (!quit)
|
||||
if (!Close)
|
||||
resizeIfNecessary();
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return !quit;
|
||||
return !Close;
|
||||
}
|
||||
|
||||
|
||||
|
@ -713,6 +711,7 @@ void CIrrDeviceWinCE::closeDevice()
|
|||
PostQuitMessage(0);
|
||||
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
||||
DestroyWindow(HWnd);
|
||||
Close=true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,8 +90,9 @@ namespace irr
|
|||
public:
|
||||
|
||||
CCursorControl(const core::dimension2d<u32>& wsize, HWND hwnd, bool fullscreen)
|
||||
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f), IsVisible(true),
|
||||
HWnd(hwnd), BorderX(0), BorderY(0), UseReferenceRect(false)
|
||||
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f),
|
||||
HWnd(hwnd), BorderX(0), BorderY(0),
|
||||
UseReferenceRect(false), IsVisible(true)
|
||||
{
|
||||
if (WindowSize.Width!=0)
|
||||
InvWindowSize.Width = 1.0f / WindowSize.Width;
|
||||
|
@ -129,9 +130,9 @@ namespace irr
|
|||
virtual void setPosition(f32 x, f32 y)
|
||||
{
|
||||
if (!UseReferenceRect)
|
||||
setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height));
|
||||
setPosition(core::round32(x*WindowSize.Width), core::round32(y*WindowSize.Height));
|
||||
else
|
||||
setPosition((s32)(x*ReferenceRect.getWidth()), (s32)(y*ReferenceRect.getHeight()));
|
||||
setPosition(core::round32(x*ReferenceRect.getWidth()), core::round32(y*ReferenceRect.getHeight()));
|
||||
}
|
||||
|
||||
//! Sets the new position of the cursor.
|
||||
|
@ -205,6 +206,7 @@ namespace irr
|
|||
/** Used to notify the cursor that the window was resized. */
|
||||
virtual void OnResize(const core::dimension2d<u32>& size)
|
||||
{
|
||||
WindowSize = size;
|
||||
if (size.Width!=0)
|
||||
InvWindowSize.Width = 1.0f / size.Width;
|
||||
else
|
||||
|
@ -255,12 +257,12 @@ namespace irr
|
|||
core::position2d<s32> CursorPos;
|
||||
core::dimension2d<s32> WindowSize;
|
||||
core::dimension2d<f32> InvWindowSize;
|
||||
bool IsVisible;
|
||||
HWND HWnd;
|
||||
|
||||
s32 BorderX, BorderY;
|
||||
bool UseReferenceRect;
|
||||
core::rect<s32> ReferenceRect;
|
||||
bool UseReferenceRect;
|
||||
bool IsVisible;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -217,6 +217,7 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
const u16 uvTag = Materials[tag]->Texture[0].UVTag;
|
||||
const u16 duvTag = Materials[tag]->Texture[0].DUVTag;
|
||||
video::S3DVertex vertex;
|
||||
vertex.Color=0xffffffff;
|
||||
const u32 vertCount=mb->Vertices.size();
|
||||
for (u32 i=0; i<polySize; ++i)
|
||||
{
|
||||
|
@ -267,7 +268,11 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
os::Printer::log("LWO loader: Vertex count", core::stringc(Materials[i]->Meshbuffer->Vertices.size()));
|
||||
#endif
|
||||
if (!Materials[i]->Meshbuffer->Vertices.size())
|
||||
{
|
||||
Materials[i]->Meshbuffer->drop();
|
||||
delete Materials[i];
|
||||
continue;
|
||||
}
|
||||
for (u32 j=0; j<Materials[i]->Meshbuffer->Vertices.size(); ++j)
|
||||
Materials[i]->Meshbuffer->Vertices[j].Color=Materials[i]->Meshbuffer->Material.DiffuseColor;
|
||||
Materials[i]->Meshbuffer->recalculateBoundingBox();
|
||||
|
@ -343,17 +348,17 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
}
|
||||
}
|
||||
// get the resolution for this axis
|
||||
f32 resolutionS = 1.f/Materials[i]->Texture[0].Size.Z;
|
||||
f32 resolutionT = 1.f/Materials[i]->Texture[0].Size.Y;
|
||||
f32 resolutionS = core::reciprocal(Materials[i]->Texture[0].Size.Z);
|
||||
f32 resolutionT = core::reciprocal(Materials[i]->Texture[0].Size.Y);
|
||||
if (Materials[i]->Texture[0].Axis==1)
|
||||
{
|
||||
resolutionS = 1.f/Materials[i]->Texture[0].Size.X;
|
||||
resolutionT = 1.f/Materials[i]->Texture[0].Size.Z;
|
||||
resolutionS = core::reciprocal(Materials[i]->Texture[0].Size.X);
|
||||
resolutionT = core::reciprocal(Materials[i]->Texture[0].Size.Z);
|
||||
}
|
||||
else if (Materials[i]->Texture[0].Axis==2)
|
||||
{
|
||||
resolutionS = 1.f/Materials[i]->Texture[0].Size.X;
|
||||
resolutionT = 1.f/Materials[i]->Texture[0].Size.Y;
|
||||
resolutionS = core::reciprocal(Materials[i]->Texture[0].Size.X);
|
||||
resolutionT = core::reciprocal(Materials[i]->Texture[0].Size.Y);
|
||||
}
|
||||
// use the two-way planar mapping
|
||||
SceneManager->getMeshManipulator()->makePlanarTextureMapping(Materials[i]->Meshbuffer, resolutionS, resolutionT, Materials[i]->Texture[0].Axis, Materials[i]->Texture[0].Center);
|
||||
|
@ -362,17 +367,19 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
// add bump maps
|
||||
if (Materials[i]->Meshbuffer->Material.MaterialType==video::EMT_NORMAL_MAP_SOLID)
|
||||
{
|
||||
SMesh tmpmesh;
|
||||
tmpmesh.addMeshBuffer(Materials[i]->Meshbuffer);
|
||||
SceneManager->getMeshManipulator()->createMeshWithTangents(&tmpmesh, true, true);
|
||||
Mesh->addMeshBuffer(tmpmesh.getMeshBuffer(0));
|
||||
SMesh* tmpmesh = new SMesh();
|
||||
tmpmesh->addMeshBuffer(Materials[i]->Meshbuffer);
|
||||
SceneManager->getMeshManipulator()->createMeshWithTangents(tmpmesh, true, true);
|
||||
Mesh->addMeshBuffer(tmpmesh->getMeshBuffer(0));
|
||||
tmpmesh->getMeshBuffer(0)->drop();
|
||||
tmpmesh->drop();
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneManager->getMeshManipulator()->recalculateNormals(Materials[i]->Meshbuffer);
|
||||
Mesh->addMeshBuffer(Materials[i]->Meshbuffer);
|
||||
}
|
||||
Mesh->getMeshBuffer(Mesh->getMeshBufferCount()-1)->drop();
|
||||
Materials[i]->Meshbuffer->drop();
|
||||
// clear the material array elements
|
||||
delete Materials[i];
|
||||
}
|
||||
|
@ -607,6 +614,7 @@ void CLWOMeshFileLoader::readObj1(u32 size)
|
|||
u16 numVerts, vertIndex;
|
||||
s16 material;
|
||||
video::S3DVertex vertex;
|
||||
vertex.Color=0xffffffff;
|
||||
|
||||
while (size!=0)
|
||||
{
|
||||
|
|
|
@ -909,9 +909,9 @@ IMesh* CMeshManipulator::createMeshWithTangents(IMesh* mesh, bool recalculateNor
|
|||
v[idx[i+2]].TCoords);
|
||||
|
||||
if (recalculateNormals)
|
||||
v[idx[i+0]].Tangent += localTangent * weight.X;
|
||||
v[idx[i+0]].Normal += localNormal * weight.X;
|
||||
v[idx[i+0]].Tangent += localTangent * weight.X;
|
||||
v[idx[i+0]].Binormal += localBinormal * weight.X;
|
||||
v[idx[i+0]].Normal += localNormal * weight.X;
|
||||
|
||||
calculateTangents(
|
||||
localNormal,
|
||||
|
@ -925,9 +925,9 @@ IMesh* CMeshManipulator::createMeshWithTangents(IMesh* mesh, bool recalculateNor
|
|||
v[idx[i+0]].TCoords);
|
||||
|
||||
if (recalculateNormals)
|
||||
v[idx[i+1]].Tangent += localTangent * weight.Y;
|
||||
v[idx[i+1]].Normal += localNormal * weight.Y;
|
||||
v[idx[i+1]].Tangent += localTangent * weight.Y;
|
||||
v[idx[i+1]].Binormal += localBinormal * weight.Y;
|
||||
v[idx[i+1]].Normal += localNormal * weight.Y;
|
||||
|
||||
calculateTangents(
|
||||
localNormal,
|
||||
|
@ -941,9 +941,9 @@ IMesh* CMeshManipulator::createMeshWithTangents(IMesh* mesh, bool recalculateNor
|
|||
v[idx[i+1]].TCoords);
|
||||
|
||||
if (recalculateNormals)
|
||||
v[idx[i+2]].Tangent += localTangent * weight.Z;
|
||||
v[idx[i+2]].Normal += localNormal * weight.Z;
|
||||
v[idx[i+2]].Tangent += localTangent * weight.Z;
|
||||
v[idx[i+2]].Binormal += localBinormal * weight.Z;
|
||||
v[idx[i+2]].Normal += localNormal * weight.Z;
|
||||
}
|
||||
|
||||
// Normalize the tangents and binormals
|
||||
|
@ -1104,7 +1104,6 @@ IMesh* CMeshManipulator::createMeshWith1TCoords(IMesh* mesh) const
|
|||
|
||||
SMeshBuffer* buffer = new SMeshBuffer();
|
||||
buffer->Material = mesh->getMeshBuffer(b)->getMaterial();
|
||||
buffer->Material.MaterialType = video::EMT_SOLID;
|
||||
|
||||
// copy vertices
|
||||
|
||||
|
|
|
@ -178,6 +178,7 @@ void CMeshSceneNode::render()
|
|||
{
|
||||
video::SMaterial m;
|
||||
m.Lighting = false;
|
||||
m.AntiAliasing=0;
|
||||
driver->setMaterial(m);
|
||||
|
||||
if (DebugDataVisible & scene::EDS_BBOX)
|
||||
|
|
|
@ -585,56 +585,6 @@ void CNullDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCoun
|
|||
}
|
||||
|
||||
|
||||
//! draws an indexed triangle list
|
||||
void CNullDriver::drawIndexedTriangleList(const S3DVertex* vertices, u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
//! draws an indexed triangle list
|
||||
void CNullDriver::drawIndexedTriangleList(const S3DVertex2TCoords* vertices, u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
//! Draws an indexed triangle list.
|
||||
void CNullDriver::drawIndexedTriangleList(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
void CNullDriver::drawIndexedTriangleFan(const S3DVertex* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
void CNullDriver::drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
void CNullDriver::drawIndexedTriangleFan(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||
{
|
||||
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLE_FAN, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Draws a 3d line.
|
||||
void CNullDriver::draw3DLine(const core::vector3df& start,
|
||||
const core::vector3df& end, SColor color)
|
||||
|
@ -642,17 +592,27 @@ void CNullDriver::draw3DLine(const core::vector3df& start,
|
|||
}
|
||||
|
||||
|
||||
|
||||
//! Draws a 3d triangle.
|
||||
void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color)
|
||||
{
|
||||
draw3DLine(triangle.pointA, triangle.pointB, color);
|
||||
draw3DLine(triangle.pointB, triangle.pointC, color);
|
||||
draw3DLine(triangle.pointC, triangle.pointA, color);
|
||||
S3DVertex vertices[3];
|
||||
vertices[0].Pos=triangle.pointA;
|
||||
vertices[0].Color=color;
|
||||
vertices[0].Normal=triangle.getNormal().normalize();
|
||||
vertices[0].TCoords.set(0.f,0.f);
|
||||
vertices[1].Pos=triangle.pointB;
|
||||
vertices[1].Color=color;
|
||||
vertices[1].Normal=vertices[0].Normal;
|
||||
vertices[1].TCoords.set(0.5f,1.f);
|
||||
vertices[2].Pos=triangle.pointC;
|
||||
vertices[2].Color=color;
|
||||
vertices[2].Normal=vertices[0].Normal;
|
||||
vertices[2].TCoords.set(1.f,0.f);
|
||||
const u16 indexList[] = {0,1,2};
|
||||
drawVertexPrimitiveList(vertices, 3, indexList, 1, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! Draws a 3d axis aligned box.
|
||||
void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)
|
||||
{
|
||||
|
@ -1442,6 +1402,18 @@ void CNullDriver::setFog(SColor color, E_FOG_TYPE fogType, f32 start, f32 end,
|
|||
RangeFog = rangeFog;
|
||||
}
|
||||
|
||||
//! Gets the fog mode.
|
||||
void CNullDriver::getFog(SColor& color, E_FOG_TYPE& fogType, f32& start, f32& end,
|
||||
f32& density, bool& pixelFog, bool& rangeFog)
|
||||
{
|
||||
color = FogColor;
|
||||
fogType = FogType;
|
||||
start = FogStart;
|
||||
end = FogEnd;
|
||||
density = FogDensity;
|
||||
pixelFog = PixelFog;
|
||||
rangeFog = RangeFog;
|
||||
}
|
||||
|
||||
//! Draws a mesh buffer
|
||||
void CNullDriver::drawMeshBuffer(const scene::IMeshBuffer* mb)
|
||||
|
@ -2101,5 +2073,12 @@ SOverrideMaterial& CNullDriver::getOverrideMaterial()
|
|||
return OverrideMaterial;
|
||||
}
|
||||
|
||||
|
||||
core::dimension2du CNullDriver::getMaxTextureSize() const
|
||||
{
|
||||
return core::dimension2du(0x10000,0x10000); // maybe large enough
|
||||
}
|
||||
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
|
|
@ -107,34 +107,12 @@ namespace video
|
|||
//! draws a vertex primitive list
|
||||
virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
||||
const void* indexList, u32 primitiveCount,
|
||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
|
||||
E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT);
|
||||
|
||||
//! draws a vertex primitive list in 2d
|
||||
virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
||||
const void* indexList, u32 primitiveCount,
|
||||
E_VERTEX_TYPE vType, scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawIndexedTriangleList(const S3DVertex* vertices, u32 vertexCount, const u16* indexList, u32 triangleCount);
|
||||
|
||||
//! draws an indexed triangle list
|
||||
virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices, u32 vertexCount, const u16* indexList, u32 triangleCount);
|
||||
|
||||
//! Draws an indexed triangle list.
|
||||
virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount);
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
virtual void drawIndexedTriangleFan(const S3DVertex* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount);
|
||||
|
||||
//! Draws an indexed triangle list.
|
||||
virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount);
|
||||
|
||||
//! Draws an indexed triangle fan.
|
||||
virtual void drawIndexedTriangleFan(const S3DVertexTangents* vertices,
|
||||
u32 vertexCount, const u16* indexList, u32 triangleCount);
|
||||
E_VERTEX_TYPE vType=EVT_STANDARD, scene::E_PRIMITIVE_TYPE pType=scene::EPT_TRIANGLES, E_INDEX_TYPE iType=EIT_16BIT);
|
||||
|
||||
//! Draws a 3d line.
|
||||
virtual void draw3DLine(const core::vector3df& start,
|
||||
|
@ -238,6 +216,10 @@ namespace video
|
|||
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
|
||||
bool pixelFog=false, bool rangeFog=false);
|
||||
|
||||
virtual void getFog(SColor& color, E_FOG_TYPE& fogType,
|
||||
f32& start, f32& end, f32& density,
|
||||
bool& pixelFog, bool& rangeFog);
|
||||
|
||||
//! get color format of the current color buffer
|
||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||
|
||||
|
@ -579,6 +561,9 @@ namespace video
|
|||
virtual void setAllowZWriteOnTransparent(bool flag)
|
||||
{ AllowZWriteOnTransparent=flag; }
|
||||
|
||||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const;
|
||||
|
||||
//! deprecated method
|
||||
virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const c8* name=0);
|
||||
|
|
|
@ -423,13 +423,20 @@ const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const buf
|
|||
texname.replace('\\', '/');
|
||||
|
||||
video::ITexture * texture = 0;
|
||||
bool newTexture=false;
|
||||
if (texname.size())
|
||||
{
|
||||
if (FileSystem->existFile(texname))
|
||||
{
|
||||
newTexture = SceneManager->getVideoDriver()->findTexture(texname) == 0;
|
||||
texture = SceneManager->getVideoDriver()->getTexture(texname);
|
||||
}
|
||||
else
|
||||
{
|
||||
newTexture = SceneManager->getVideoDriver()->findTexture(relPath + texname) == 0;
|
||||
// try to read in the relative path, the .obj is loaded from
|
||||
texture = SceneManager->getVideoDriver()->getTexture( relPath + texname );
|
||||
}
|
||||
}
|
||||
if ( texture )
|
||||
{
|
||||
|
@ -437,7 +444,8 @@ const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const buf
|
|||
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
||||
else if (type==1)
|
||||
{
|
||||
SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
|
||||
if (newTexture)
|
||||
SceneManager->getVideoDriver()->makeNormalMapTexture(texture, bumpiness);
|
||||
currMaterial->Meshbuffer->Material.setTexture(1, texture);
|
||||
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
||||
currMaterial->Meshbuffer->Material.MaterialTypeParam=0.035f;
|
||||
|
|
|
@ -132,7 +132,7 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
|||
|
||||
HKEY Key;
|
||||
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
|
||||
__TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"),
|
||||
0, KEY_READ, &Key);
|
||||
|
||||
if(Error != ERROR_SUCCESS)
|
||||
|
@ -140,7 +140,7 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
|||
|
||||
DWORD Speed = 0;
|
||||
DWORD Size = sizeof(Speed);
|
||||
Error = RegQueryValueEx(Key, "~MHz", NULL, NULL, (LPBYTE)&Speed, &Size);
|
||||
Error = RegQueryValueEx(Key, __TEXT("~MHz"), NULL, NULL, (LPBYTE)&Speed, &Size);
|
||||
|
||||
RegCloseKey(Key);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
|
|||
if (AntiAlias > 1)
|
||||
{
|
||||
// Create a window to test antialiasing support
|
||||
const c8* ClassName = "GLCIrrDeviceWin32";
|
||||
const fschar_t* ClassName = __TEXT("GLCIrrDeviceWin32");
|
||||
HINSTANCE lhInstance = GetModuleHandle(0);
|
||||
|
||||
// Register Class
|
||||
|
@ -116,7 +116,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
|
|||
const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
|
||||
const s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2;
|
||||
|
||||
HWND temporary_wnd=CreateWindow(ClassName, "", style, windowLeft, windowTop,
|
||||
HWND temporary_wnd=CreateWindow(ClassName, __TEXT(""), style, windowLeft, windowTop,
|
||||
realWidth, realHeight, NULL, NULL, lhInstance, NULL);
|
||||
|
||||
if (!temporary_wnd)
|
||||
|
@ -1435,7 +1435,17 @@ void COpenGLDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCo
|
|||
|
||||
// draw everything
|
||||
this->setActiveTexture(0, Material.getTexture(0));
|
||||
setRenderStates2DMode(false, (Material.getTexture(0) != 0), false);
|
||||
if (Material.MaterialType==EMT_ONETEXTURE_BLEND)
|
||||
{
|
||||
E_BLEND_FACTOR srcFact;
|
||||
E_BLEND_FACTOR dstFact;
|
||||
E_MODULATE_FUNC modulo;
|
||||
u32 alphaSource;
|
||||
unpack_texureBlendFunc ( srcFact, dstFact, modulo, alphaSource, Material.MaterialTypeParam);
|
||||
setRenderStates2DMode(alphaSource&video::EAS_VERTEX_COLOR, (Material.getTexture(0) != 0), alphaSource&video::EAS_TEXTURE);
|
||||
}
|
||||
else
|
||||
setRenderStates2DMode(Material.MaterialType==EMT_TRANSPARENT_VERTEX_ALPHA, (Material.getTexture(0) != 0), Material.MaterialType==EMT_TRANSPARENT_ALPHA_CHANNEL);
|
||||
|
||||
if (MultiTextureExtension)
|
||||
extGlClientActiveTexture(GL_TEXTURE0_ARB);
|
||||
|
@ -3500,6 +3510,11 @@ void COpenGLDriver::enableClipPlane(u32 index, bool enable)
|
|||
}
|
||||
|
||||
|
||||
core::dimension2du COpenGLDriver::getMaxTextureSize() const
|
||||
{
|
||||
return core::dimension2du(MaxTextureSize, MaxTextureSize);
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
} // end namespace
|
||||
|
||||
|
|
|
@ -315,6 +315,9 @@ namespace video
|
|||
//! Returns the graphics card vendor name.
|
||||
virtual core::stringc getVendorInfo() {return vendorName;}
|
||||
|
||||
//! Returns the maximum texture size supported.
|
||||
virtual core::dimension2du getMaxTextureSize() const;
|
||||
|
||||
ITexture* createDepthTexture(ITexture* texture, bool shared=true);
|
||||
void removeDepthTexture(ITexture* texture);
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ public:
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
u32 getGLBlend ( E_BLEND_FACTOR factor ) const
|
||||
|
@ -405,7 +405,7 @@ public:
|
|||
{
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.5f);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,7 +466,7 @@ public:
|
|||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||
|
||||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD_SIGNED_ARB);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD);
|
||||
else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
||||
|
||||
|
|
|
@ -47,9 +47,6 @@ const char OPENGL_NORMAL_MAP_VSH[] =
|
|||
"PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix.\n"\
|
||||
"TEMP Temp;\n"\
|
||||
"TEMP TempColor;\n"\
|
||||
"TEMP TempNormal;\n"\
|
||||
"TEMP TempTangent;\n"\
|
||||
"TEMP TempBinormal;\n"\
|
||||
"TEMP TempLightVector1;\n"\
|
||||
"TEMP TempLightVector2;\n"\
|
||||
"TEMP TempTransLightV1;\n"\
|
||||
|
@ -63,40 +60,19 @@ const char OPENGL_NORMAL_MAP_VSH[] =
|
|||
"MOV OutPos.z, Temp.z;\n"\
|
||||
"MOV result.fogcoord.x, Temp.z;\n"\
|
||||
"\n"\
|
||||
"# transform normal \n"\
|
||||
"DP3 TempNormal.x, InNormal.x, program.local[0];\n"\
|
||||
"DP3 TempNormal.y, InNormal.y, program.local[1]; \n"\
|
||||
"DP3 TempNormal.z, InNormal.z, program.local[2];\n"\
|
||||
"\n"\
|
||||
"# transform tangent \n"\
|
||||
"DP3 TempTangent.x, InTangent.x, program.local[0];\n"\
|
||||
"DP3 TempTangent.y, InTangent.y, program.local[1]; \n"\
|
||||
"DP3 TempTangent.z, InTangent.z, program.local[2];\n"\
|
||||
"\n"\
|
||||
"# transform binormal \n"\
|
||||
"DP3 TempBinormal.x, InBinormal.x, program.local[0];\n"\
|
||||
"DP3 TempBinormal.y, InBinormal.y, program.local[1]; \n"\
|
||||
"DP3 TempBinormal.z, InBinormal.z, program.local[2];\n"\
|
||||
"\n"\
|
||||
"# vertex into world position \n"\
|
||||
"DP4 Temp.x, InPos, program.local[0];\n"\
|
||||
"DP4 Temp.y, InPos, program.local[1];\n"\
|
||||
"DP4 Temp.z, InPos, program.local[2];\n"\
|
||||
"DP4 Temp.w, InPos, program.local[3];\n"\
|
||||
"\n"\
|
||||
"# vertex - lightpositions \n"\
|
||||
"SUB TempLightVector1, program.local[12], Temp; \n"\
|
||||
"SUB TempLightVector2, program.local[14], Temp; \n"\
|
||||
"SUB TempLightVector1, program.local[12], InPos; \n"\
|
||||
"SUB TempLightVector2, program.local[14], InPos; \n"\
|
||||
"\n"\
|
||||
"# transform the light vector 1 with U, V, W \n"\
|
||||
"DP3 TempTransLightV1.x, TempTangent, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.y, TempBinormal, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.z, TempNormal, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.x, InTangent, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.y, InBinormal, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.z, InNormal, TempLightVector1; \n"\
|
||||
"\n"\
|
||||
"# transform the light vector 2 with U, V, W \n"\
|
||||
"DP3 TempTransLightV2.x, TempTangent, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.y, TempBinormal, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.z, TempNormal, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.x, InTangent, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.y, InBinormal, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.z, InNormal, TempLightVector2; \n"\
|
||||
"\n"\
|
||||
"# normalize light vector 1 \n"\
|
||||
"DP3 TempTransLightV1.w, TempTransLightV1, TempTransLightV1; \n"\
|
||||
|
@ -277,6 +253,10 @@ void COpenGLNormalMapRenderer::OnSetConstants(IMaterialRendererServices* service
|
|||
|
||||
u32 cnt = driver->getDynamicLightCount();
|
||||
|
||||
// Load the inverse world matrix.
|
||||
core::matrix4 invWorldMat;
|
||||
driver->getTransform(video::ETS_WORLD).getInverse(invWorldMat);
|
||||
|
||||
for (u32 i=0; i<2; ++i)
|
||||
{
|
||||
video::SLight light;
|
||||
|
@ -291,6 +271,9 @@ void COpenGLNormalMapRenderer::OnSetConstants(IMaterialRendererServices* service
|
|||
|
||||
light.DiffuseColor.a = 1.0f/(light.Radius*light.Radius); // set attenuation
|
||||
|
||||
// Transform the light by the inverse world matrix to get it into object space.
|
||||
invWorldMat.transformVect(light.Position);
|
||||
|
||||
services->setVertexShaderConstant(
|
||||
reinterpret_cast<const f32*>(&light.Position), 12+(i*2), 1);
|
||||
|
||||
|
|
|
@ -49,9 +49,6 @@ const char OPENGL_PARALLAX_MAP_VSH[] =
|
|||
"PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix.\n"\
|
||||
"TEMP Temp;\n"\
|
||||
"TEMP TempColor;\n"\
|
||||
"TEMP TempNormal;\n"\
|
||||
"TEMP TempTangent;\n"\
|
||||
"TEMP TempBinormal;\n"\
|
||||
"TEMP TempLightVector1;\n"\
|
||||
"TEMP TempLightVector2;\n"\
|
||||
"TEMP TempEyeVector;\n"\
|
||||
|
@ -66,48 +63,27 @@ const char OPENGL_PARALLAX_MAP_VSH[] =
|
|||
"MOV OutPos.z, Temp.z;\n"\
|
||||
"MOV result.fogcoord.x, Temp.z;\n"\
|
||||
"\n"\
|
||||
"# transform normal \n"\
|
||||
"DP3 TempNormal.x, InNormal.x, program.local[0];\n"\
|
||||
"DP3 TempNormal.y, InNormal.y, program.local[1]; \n"\
|
||||
"DP3 TempNormal.z, InNormal.z, program.local[2];\n"\
|
||||
"\n"\
|
||||
"# transform tangent \n"\
|
||||
"DP3 TempTangent.x, InTangent.x, program.local[0];\n"\
|
||||
"DP3 TempTangent.y, InTangent.y, program.local[1]; \n"\
|
||||
"DP3 TempTangent.z, InTangent.z, program.local[2];\n"\
|
||||
"\n"\
|
||||
"# transform binormal \n"\
|
||||
"DP3 TempBinormal.x, InBinormal.x, program.local[0];\n"\
|
||||
"DP3 TempBinormal.y, InBinormal.y, program.local[1]; \n"\
|
||||
"DP3 TempBinormal.z, InBinormal.z, program.local[2];\n"\
|
||||
"\n"\
|
||||
"# vertex into world position \n"\
|
||||
"DP4 Temp.x, InPos, program.local[0];\n"\
|
||||
"DP4 Temp.y, InPos, program.local[1];\n"\
|
||||
"DP4 Temp.z, InPos, program.local[2];\n"\
|
||||
"DP4 Temp.w, InPos, program.local[3];\n"\
|
||||
"\n"\
|
||||
"# vertex - lightpositions \n"\
|
||||
"SUB TempLightVector1, program.local[12], Temp; \n"\
|
||||
"SUB TempLightVector2, program.local[14], Temp; \n"\
|
||||
"SUB TempLightVector1, program.local[12], InPos; \n"\
|
||||
"SUB TempLightVector2, program.local[14], InPos; \n"\
|
||||
"\n"\
|
||||
"# eye vector \n"\
|
||||
"SUB Temp, program.local[16], Temp; \n"\
|
||||
"SUB Temp, program.local[16], InPos; \n"\
|
||||
"\n"\
|
||||
"# transform the light vector 1 with U, V, W \n"\
|
||||
"DP3 TempTransLightV1.x, TempTangent, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.y, TempBinormal, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.z, TempNormal, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.x, InTangent, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.y, InBinormal, TempLightVector1; \n"\
|
||||
"DP3 TempTransLightV1.z, InNormal, TempLightVector1; \n"\
|
||||
"\n"\
|
||||
"# transform the light vector 2 with U, V, W \n"\
|
||||
"DP3 TempTransLightV2.x, TempTangent, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.y, TempBinormal, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.z, TempNormal, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.x, InTangent, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.y, InBinormal, TempLightVector2; \n"\
|
||||
"DP3 TempTransLightV2.z, InNormal, TempLightVector2; \n"\
|
||||
"\n"\
|
||||
"# transform the eye vector with U, V, W \n"\
|
||||
"DP3 TempEyeVector.x, TempTangent, Temp; \n"\
|
||||
"DP3 TempEyeVector.y, TempBinormal, Temp; \n"\
|
||||
"DP3 TempEyeVector.z, TempNormal, Temp; \n"\
|
||||
"DP3 TempEyeVector.x, InTangent, Temp; \n"\
|
||||
"DP3 TempEyeVector.y, InBinormal, Temp; \n"\
|
||||
"DP3 TempEyeVector.z, InNormal, Temp; \n"\
|
||||
"\n"\
|
||||
"# normalize light vector 1 \n"\
|
||||
"DP3 TempTransLightV1.w, TempTransLightV1, TempTransLightV1; \n"\
|
||||
|
@ -311,17 +287,6 @@ void COpenGLParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* servi
|
|||
const core::matrix4& tWorld = driver->getTransform(video::ETS_WORLD).getTransposed();
|
||||
services->setVertexShaderConstant(tWorld.pointer(), 0, 4);
|
||||
|
||||
// The viewpoint is at (0., 0., 0.) in eye space.
|
||||
// Turning this into a vector [0 0 0 1] and multiply it by
|
||||
// the inverse of the view matrix, the resulting vector is the
|
||||
// object space location of the camera.
|
||||
|
||||
f32 floats[4] = {0.0f,0.0f,0.0f,1.0f};
|
||||
core::matrix4 minv(driver->getTransform(video::ETS_VIEW));
|
||||
minv.makeInverse();
|
||||
minv.multiplyWith1x4Matrix(floats);
|
||||
services->setVertexShaderConstant(floats, 16, 1);
|
||||
|
||||
// set transposed worldViewProj matrix
|
||||
core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
|
||||
worldViewProj *= driver->getTransform(video::ETS_VIEW);
|
||||
|
@ -334,6 +299,10 @@ void COpenGLParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* servi
|
|||
|
||||
u32 cnt = driver->getDynamicLightCount();
|
||||
|
||||
// Load the inverse world matrix.
|
||||
core::matrix4 invWorldMat;
|
||||
driver->getTransform(video::ETS_WORLD).getInverse(invWorldMat);
|
||||
|
||||
for (u32 i=0; i<2; ++i)
|
||||
{
|
||||
video::SLight light;
|
||||
|
@ -348,6 +317,9 @@ void COpenGLParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* servi
|
|||
|
||||
light.DiffuseColor.a = 1.0f/(light.Radius*light.Radius); // set attenuation
|
||||
|
||||
// Transform the light by the inverse world matrix to get it into object space.
|
||||
invWorldMat.transformVect(light.Position);
|
||||
|
||||
services->setVertexShaderConstant(
|
||||
reinterpret_cast<const f32*>(&light.Position), 12+(i*2), 1);
|
||||
|
||||
|
@ -355,6 +327,15 @@ void COpenGLParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* servi
|
|||
reinterpret_cast<const f32*>(&light.DiffuseColor), 13+(i*2), 1);
|
||||
}
|
||||
|
||||
// Obtain the view position by transforming 0,0,0 by the inverse view matrix
|
||||
// and then multiply this by the inverse world matrix.
|
||||
core::vector3df viewPos(0.0f, 0.0f, 0.0f);
|
||||
core::matrix4 inverseView;
|
||||
driver->getTransform(video::ETS_VIEW).getInverse(inverseView);
|
||||
inverseView.transformVect(viewPos);
|
||||
invWorldMat.transformVect(viewPos);
|
||||
services->setVertexShaderConstant(reinterpret_cast<const f32*>(&viewPos.X), 16, 1);
|
||||
|
||||
// set scale factor
|
||||
f32 factor = 0.02f; // default value
|
||||
if (CurrentScale != 0.0f)
|
||||
|
|
|
@ -34,7 +34,7 @@ CPLYMeshFileLoader::~CPLYMeshFileLoader()
|
|||
// (we do, but this could be disabled to increase the speed of loading hundreds of meshes)
|
||||
if (Buffer)
|
||||
{
|
||||
delete Buffer;
|
||||
delete [] Buffer;
|
||||
Buffer = 0;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ IAnimatedMesh* CPLYMeshFileLoader::createMesh(io::IReadFile* file)
|
|||
|
||||
|
||||
// free the buffer
|
||||
delete Buffer;
|
||||
delete [] Buffer;
|
||||
Buffer = 0;
|
||||
File->drop();
|
||||
File = 0;
|
||||
|
@ -557,7 +557,7 @@ c8* CPLYMeshFileLoader::getNextLine()
|
|||
|
||||
// begin at the start of the next line
|
||||
c8* pos = StartPointer;
|
||||
while (*pos && pos < EndPointer && *pos != '\r' && *pos != '\n')
|
||||
while (pos < EndPointer && *pos && *pos != '\r' && *pos != '\n')
|
||||
++pos;
|
||||
|
||||
if ( pos < EndPointer && ( *(pos+1) == '\r' || *(pos+1) == '\n') )
|
||||
|
|
|
@ -15,20 +15,34 @@ namespace irr
|
|||
namespace io
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
inline bool isHeaderValid(const SPAKFileHeader& header)
|
||||
{
|
||||
const c8* tag = header.tag;
|
||||
return tag[0] == 'P' &&
|
||||
tag[1] == 'A' &&
|
||||
tag[2] == 'C' &&
|
||||
tag[3] == 'K';
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
||||
//! Constructor
|
||||
CArchiveLoaderPAK::CArchiveLoaderPAK( io::IFileSystem* fs)
|
||||
: FileSystem(fs)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CArchiveLoaderPAK");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//! returns true if the file maybe is able to be loaded by this class
|
||||
bool CArchiveLoaderPAK::isALoadableFileFormat(const io::path& filename) const
|
||||
{
|
||||
return core::hasFileExtension ( filename, "pak" );
|
||||
return core::hasFileExtension(filename, "pak");
|
||||
}
|
||||
|
||||
//! Check to see if the loader can create archives of this type.
|
||||
|
@ -47,7 +61,7 @@ IFileArchive* CArchiveLoaderPAK::createArchive(const io::path& filename, bool ig
|
|||
|
||||
if (file)
|
||||
{
|
||||
archive = createArchive ( file, ignoreCase, ignorePaths );
|
||||
archive = createArchive(file, ignoreCase, ignorePaths);
|
||||
file->drop ();
|
||||
}
|
||||
|
||||
|
@ -76,9 +90,9 @@ bool CArchiveLoaderPAK::isALoadableFileFormat(io::IReadFile* file) const
|
|||
{
|
||||
SPAKFileHeader header;
|
||||
|
||||
file->read( &header.tag, 4 );
|
||||
file->read(&header, sizeof(header));
|
||||
|
||||
return header.tag[0] == 'P' && header.tag[1] == 'A';
|
||||
return isHeaderValid(header);
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,17 +102,14 @@ bool CArchiveLoaderPAK::isALoadableFileFormat(io::IReadFile* file) const
|
|||
CPakReader::CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
|
||||
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CPakReader");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (File)
|
||||
{
|
||||
File->grab();
|
||||
|
||||
// scan local headers
|
||||
scanLocalHeader();
|
||||
|
||||
sort();
|
||||
}
|
||||
}
|
||||
|
@ -116,48 +127,43 @@ const IFileList* CPakReader::getFileList() const
|
|||
return this;
|
||||
}
|
||||
|
||||
//! scans for a local header, returns false if there is no more local file header.
|
||||
bool CPakReader::scanLocalHeader()
|
||||
{
|
||||
SPAKFileHeader header;
|
||||
|
||||
// Read and validate the header
|
||||
File->read(&header, sizeof(header));
|
||||
if (!isHeaderValid(header))
|
||||
return false;
|
||||
|
||||
c8 tmp[1024];
|
||||
io::path PakFileName;
|
||||
|
||||
memset(&header, 0, sizeof(SPAKFileHeader));
|
||||
File->read(&header, sizeof(SPAKFileHeader));
|
||||
|
||||
if (header.tag[0] != 'P' && header.tag[1] != 'A')
|
||||
return false; // local file headers end here.
|
||||
|
||||
// Seek to the table of contents
|
||||
#ifdef __BIG_ENDIAN__
|
||||
header.offset = os::Byteswap::byteswap(header.offset);
|
||||
header.length = os::Byteswap::byteswap(header.length);
|
||||
#endif
|
||||
File->seek(header.offset);
|
||||
|
||||
const int count = header.length / ((sizeof(u32) * 2) + 56);
|
||||
const int numberOfFiles = header.length / sizeof(SPAKFileEntry);
|
||||
|
||||
for(int i = 0; i < count; i++)
|
||||
Offsets.reallocate(numberOfFiles);
|
||||
// Loop through each entry in the table of contents
|
||||
for(int i = 0; i < numberOfFiles; i++)
|
||||
{
|
||||
// read filename
|
||||
PakFileName.reserve(56+2);
|
||||
File->read(tmp, 56);
|
||||
tmp[56] = 0x0;
|
||||
PakFileName = tmp;
|
||||
// read an entry
|
||||
SPAKFileEntry entry;
|
||||
File->read(&entry, sizeof(entry));
|
||||
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log(PakFileName.c_str());
|
||||
#endif
|
||||
|
||||
s32 offset;
|
||||
s32 size;
|
||||
|
||||
File->read(&offset, sizeof(u32));
|
||||
File->read(&size, sizeof(u32));
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
os::Byteswap::byteswap(offset);
|
||||
os::Byteswap::byteswap(size);
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log(entry.name);
|
||||
#endif
|
||||
|
||||
addItem(PakFileName, size, false, Offsets.size());
|
||||
Offsets.push_back(offset);
|
||||
#ifdef __BIG_ENDIAN__
|
||||
entry.offset = os::Byteswap::byteswap(entry.offset);
|
||||
entry.length = os::Byteswap::byteswap(entry.length);
|
||||
#endif
|
||||
|
||||
addItem(io::path(entry.name), entry.length, false, Offsets.size());
|
||||
Offsets.push_back(entry.offset);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,13 +20,24 @@ namespace irr
|
|||
{
|
||||
namespace io
|
||||
{
|
||||
//! File header containing location and size of the table of contents
|
||||
struct SPAKFileHeader
|
||||
{
|
||||
// Don't change the order of these fields! They must match the order stored on disk.
|
||||
c8 tag[4];
|
||||
u32 offset;
|
||||
u32 length;
|
||||
};
|
||||
|
||||
//! An entry in the PAK file's table of contents.
|
||||
struct SPAKFileEntry
|
||||
{
|
||||
// Don't change the order of these fields! They must match the order stored on disk.
|
||||
c8 name[56];
|
||||
u32 offset;
|
||||
u32 length;
|
||||
};
|
||||
|
||||
//! Archiveloader capable of loading PAK Archives
|
||||
class CArchiveLoaderPAK : public IArchiveLoader
|
||||
{
|
||||
|
@ -79,7 +90,6 @@ namespace io
|
|||
// file archive methods
|
||||
|
||||
//! return the id of the file Archive
|
||||
|
||||
virtual const io::path& getArchiveName() const
|
||||
{
|
||||
return File->getFileName();
|
||||
|
@ -99,16 +109,11 @@ namespace io
|
|||
|
||||
private:
|
||||
|
||||
//! scans for a local header, returns false if there is no more local file header.
|
||||
//! scans for a local header, returns false if the header is invalid
|
||||
bool scanLocalHeader();
|
||||
|
||||
//! splits filename from zip file into useful filenames and paths
|
||||
//void extractFilename(SPakFileEntry* entry);
|
||||
|
||||
IReadFile* File;
|
||||
|
||||
SPAKFileHeader header;
|
||||
|
||||
//! Contains offsets of the files from the start of the archive file
|
||||
core::array<u32> Offsets;
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue