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()
|
- 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.
|
- 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=
|
- 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.
|
- 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.
|
- 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->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||||
|
|
||||||
anms->setFrameLoop(0, 14);
|
anms->setFrameLoop(0, 13);
|
||||||
anms->setAnimationSpeed(15);
|
anms->setAnimationSpeed(15);
|
||||||
// anms->setMD2Animation(scene::EMAT_RUN);
|
// 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
|
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
|
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
|
usual, using createDevice(). To make our application catch events, we set our
|
||||||
eventreceiver as parameter. The #ifdef WIN32 preprocessor commands are not
|
eventreceiver as parameter. As you can see, there is also a call to
|
||||||
necessary, but I included them to make the tutorial use DirectX on Windows and
|
IrrlichtDevice::setResizeable(). This makes the render window resizeable, which
|
||||||
OpenGL on all other platforms like Linux. As you can see, there is also a
|
is quite useful for a mesh viewer.
|
||||||
unusual call to IrrlichtDevice::setResizeAble(). This makes the render window
|
|
||||||
resizeable, which is quite useful for a mesh viewer.
|
|
||||||
*/
|
*/
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,227 +1,160 @@
|
||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="8.00"
|
Version="7.10"
|
||||||
Name="20.ManagedLights"
|
Name="20.ManagedLights"
|
||||||
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
ProjectGUID="{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
||||||
>
|
SccProjectName=""
|
||||||
|
SccLocalPath="">
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"
|
Name="Win32"/>
|
||||||
/>
|
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory=".\Debug"
|
OutputDirectory=".\Debug"
|
||||||
IntermediateDirectory=".\Debug"
|
IntermediateDirectory=".\Debug"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
CharacterSet="2"
|
CharacterSet="2">
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/ManagedLights.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\..\include"
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="5"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="2"
|
||||||
PrecompiledHeaderFile=".\Debug/ManagedLights.pch"
|
PrecompiledHeaderFile=".\Debug/ManagedLights.pch"
|
||||||
AssemblerListingLocation=".\Debug/"
|
AssemblerListingLocation=".\Debug/"
|
||||||
ObjectFile=".\Debug/"
|
ObjectFile=".\Debug/"
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
ProgramDataBaseFileName=".\Debug/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="TRUE"
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
CompileAs="0"
|
CompileAs="0"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCCustomBuildTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="3079"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="..\..\bin\Win32-VisualStudio\20.ManagedLights.exe"
|
OutputFile="..\..\bin\Win32-VisualStudio\20.ManagedLights.exe"
|
||||||
LinkIncremental="0"
|
LinkIncremental="0"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="TRUE"
|
||||||
ProgramDatabaseFile=".\Debug/ManagedLights.pdb"
|
ProgramDatabaseFile=".\Debug/ManagedLights.pdb"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
TargetMachine="1"
|
TargetMachine="1"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCMIDLTool"
|
||||||
/>
|
TypeLibraryName=".\Debug/ManagedLights.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManifestTool"
|
Name="VCPostBuildEventTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXDCMakeTool"
|
Name="VCPreBuildEventTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCPreLinkEventTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCResourceCompilerTool"
|
||||||
/>
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="3079"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAppVerifierTool"
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCWebDeploymentTool"/>
|
||||||
/>
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory=".\Release"
|
OutputDirectory=".\Release"
|
||||||
IntermediateDirectory=".\Release"
|
IntermediateDirectory=".\Release"
|
||||||
ConfigurationType="1"
|
ConfigurationType="1"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
CharacterSet="2"
|
CharacterSet="2">
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/ManagedLights.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
AdditionalIncludeDirectories="..\..\include"
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||||
StringPooling="true"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="4"
|
||||||
EnableFunctionLevelLinking="true"
|
EnableFunctionLevelLinking="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="2"
|
||||||
PrecompiledHeaderFile=".\Release/ManagedLights.pch"
|
PrecompiledHeaderFile=".\Release/ManagedLights.pch"
|
||||||
AssemblerListingLocation=".\Release/"
|
AssemblerListingLocation=".\Release/"
|
||||||
ObjectFile=".\Release/"
|
ObjectFile=".\Release/"
|
||||||
ProgramDataBaseFileName=".\Release/"
|
ProgramDataBaseFileName=".\Release/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="TRUE"
|
||||||
CompileAs="0"
|
CompileAs="0"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCCustomBuildTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3079"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="..\..\bin\Win32-VisualStudio\20.ManagedLights.exe"
|
OutputFile="..\..\bin\Win32-VisualStudio\20.ManagedLights.exe"
|
||||||
LinkIncremental="0"
|
LinkIncremental="0"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio"
|
||||||
ProgramDatabaseFile=".\Release/ManagedLights.pdb"
|
ProgramDatabaseFile=".\Release/ManagedLights.pdb"
|
||||||
SubSystem="1"
|
SubSystem="1"
|
||||||
TargetMachine="1"
|
TargetMachine="1"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCMIDLTool"
|
||||||
/>
|
TypeLibraryName=".\Release/ManagedLights.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManifestTool"
|
Name="VCPostBuildEventTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCXDCMakeTool"
|
Name="VCPreBuildEventTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCPreLinkEventTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCResourceCompilerTool"
|
||||||
/>
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="3079"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCAppVerifierTool"
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCWebDeploymentTool"
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
/>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPostBuildEventTool"
|
Name="VCWebDeploymentTool"/>
|
||||||
/>
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<File
|
<File
|
||||||
RelativePath="main.cpp"
|
RelativePath="main.cpp">
|
||||||
>
|
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32">
|
||||||
>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions=""
|
PreprocessorDefinitions=""
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"/>
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32">
|
||||||
>
|
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
AdditionalIncludeDirectories=""
|
AdditionalIncludeDirectories=""
|
||||||
PreprocessorDefinitions=""
|
PreprocessorDefinitions=""/>
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
/** Example 020 Managed Lights
|
||||||
|
|
||||||
// Written by Colin MacDonald
|
Written by Colin MacDonald. This tutorial explains the use of the Light Manager
|
||||||
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
of Irrlicht. It enables the use of more dynamic light sources than the actual
|
||||||
// This file is part of the "Irrlicht Engine".
|
hardware supports. Further applications of the Light Manager, such as per scene
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
node callbacks, are left out for simplicity of the example.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <irrlicht.h>
|
#include <irrlicht.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -273,7 +275,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
*/
|
*/
|
||||||
int main(int argumentCount, char * argumentValues[])
|
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"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));
|
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 zoneX = -100.f; zoneX <= 100.f; zoneX += 50.f)
|
||||||
for(f32 zoneY = -60.f; zoneY <= 60.f; zoneY += 60.f)
|
for(f32 zoneY = -60.f; zoneY <= 60.f; zoneY += 60.f)
|
||||||
{
|
{
|
||||||
|
@ -403,3 +407,7 @@ int main(int argumentCount, char * argumentValues[])
|
||||||
device->drop();
|
device->drop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,15 @@
|
||||||
<File
|
<File
|
||||||
RelativePath=".\main.cpp">
|
RelativePath=".\main.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\q3factory.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\q3factory.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\sound.cpp">
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
|
|
@ -23,12 +23,17 @@ Copyright 2006-2009 Burningwater, Thomas Alten
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Game Data is used to hold Data which is needed to drive the game
|
Game Data is used to hold Data which is needed to drive the game
|
||||||
*/
|
*/
|
||||||
struct GameData
|
struct GameData
|
||||||
{
|
{
|
||||||
GameData ( const path &startupDir);
|
GameData ( const path &startupDir) :
|
||||||
|
retVal(0), createExDevice(0), Device(0), StartupDir(startupDir)
|
||||||
|
{
|
||||||
|
setDefault ();
|
||||||
|
}
|
||||||
|
|
||||||
void setDefault ();
|
void setDefault ();
|
||||||
s32 save ( const path &filename );
|
s32 save ( const path &filename );
|
||||||
s32 load ( const path &filename );
|
s32 load ( const path &filename );
|
||||||
|
@ -58,18 +63,7 @@ struct GameData
|
||||||
IrrlichtDevice *Device;
|
IrrlichtDevice *Device;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
*/
|
|
||||||
GameData::GameData ( const path &startupDir)
|
|
||||||
{
|
|
||||||
retVal = 0;
|
|
||||||
createExDevice = 0;
|
|
||||||
Device = 0;
|
|
||||||
StartupDir = startupDir;
|
|
||||||
setDefault ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
set default settings
|
set default settings
|
||||||
*/
|
*/
|
||||||
void GameData::setDefault ()
|
void GameData::setDefault ()
|
||||||
|
@ -92,7 +86,7 @@ void GameData::setDefault ()
|
||||||
deviceParam.WindowSize.Height = 600;
|
deviceParam.WindowSize.Height = 600;
|
||||||
deviceParam.Fullscreen = false;
|
deviceParam.Fullscreen = false;
|
||||||
deviceParam.Bits = 32;
|
deviceParam.Bits = 32;
|
||||||
deviceParam.ZBufferBits = 32;
|
deviceParam.ZBufferBits = 16;
|
||||||
deviceParam.Vsync = false;
|
deviceParam.Vsync = false;
|
||||||
deviceParam.AntiAlias = false;
|
deviceParam.AntiAlias = false;
|
||||||
|
|
||||||
|
@ -112,19 +106,17 @@ void GameData::setDefault ()
|
||||||
CurrentMapName = "";
|
CurrentMapName = "";
|
||||||
CurrentArchiveList.clear ();
|
CurrentArchiveList.clear ();
|
||||||
|
|
||||||
//! Explorer Media directory
|
// Explorer Media directory
|
||||||
CurrentArchiveList.push_back ( StartupDir + "../../media/" );
|
CurrentArchiveList.push_back ( StartupDir + "../../media/" );
|
||||||
|
|
||||||
//! Add the original quake3 files before you load your custom map
|
// Add the original quake3 files before you load your custom map
|
||||||
//! Most mods are using the original shaders, models&items&weapons
|
// Most mods are using the original shaders, models&items&weapons
|
||||||
CurrentArchiveList.push_back ( "/q/baseq3/" );
|
CurrentArchiveList.push_back("/q/baseq3/");
|
||||||
|
|
||||||
|
|
||||||
CurrentArchiveList.push_back ( StartupDir + "../../media/map-20kdm2.pk3" );
|
|
||||||
|
|
||||||
|
CurrentArchiveList.push_back(StartupDir + "../../media/map-20kdm2.pk3");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Load the current game State from a typical quake3 cfg file
|
Load the current game State from a typical quake3 cfg file
|
||||||
*/
|
*/
|
||||||
s32 GameData::load ( const path &filename )
|
s32 GameData::load ( const path &filename )
|
||||||
|
@ -132,7 +124,7 @@ s32 GameData::load ( const path &filename )
|
||||||
if (!Device)
|
if (!Device)
|
||||||
return 0;
|
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 );
|
IQ3LevelMesh* mesh = (IQ3LevelMesh*) Device->getSceneManager()->getMesh ( filename );
|
||||||
if (!mesh)
|
if (!mesh)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -171,7 +163,7 @@ s32 GameData::load ( const path &filename )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Store the current game State in a quake3 configuration file
|
Store the current game State in a quake3 configuration file
|
||||||
*/
|
*/
|
||||||
s32 GameData::save ( const path &filename )
|
s32 GameData::save ( const path &filename )
|
||||||
|
@ -217,7 +209,7 @@ s32 GameData::save ( const path &filename )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Representing a player
|
Representing a player
|
||||||
*/
|
*/
|
||||||
struct Q3Player : public IAnimationEndCallBack
|
struct Q3Player : public IAnimationEndCallBack
|
||||||
|
@ -254,7 +246,7 @@ struct Q3Player : public IAnimationEndCallBack
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/* End player
|
||||||
*/
|
*/
|
||||||
void Q3Player::shutdown ()
|
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 )
|
void Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *mapNode, IMetaTriangleSelector *meta )
|
||||||
{
|
{
|
||||||
setTimeFire ( Anim + 0, 200, FIRED );
|
setTimeFire ( Anim + 0, 200, FIRED );
|
||||||
setTimeFire ( Anim + 1, 5000 );
|
setTimeFire ( Anim + 1, 5000 );
|
||||||
|
|
||||||
|
if (!device)
|
||||||
|
return;
|
||||||
// load FPS weapon to Camera
|
// load FPS weapon to Camera
|
||||||
Device = device;
|
Device = device;
|
||||||
Mesh = mesh;
|
Mesh = mesh;
|
||||||
|
@ -371,12 +365,14 @@ void Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
so we need a good starting Position in the level.
|
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"
|
we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
|
||||||
*/
|
*/
|
||||||
void Q3Player::respawn ()
|
void Q3Player::respawn ()
|
||||||
{
|
{
|
||||||
|
if (!Device)
|
||||||
|
return;
|
||||||
ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera();
|
ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera();
|
||||||
|
|
||||||
Device->getLogger()->log( "respawn" );
|
Device->getLogger()->log( "respawn" );
|
||||||
|
@ -395,6 +391,8 @@ void Q3Player::respawn ()
|
||||||
*/
|
*/
|
||||||
void Q3Player::setpos ( const vector3df &pos, const vector3df &rotation )
|
void Q3Player::setpos ( const vector3df &pos, const vector3df &rotation )
|
||||||
{
|
{
|
||||||
|
if (!Device)
|
||||||
|
return;
|
||||||
Device->getLogger()->log( "setpos" );
|
Device->getLogger()->log( "setpos" );
|
||||||
|
|
||||||
ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera();
|
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 )
|
void Q3Player::setAnim ( const c8 *name )
|
||||||
{
|
{
|
||||||
|
@ -431,8 +429,7 @@ void Q3Player::setAnim ( const c8 *name )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
// Callback
|
||||||
*/
|
|
||||||
void Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node)
|
void Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node)
|
||||||
{
|
{
|
||||||
setAnim ( 0 );
|
setAnim ( 0 );
|
||||||
|
@ -440,7 +437,8 @@ void Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! GUIElements
|
/* GUI Elements
|
||||||
|
*/
|
||||||
struct GUI
|
struct GUI
|
||||||
{
|
{
|
||||||
GUI ()
|
GUI ()
|
||||||
|
@ -483,11 +481,10 @@ struct GUI
|
||||||
IGUIStaticText* StatusLine;
|
IGUIStaticText* StatusLine;
|
||||||
IGUIImage* Logo;
|
IGUIImage* Logo;
|
||||||
IGUIWindow* Window;
|
IGUIWindow* Window;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
CQuake3EventHandler controls the game
|
CQuake3EventHandler controls the game
|
||||||
*/
|
*/
|
||||||
class CQuake3EventHandler : public IEventReceiver
|
class CQuake3EventHandler : public IEventReceiver
|
||||||
|
@ -547,14 +544,14 @@ private:
|
||||||
void dropMap ();
|
void dropMap ();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/* Constructor
|
||||||
*/
|
*/
|
||||||
CQuake3EventHandler::CQuake3EventHandler( GameData *game )
|
CQuake3EventHandler::CQuake3EventHandler( GameData *game )
|
||||||
: Game(game), Mesh(0), MapParent(0), ShaderParent(0), ItemParent(0), UnresolvedParent(0),
|
: Game(game), Mesh(0), MapParent(0), ShaderParent(0), ItemParent(0), UnresolvedParent(0),
|
||||||
BulletParent(0), FogParent(0), SkyNode(0), Meta(0)
|
BulletParent(0), FogParent(0), SkyNode(0), Meta(0)
|
||||||
{
|
{
|
||||||
buf[0]=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 )
|
if ( Game->deviceParam.Bits == 16 )
|
||||||
{
|
{
|
||||||
game->Device->getVideoDriver()->setTextureCreationFlag(ETCF_ALWAYS_16_BIT, true);
|
game->Device->getVideoDriver()->setTextureCreationFlag(ETCF_ALWAYS_16_BIT, true);
|
||||||
|
@ -572,6 +569,7 @@ CQuake3EventHandler::CQuake3EventHandler( GameData *game )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// destructor
|
||||||
CQuake3EventHandler::~CQuake3EventHandler ()
|
CQuake3EventHandler::~CQuake3EventHandler ()
|
||||||
{
|
{
|
||||||
Player[0].shutdown ();
|
Player[0].shutdown ();
|
||||||
|
@ -583,7 +581,7 @@ CQuake3EventHandler::~CQuake3EventHandler ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! create runtime textures smog, fog
|
// create runtime textures smog, fog
|
||||||
void CQuake3EventHandler::createTextures ()
|
void CQuake3EventHandler::createTextures ()
|
||||||
{
|
{
|
||||||
IVideoDriver * driver = Game->Device->getVideoDriver();
|
IVideoDriver * driver = Game->Device->getVideoDriver();
|
||||||
|
@ -636,7 +634,7 @@ void CQuake3EventHandler::createTextures ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
create the GUI
|
create the GUI
|
||||||
*/
|
*/
|
||||||
void CQuake3EventHandler::CreateGUI()
|
void CQuake3EventHandler::CreateGUI()
|
||||||
|
@ -829,8 +827,7 @@ void CQuake3EventHandler::CreateGUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
/*!
|
|
||||||
Add an Archive to the FileSystems und updates the GUI
|
Add an Archive to the FileSystems und updates the GUI
|
||||||
*/
|
*/
|
||||||
void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
||||||
|
@ -916,7 +913,7 @@ void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
||||||
u32 g = 0;
|
u32 g = 0;
|
||||||
core::stringw s;
|
core::stringw s;
|
||||||
|
|
||||||
//! browse the attached file system
|
// browse the attached file system
|
||||||
fs->setFileListSystem ( FILESYSTEM_VIRTUAL );
|
fs->setFileListSystem ( FILESYSTEM_VIRTUAL );
|
||||||
fs->changeWorkingDirectoryTo ( "/maps/" );
|
fs->changeWorkingDirectoryTo ( "/maps/" );
|
||||||
IFileList *fileList = fs->createFileList ();
|
IFileList *fileList = fs->createFileList ();
|
||||||
|
@ -994,7 +991,7 @@ void CQuake3EventHandler::AddArchive ( const path& archiveName )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
clears the Map in Memory
|
clears the Map in Memory
|
||||||
*/
|
*/
|
||||||
void CQuake3EventHandler::dropMap ()
|
void CQuake3EventHandler::dropMap ()
|
||||||
|
@ -1031,7 +1028,7 @@ void CQuake3EventHandler::dropMap ()
|
||||||
Mesh = 0;
|
Mesh = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/* Load new map
|
||||||
*/
|
*/
|
||||||
void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision )
|
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
|
Adds a SceneNode with an icon to the Scene Tree
|
||||||
*/
|
*/
|
||||||
void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent)
|
void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent)
|
||||||
|
@ -1203,13 +1197,13 @@ void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNod
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Adds life!
|
// Adds life!
|
||||||
void CQuake3EventHandler::CreatePlayers()
|
void CQuake3EventHandler::CreatePlayers()
|
||||||
{
|
{
|
||||||
Player[0].create ( Game->Device, Mesh, MapParent, Meta );
|
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)
|
void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture)
|
||||||
{
|
{
|
||||||
ISceneManager *smgr = Game->Device->getSceneManager ();
|
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] );
|
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
|
||||||
SkyNode = smgr->addSkyBoxSceneNode( driver->getTexture ( buf ), 0, 0, 0, 0, 0 );
|
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] );
|
for ( i = 0; i < 6; ++i )
|
||||||
SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) );
|
{
|
||||||
|
snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] );
|
||||||
|
SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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;
|
//SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL;
|
||||||
|
|
||||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState);
|
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)
|
void CQuake3EventHandler::SetGUIActive( s32 command)
|
||||||
{
|
{
|
||||||
bool inputState = false;
|
bool inputState = false;
|
||||||
|
@ -1315,7 +1312,7 @@ void CQuake3EventHandler::SetGUIActive( s32 command)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*
|
||||||
Handle game input
|
Handle game input
|
||||||
*/
|
*/
|
||||||
bool CQuake3EventHandler::OnEvent(const SEvent& eve)
|
bool CQuake3EventHandler::OnEvent(const SEvent& eve)
|
||||||
|
@ -1525,7 +1522,7 @@ bool CQuake3EventHandler::OnEvent(const SEvent& eve)
|
||||||
else
|
else
|
||||||
if (eve.KeyInput.Key == KEY_F11)
|
if (eve.KeyInput.Key == KEY_F11)
|
||||||
{
|
{
|
||||||
//! screenshot are taken without gamma!
|
// screenshot are taken without gamma!
|
||||||
IImage* image = Game->Device->getVideoDriver()->createScreenShot();
|
IImage* image = Game->Device->getVideoDriver()->createScreenShot();
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
|
@ -1824,8 +1821,7 @@ void CQuake3EventHandler::useItem( Q3Player * player)
|
||||||
// play sound
|
// play sound
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
// rendered when bullets hit something
|
||||||
*/
|
|
||||||
void CQuake3EventHandler::createParticleImpacts( u32 now )
|
void CQuake3EventHandler::createParticleImpacts( u32 now )
|
||||||
{
|
{
|
||||||
ISceneManager* sm = Game->Device->getSceneManager();
|
ISceneManager* sm = Game->Device->getSceneManager();
|
||||||
|
@ -1969,7 +1965,7 @@ void CQuake3EventHandler::Animate()
|
||||||
|
|
||||||
IAttributes * attr = smgr->getParameters();
|
IAttributes * attr = smgr->getParameters();
|
||||||
swprintf ( msg, 128,
|
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(),
|
Game->CurrentMapName.c_str(),
|
||||||
driver->getName(),
|
driver->getName(),
|
||||||
driver->getFPS (),
|
driver->getFPS (),
|
||||||
|
@ -2006,7 +2002,7 @@ void CQuake3EventHandler::Animate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/* The main game states
|
||||||
*/
|
*/
|
||||||
void runGame ( GameData *game )
|
void runGame ( GameData *game )
|
||||||
{
|
{
|
||||||
|
@ -2024,10 +2020,10 @@ void runGame ( GameData *game )
|
||||||
// create an event receiver based on current game data
|
// create an event receiver based on current game data
|
||||||
CQuake3EventHandler *eventHandler = new CQuake3EventHandler( game );
|
CQuake3EventHandler *eventHandler = new CQuake3EventHandler( game );
|
||||||
|
|
||||||
//! load stored config
|
// load stored config
|
||||||
game->load ( "explorer.cfg" );
|
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 )
|
for ( u32 i = 0; i < game->CurrentArchiveList.size(); ++i )
|
||||||
{
|
{
|
||||||
eventHandler->AddArchive ( game->CurrentArchiveList[i] );
|
eventHandler->AddArchive ( game->CurrentArchiveList[i] );
|
||||||
|
@ -2078,7 +2074,7 @@ void runGame ( GameData *game )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/* The main routine, doing all setup
|
||||||
*/
|
*/
|
||||||
int IRRCALLCONV main(int argc, char* argv[])
|
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
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
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}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "21.Quake3Explorer", "21.Quake3Explorer\Quake3Explorer_vc7.vcproj", "{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
{E08E042A-6C45-411B-92BE-3CC31331019F} = {E08E042A-6C45-411B-92BE-3CC31331019F}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "20.ManagedLights", "20.ManagedLights\ManagedLights.vcproj", "{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfiguration) = preSolution
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
Debug = Debug
|
Debug = Debug
|
||||||
|
@ -167,14 +167,14 @@ Global
|
||||||
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
|
{EB3B38EA-5CE7-4983-845B-880661E69D09}.Release.Build.0 = Release|Win32
|
||||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
|
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Debug.ActiveCfg = Debug|Win32
|
||||||
{1AB9413E-4F53-42A3-8CB2-CB4BE22336D0}.Release.ActiveCfg = Release|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.ActiveCfg = Debug|Win32
|
||||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug.Build.0 = 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.ActiveCfg = Release|Win32
|
||||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
|
@ -181,8 +181,11 @@ Global
|
||||||
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Debug|Win32.ActiveCfg = Debug|Win32
|
{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}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{FE853A36-E0D1-4AC5-A792-B643E70D2953}.Release|Win32.ActiveCfg = Release|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.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.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.ActiveCfg = Debug|Win32
|
||||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.Build.0 = Debug|Win32
|
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.ActiveCfg = Release|Win32
|
{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
|
|
@ -81,10 +81,14 @@ namespace scene
|
||||||
\return True if successful, false if not. */
|
\return True if successful, false if not. */
|
||||||
virtual bool setFrameLoop(s32 begin, s32 end) = 0;
|
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. */
|
/** \param framesPerSecond: Frames per second played. */
|
||||||
virtual void setAnimationSpeed(f32 framesPerSecond) = 0;
|
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.
|
//! Creates shadow volume scene node as child of this node.
|
||||||
/** The shadow can be rendered using the ZPass or the zfail
|
/** The shadow can be rendered using the ZPass or the zfail
|
||||||
method. ZPass is a little bit faster because the shadow volume
|
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
|
* each connected joystick once per run() of the device. Joystick events will
|
||||||
* not be generated by default. If joystick support is available for the
|
* not be generated by default. If joystick support is available for the
|
||||||
* active device, _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ is defined, and
|
* 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()
|
* this type will be generated once per joystick per @ref IrrlichtDevice::run()
|
||||||
* regardless of whether the state of the joystick has actually changed. */
|
* regardless of whether the state of the joystick has actually changed. */
|
||||||
struct SJoystickEvent
|
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
|
struct SJoystickInfo
|
||||||
{
|
{
|
||||||
//! The ID of the joystick
|
//! The ID of the joystick
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
or 0 on failure. */
|
or 0 on failure. */
|
||||||
virtual IReadFile* createAndOpenFile(const path& filename) =0;
|
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
|
/** Creates and returns
|
||||||
\param index The zero based index of the file.
|
\param index The zero based index of the file.
|
||||||
\return Returns a pointer to the created file on success, or 0 on failure. */
|
\return Returns a pointer to the created file on success, or 0 on failure. */
|
||||||
|
@ -80,7 +80,7 @@ class IArchiveLoader : public virtual IReferenceCounted
|
||||||
public:
|
public:
|
||||||
//! Check if the file might be loaded by this class
|
//! Check if the file might be loaded by this class
|
||||||
/** Check based on the file extension (e.g. ".zip")
|
/** 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. */
|
\return True if file seems to be loadable. */
|
||||||
virtual bool isALoadableFileFormat(const path& filename) const =0;
|
virtual bool isALoadableFileFormat(const path& filename) const =0;
|
||||||
|
|
||||||
|
@ -97,12 +97,16 @@ public:
|
||||||
virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
|
virtual bool isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const =0;
|
||||||
|
|
||||||
//! Creates an archive from the filename
|
//! 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. */
|
\return Pointer to newly created archive, or 0 upon error. */
|
||||||
virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
|
virtual IFileArchive* createArchive(const path& filename, bool ignoreCase, bool ignorePaths) const =0;
|
||||||
|
|
||||||
//! Creates an archive from the file
|
//! 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. */
|
\return Pointer to newly created archive, or 0 upon error. */
|
||||||
virtual IFileArchive* createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const =0;
|
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.
|
//! 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
|
/** \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.
|
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;
|
virtual const io::path& getFullFileName(u32 index) const = 0;
|
||||||
|
|
||||||
//! Returns the size of a file in the file list, based on an index.
|
//! 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. */
|
\return The size of the file in bytes. */
|
||||||
virtual u32 getFileSize(u32 index) const = 0;
|
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
|
//! Check if the file is a directory
|
||||||
/** \param index The zero based index which will be checked. The index
|
/** \param index The zero based index which will be checked. The index
|
||||||
must be less than the amount getFileCount() returns.
|
must be less than the amount getFileCount() returns.
|
||||||
|
@ -58,6 +67,16 @@ public:
|
||||||
|
|
||||||
//! Returns the base path of the file list
|
//! Returns the base path of the file list
|
||||||
virtual const io::path& getPath() const = 0;
|
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
|
} // end namespace irr
|
||||||
|
|
|
@ -125,9 +125,10 @@ public:
|
||||||
virtual bool removeFileArchive(u32 index) =0;
|
virtual bool removeFileArchive(u32 index) =0;
|
||||||
|
|
||||||
//! Removes an archive from the file system.
|
//! 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
|
/** This will close the archive and free any file handles, but will not
|
||||||
been loaded and are now cached, for example textures and meshes.
|
close resources which have already been loaded and are now cached, for
|
||||||
\param index: The index of the archive to remove
|
example textures and meshes.
|
||||||
|
\param filename The archive of the given name will be removed
|
||||||
\return Returns true on success, false on failure */
|
\return Returns true on success, false on failure */
|
||||||
virtual bool removeFileArchive(const path& filename) =0;
|
virtual bool removeFileArchive(const path& filename) =0;
|
||||||
|
|
||||||
|
@ -226,6 +227,12 @@ public:
|
||||||
See IReferenceCounted::drop() for more information. */
|
See IReferenceCounted::drop() for more information. */
|
||||||
virtual IFileList* createFileList() =0;
|
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.
|
//! Set the active type of file system.
|
||||||
virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
|
virtual EFileSystemType setFileListSystem(EFileSystemType listType) =0;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,21 @@ namespace irr
|
||||||
{
|
{
|
||||||
namespace gui
|
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.
|
//! GUI Context menu interface.
|
||||||
class IGUIContextMenu : public IGUIElement
|
class IGUIContextMenu : public IGUIElement
|
||||||
|
@ -21,6 +36,12 @@ namespace gui
|
||||||
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
|
IGUIContextMenu(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
|
||||||
: IGUIElement(EGUIET_CONTEXT_MENU, environment, parent, id, 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
|
//! Get amount of menu items
|
||||||
virtual u32 getItemCount() const = 0;
|
virtual u32 getItemCount() const = 0;
|
||||||
|
|
||||||
|
@ -36,7 +57,30 @@ namespace gui
|
||||||
\param checked: Specifies if the menu item should be initially checked.
|
\param checked: Specifies if the menu item should be initially checked.
|
||||||
\return Returns the index of the new item */
|
\return Returns the index of the new item */
|
||||||
virtual u32 addItem(const wchar_t* text, s32 commandId=-1, bool enabled=true,
|
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
|
//! Adds a separator item to the menu
|
||||||
virtual void addSeparator() = 0;
|
virtual void addSeparator() = 0;
|
||||||
|
@ -94,6 +138,15 @@ namespace gui
|
||||||
\param idx: Zero based index of the menu item
|
\param idx: Zero based index of the menu item
|
||||||
\return Returns a pointer to the submenu of an item. */
|
\return Returns a pointer to the submenu of an item. */
|
||||||
virtual IGUIContextMenu* getSubMenu(u32 idx) const = 0;
|
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
|
} // end namespace gui
|
||||||
|
|
|
@ -252,7 +252,7 @@ public:
|
||||||
DesiredRect.UpperLeftCorner.X += diffx/2;
|
DesiredRect.UpperLeftCorner.X += diffx/2;
|
||||||
break;
|
break;
|
||||||
case EGUIA_SCALE:
|
case EGUIA_SCALE:
|
||||||
DesiredRect.UpperLeftCorner.X = (s32)(ScaleRect.UpperLeftCorner.X * fw);
|
DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
DesiredRect.LowerRightCorner.X += diffx/2;
|
DesiredRect.LowerRightCorner.X += diffx/2;
|
||||||
break;
|
break;
|
||||||
case EGUIA_SCALE:
|
case EGUIA_SCALE:
|
||||||
DesiredRect.LowerRightCorner.X = (s32)(ScaleRect.LowerRightCorner.X * fw);
|
DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ public:
|
||||||
DesiredRect.UpperLeftCorner.Y += diffy/2;
|
DesiredRect.UpperLeftCorner.Y += diffy/2;
|
||||||
break;
|
break;
|
||||||
case EGUIA_SCALE:
|
case EGUIA_SCALE:
|
||||||
DesiredRect.UpperLeftCorner.Y = (s32)(ScaleRect.UpperLeftCorner.Y * fh);
|
DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ public:
|
||||||
DesiredRect.LowerRightCorner.Y += diffy/2;
|
DesiredRect.LowerRightCorner.Y += diffy/2;
|
||||||
break;
|
break;
|
||||||
case EGUIA_SCALE:
|
case EGUIA_SCALE:
|
||||||
DesiredRect.LowerRightCorner.Y = (s32)(ScaleRect.LowerRightCorner.Y * fh);
|
DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,8 +149,9 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//! Creates the image list from the given texture.
|
//! Creates the image list from the given texture.
|
||||||
/** Loads the font if it was not loaded before.
|
/** \param texture Texture to split into images
|
||||||
\param filename Filename of the Font.
|
\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.
|
\return Pointer to the font. Returns 0 if the font could not be loaded.
|
||||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||||
more information. */
|
more information. */
|
||||||
|
@ -240,11 +241,12 @@ public:
|
||||||
to (EMBF_OK | EMBF_CANCEL).
|
to (EMBF_OK | EMBF_CANCEL).
|
||||||
\param parent Parent gui element of the message box.
|
\param parent Parent gui element of the message box.
|
||||||
\param id Id with which the gui element can be identified.
|
\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
|
\return Pointer to the created message box. Returns 0 if an error
|
||||||
occured. This pointer should not be dropped. See
|
occured. This pointer should not be dropped. See
|
||||||
IReferenceCounted::drop() for more information. */
|
IReferenceCounted::drop() for more information. */
|
||||||
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
|
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.
|
//! Adds a scrollbar.
|
||||||
/** \param horizontal Specifies if the scroll bar is drawn horizontal
|
/** \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 parent Parent gui element of the list box.
|
||||||
\param id Id to identify the gui element.
|
\param id Id to identify the gui element.
|
||||||
\param drawBackground Flag whether the background should be drawn.
|
\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.
|
\return Pointer to the created list box. Returns 0 if an error occured.
|
||||||
This pointer should not be dropped. See IReferenceCounted::drop() for
|
This pointer should not be dropped. See IReferenceCounted::drop() for
|
||||||
more information. */
|
more information. */
|
||||||
|
@ -395,6 +399,7 @@ public:
|
||||||
/** An edit box with up and down buttons
|
/** An edit box with up and down buttons
|
||||||
\param text Text to be displayed. Can be altered after creation by setText().
|
\param text Text to be displayed. Can be altered after creation by setText().
|
||||||
\param rectangle Rectangle specifying the borders of the spin box.
|
\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.
|
\param parent Parent item of the element, e.g. a window.
|
||||||
Set it to 0 to place the spin box directly in the environment.
|
Set it to 0 to place the spin box directly in the environment.
|
||||||
\param id The ID of the element.
|
\param id The ID of the element.
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
//! Define which characters should not be drawn by the font.
|
//! Define which characters should not be drawn by the font.
|
||||||
/** For example " " would not draw any space which is usually blank in
|
/** For example " " would not draw any space which is usually blank in
|
||||||
most fonts.
|
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;
|
virtual void setInvisibleCharacters( const wchar_t *s ) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -139,9 +139,9 @@ namespace gui
|
||||||
EGDS_WINDOW_BUTTON_WIDTH,
|
EGDS_WINDOW_BUTTON_WIDTH,
|
||||||
//! width of a checkbox check
|
//! width of a checkbox check
|
||||||
EGDS_CHECK_BOX_WIDTH,
|
EGDS_CHECK_BOX_WIDTH,
|
||||||
//! width of a messagebox
|
//! deprecated
|
||||||
EGDS_MESSAGE_BOX_WIDTH,
|
EGDS_MESSAGE_BOX_WIDTH,
|
||||||
//! height of a messagebox
|
//! deprecated
|
||||||
EGDS_MESSAGE_BOX_HEIGHT,
|
EGDS_MESSAGE_BOX_HEIGHT,
|
||||||
//! width of a default button
|
//! width of a default button
|
||||||
EGDS_BUTTON_WIDTH,
|
EGDS_BUTTON_WIDTH,
|
||||||
|
@ -155,6 +155,17 @@ namespace gui
|
||||||
EGDS_TITLEBARTEXT_DISTANCE_X,
|
EGDS_TITLEBARTEXT_DISTANCE_X,
|
||||||
//! distance for text in the title bar, from the top of the window rect
|
//! distance for text in the title bar, from the top of the window rect
|
||||||
EGDS_TITLEBARTEXT_DISTANCE_Y,
|
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
|
//! this value is not used, it only specifies the amount of default sizes
|
||||||
//! available.
|
//! available.
|
||||||
EGDS_COUNT
|
EGDS_COUNT
|
||||||
|
@ -174,7 +185,14 @@ namespace gui
|
||||||
"ButtonHeight",
|
"ButtonHeight",
|
||||||
"TextDistanceX",
|
"TextDistanceX",
|
||||||
"TextDistanceY",
|
"TextDistanceY",
|
||||||
0,
|
"TitleBarTextX",
|
||||||
|
"TitleBarTextY",
|
||||||
|
"MessageBoxGapSpace",
|
||||||
|
"MessageBoxMinTextWidth",
|
||||||
|
"MessageBoxMaxTextWidth",
|
||||||
|
"MessageBoxMinTextHeight",
|
||||||
|
"MessageBoxMaxTextHeight",
|
||||||
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,7 +230,7 @@ namespace gui
|
||||||
"WindowButtonMaximize",
|
"WindowButtonMaximize",
|
||||||
"WindowButtonMinimize",
|
"WindowButtonMinimize",
|
||||||
"WindowButtonRestore",
|
"WindowButtonRestore",
|
||||||
0,
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Customizable symbols for GUI
|
//! Customizable symbols for GUI
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace gui
|
||||||
virtual IGUITreeView* getOwner() const = 0;
|
virtual IGUITreeView* getOwner() const = 0;
|
||||||
|
|
||||||
//! Returns the parent node of this node.
|
//! 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;
|
virtual IGUITreeViewNode* getParent() const = 0;
|
||||||
|
|
||||||
//! returns the text of the node
|
//! returns the text of the node
|
||||||
|
@ -79,118 +79,114 @@ namespace gui
|
||||||
virtual bool hasChilds() const = 0;
|
virtual bool hasChilds() const = 0;
|
||||||
|
|
||||||
//! Adds a new node behind the last child node.
|
//! Adds a new node behind the last child node.
|
||||||
//! \param text text of the new node
|
/** \param text text of the new node
|
||||||
//! \param icon icon 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 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 selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||||
//! \param data user data (void*) of the new node
|
\param data user data (void*) of the new node
|
||||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||||
//! \return
|
\return The new node
|
||||||
//! returns the new node
|
*/
|
||||||
virtual IGUITreeViewNode* addChildBack(
|
virtual IGUITreeViewNode* addChildBack(
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon = 0,
|
const wchar_t* icon = 0,
|
||||||
s32 imageIndex = -1,
|
s32 imageIndex = -1,
|
||||||
s32 selectedImageIndex = -1,
|
s32 selectedImageIndex = -1,
|
||||||
void* data = 0,
|
void* data = 0,
|
||||||
IReferenceCounted* data2 = 0 ) = 0;
|
IReferenceCounted* data2 = 0 ) = 0;
|
||||||
|
|
||||||
//! Adds a new node before the first child node.
|
//! Adds a new node before the first child node.
|
||||||
//! \param text text of the new node
|
/** \param text text of the new node
|
||||||
//! \param icon icon 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 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 selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||||
//! \param data user data (void*) of the new node
|
\param data user data (void*) of the new node
|
||||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||||
//! \return
|
\return The new node
|
||||||
//! returns the new node
|
*/
|
||||||
virtual IGUITreeViewNode* addChildFront(
|
virtual IGUITreeViewNode* addChildFront(
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon = 0,
|
const wchar_t* icon = 0,
|
||||||
s32 imageIndex = -1,
|
s32 imageIndex = -1,
|
||||||
s32 selectedImageIndex = -1,
|
s32 selectedImageIndex = -1,
|
||||||
void* data = 0,
|
void* data = 0,
|
||||||
IReferenceCounted* data2 = 0 ) = 0;
|
IReferenceCounted* data2 = 0 ) = 0;
|
||||||
|
|
||||||
//! Adds a new node behind the other node.
|
//! Adds a new node behind the other node.
|
||||||
//! The other node has also te be a child node from this node.
|
/** The other node has also te be a child node from this node.
|
||||||
//! \param text text of the new node
|
\param other Node to insert after
|
||||||
//! \param icon icon text of the new node
|
\param text text of the new node
|
||||||
//! \param imageIndex index of the image for the new node (-1 = none)
|
\param icon icon text of the new node
|
||||||
//! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
\param imageIndex index of the image for the new node (-1 = none)
|
||||||
//! \param data user data (void*) of the new node
|
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
\param data user data (void*) of the new node
|
||||||
//! \return
|
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||||
//! returns the new node or 0 if other is no child node from this
|
\return The new node or 0 if other is no child node from this
|
||||||
|
*/
|
||||||
virtual IGUITreeViewNode* insertChildAfter(
|
virtual IGUITreeViewNode* insertChildAfter(
|
||||||
IGUITreeViewNode* other,
|
IGUITreeViewNode* other,
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon = 0,
|
const wchar_t* icon = 0,
|
||||||
s32 imageIndex = -1,
|
s32 imageIndex = -1,
|
||||||
s32 selectedImageIndex = -1,
|
s32 selectedImageIndex = -1,
|
||||||
void* data = 0,
|
void* data = 0,
|
||||||
IReferenceCounted* data2 = 0 ) = 0;
|
IReferenceCounted* data2 = 0 ) = 0;
|
||||||
|
|
||||||
//! Adds a new node before the other node.
|
//! Adds a new node before the other node.
|
||||||
//! The other node has also te be a child node from this node.
|
/** The other node has also te be a child node from this node.
|
||||||
//! \param text text of the new node
|
\param other Node to insert before
|
||||||
//! \param icon icon text of the new node
|
\param text text of the new node
|
||||||
//! \param imageIndex index of the image for the new node (-1 = none)
|
\param icon icon text of the new node
|
||||||
//! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
\param imageIndex index of the image for the new node (-1 = none)
|
||||||
//! \param data user data (void*) of the new node
|
\param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
|
||||||
//! \param data2 user data2 (IReferenceCounted*) of the new node
|
\param data user data (void*) of the new node
|
||||||
//! \return
|
\param data2 user data2 (IReferenceCounted*) of the new node
|
||||||
//! returns the new node or 0 if other is no child node from this
|
\return The new node or 0 if other is no child node from this
|
||||||
|
*/
|
||||||
virtual IGUITreeViewNode* insertChildBefore(
|
virtual IGUITreeViewNode* insertChildBefore(
|
||||||
IGUITreeViewNode* other,
|
IGUITreeViewNode* other,
|
||||||
const wchar_t* text,
|
const wchar_t* text,
|
||||||
const wchar_t* icon = 0,
|
const wchar_t* icon = 0,
|
||||||
s32 imageIndex = -1,
|
s32 imageIndex = -1,
|
||||||
s32 selectedImageIndex = -1,
|
s32 selectedImageIndex = -1,
|
||||||
void* data = 0,
|
void* data = 0,
|
||||||
IReferenceCounted* data2 = 0 ) = 0;
|
IReferenceCounted* data2 = 0 ) = 0;
|
||||||
|
|
||||||
//! Return the first child node from this node.
|
//! Return the first child node from this node.
|
||||||
//! \return
|
/** \return The first child node or 0 if this node has no childs. */
|
||||||
//! Returns the first child node or 0 if this node has no childs.
|
|
||||||
virtual IGUITreeViewNode* getFirstChild() const = 0;
|
virtual IGUITreeViewNode* getFirstChild() const = 0;
|
||||||
|
|
||||||
//! Return the last child node from this node.
|
//! Return the last child node from this node.
|
||||||
//! \return
|
/** \return The last child node or 0 if this node has no childs. */
|
||||||
//! Returns the last child node or 0 if this node has no childs.
|
|
||||||
virtual IGUITreeViewNode* getLastChild() const = 0;
|
virtual IGUITreeViewNode* getLastChild() const = 0;
|
||||||
|
|
||||||
//! Returns the preverse sibling node from this node.
|
//! Returns the previous sibling node from this node.
|
||||||
//! \return
|
/** \return The previous sibling node from this node or 0 if this is
|
||||||
//! Returns the preverse sibling node from this node or 0 if this is
|
the first node from the parent node.
|
||||||
//! the first node from the parent node.
|
*/
|
||||||
virtual IGUITreeViewNode* getPrevSibling() const = 0;
|
virtual IGUITreeViewNode* getPrevSibling() const = 0;
|
||||||
|
|
||||||
//! Returns the next sibling node from this node.
|
//! Returns the next sibling node from this node.
|
||||||
//! \return
|
/** \return The next sibling node from this node or 0 if this is
|
||||||
//! Returns the next sibling node from this node or 0 if this is
|
the last node from the parent node.
|
||||||
//! the last node from the parent node.
|
*/
|
||||||
virtual IGUITreeViewNode* getNextSibling() const = 0;
|
virtual IGUITreeViewNode* getNextSibling() const = 0;
|
||||||
|
|
||||||
//! Returns the next visible (expanded, may be out of scrolling) node from this node.
|
//! Returns the next visible (expanded, may be out of scrolling) node from this node.
|
||||||
//! \return
|
/** \return The next visible node from this node or 0 if this is
|
||||||
//! Returns the next visible node from this node or 0 if this is
|
the last visible node. */
|
||||||
//! the last visible node.
|
|
||||||
virtual IGUITreeViewNode* getNextVisible() const = 0;
|
virtual IGUITreeViewNode* getNextVisible() const = 0;
|
||||||
|
|
||||||
//! Deletes a child node.
|
//! Deletes a child node.
|
||||||
// \return
|
/** \return Returns true if the node was found as a child and is deleted. */
|
||||||
//! Returns true if the node was found as a child and is deleted.
|
|
||||||
virtual bool deleteChild( IGUITreeViewNode* child ) = 0;
|
virtual bool deleteChild( IGUITreeViewNode* child ) = 0;
|
||||||
|
|
||||||
//! Moves a child node one position up.
|
//! Moves a child node one position up.
|
||||||
//! \return
|
/** \return True if the node was found as achild node and was not already the first child. */
|
||||||
//! Returns true if the node was found as achild node and was not already the first child.
|
|
||||||
virtual bool moveChildUp( IGUITreeViewNode* child ) = 0;
|
virtual bool moveChildUp( IGUITreeViewNode* child ) = 0;
|
||||||
|
|
||||||
//! Moves a child node one position down.
|
//! Moves a child node one position down.
|
||||||
//! \return
|
/** \return True if the node was found as achild node and was not already the last child. */
|
||||||
//! Returns true if the node was found as achild node and was not already the last child.
|
|
||||||
virtual bool moveChildDown( IGUITreeViewNode* child ) = 0;
|
virtual bool moveChildDown( IGUITreeViewNode* child ) = 0;
|
||||||
|
|
||||||
//! Returns true if the node is expanded (childs are visible).
|
//! Returns true if the node is expanded (childs are visible).
|
||||||
|
@ -209,7 +205,7 @@ namespace gui
|
||||||
virtual bool isRoot() const = 0;
|
virtual bool isRoot() const = 0;
|
||||||
|
|
||||||
//! Returns the level of this node.
|
//! 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;
|
virtual s32 getLevel() const = 0;
|
||||||
|
|
||||||
//! Returns true if this node is visible (all parents are expanded).
|
//! Returns true if this node is visible (all parents are expanded).
|
||||||
|
@ -218,9 +214,10 @@ namespace gui
|
||||||
|
|
||||||
|
|
||||||
//! Default tree view GUI element.
|
//! Default tree view GUI element.
|
||||||
//! Displays a windows like tree buttons to expand/collaps the child nodes of an node
|
/** Displays a windows like tree buttons to expand/collaps the child nodes of an node
|
||||||
//! and optional tree lines.
|
and optional tree lines.
|
||||||
//! Each node consits of an text, an icon text and a void pointer for user data.
|
Each node consits of an text, an icon text and a void pointer for user data.
|
||||||
|
*/
|
||||||
class IGUITreeView : public IGUIElement
|
class IGUITreeView : public IGUIElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -242,17 +239,20 @@ namespace gui
|
||||||
virtual bool getLinesVisible() const = 0;
|
virtual bool getLinesVisible() const = 0;
|
||||||
|
|
||||||
//! sets if the tree lines are visible
|
//! 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;
|
virtual void setLinesVisible( bool visible ) = 0;
|
||||||
|
|
||||||
//! Sets the font which should be used as icon font. This font is set to the Irrlicht engine
|
//! Sets the font which should be used as icon font.
|
||||||
//! built-in-font by default. Icons can be displayed in front of every list item.
|
/** This font is set to the Irrlicht engine built-in-font by
|
||||||
//! An icon is a string, displayed with the icon font. When using the build-in-font of the
|
default. Icons can be displayed in front of every list item.
|
||||||
//! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used.
|
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;
|
virtual void setIconFont( IGUIFont* font ) = 0;
|
||||||
|
|
||||||
//! Sets the image list which should be used for the image and selected image of every node.
|
//! 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;
|
virtual void setImageList( IGUIImageList* imageList ) = 0;
|
||||||
|
|
||||||
//! Returns the image list which is used for the nodes.
|
//! Returns the image list which is used for the nodes.
|
||||||
|
@ -265,7 +265,7 @@ namespace gui
|
||||||
virtual bool getImageLeftOfIcon() const = 0;
|
virtual bool getImageLeftOfIcon() const = 0;
|
||||||
|
|
||||||
//! Returns the node which is associated to the last event.
|
//! 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;
|
virtual IGUITreeViewNode* getLastEventNode() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
//! Check if the file might be loaded by this class
|
//! Check if the file might be loaded by this class
|
||||||
/** Check is based on the file extension (e.g. ".tga")
|
/** 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. */
|
\return True if file seems to be loadable. */
|
||||||
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
|
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class IImageWriter : public IReferenceCounted
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Check if this writer can write a file with the given extension
|
//! 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. */
|
\return True if file extension specifies a writable type. */
|
||||||
virtual bool isAWriteableFileExtension(const io::path& filename) const = 0;
|
virtual bool isAWriteableFileExtension(const io::path& filename) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Written by Colin MacDonald - all rights assigned to Nikolaus Gebhardt
|
// 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".
|
// This file is part of the "Irrlicht Engine".
|
||||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||||
|
|
||||||
|
@ -15,43 +15,45 @@ namespace scene
|
||||||
{
|
{
|
||||||
class ILightSceneNode;
|
class ILightSceneNode;
|
||||||
|
|
||||||
//! ILightManager provides an interface for user applications to manipulate the list
|
//! ILightManager provides an interface for user applications to manipulate the list of lights in the scene.
|
||||||
//! of lights in the scene. The light list can be trimmed or re-ordered before device/
|
/** The light list can be trimmed or re-ordered before device/ hardware
|
||||||
//! hardware lights are created, and/or individual lights can be switched on and off
|
lights are created, and/or individual lights can be switched on and off
|
||||||
//! before or after each scene node is rendered.
|
before or after each scene node is rendered. It is assumed that the
|
||||||
//! It is assumed that the ILightManager implementation will store any data that it wishes
|
ILightManager implementation will store any data that it wishes to
|
||||||
//! to retain, i.e. the ISceneManager to which it is assigned, the lightList, the current
|
retain, i.e. the ISceneManager to which it is assigned, the lightList,
|
||||||
//! render pass, and the current scene node.
|
the current render pass, and the current scene node. */
|
||||||
class ILightManager : public IReferenceCounted
|
class ILightManager : public IReferenceCounted
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Called after the scene's light list has been built, but before rendering has begun.
|
//! 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,
|
/** As actual device/hardware lights are not created until the
|
||||||
//! this provides an opportunity for the light manager to trim or re-order the light
|
ESNRP_LIGHT render pass, this provides an opportunity for the
|
||||||
//! list, before any device/hardware lights have actually been created.
|
light manager to trim or re-order the light list, before any
|
||||||
//! \param[in] smgr: the Scene Manager
|
device/hardware lights have actually been created.
|
||||||
//! \param[inout] lightLight: the Scene Manager's light list, which the light manager may
|
\param lightList: the Scene Manager's light list, which
|
||||||
//! modify. This reference will remain valid until OnPostRender().
|
the light manager may modify. This reference will remain valid
|
||||||
|
until OnPostRender().
|
||||||
|
*/
|
||||||
virtual void OnPreRender(core::array<ILightSceneNode*> & lightList) = 0;
|
virtual void OnPreRender(core::array<ILightSceneNode*> & lightList) = 0;
|
||||||
|
|
||||||
//! Called after the last scene node is rendered.
|
//! 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;
|
virtual void OnPostRender(void) = 0;
|
||||||
|
|
||||||
//! Called before a render pass begins
|
//! 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;
|
virtual void OnRenderPassPreRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
|
||||||
|
|
||||||
//! Called after the render pass specified in OnRenderPassPreRender() ends
|
//! 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;
|
virtual void OnRenderPassPostRender(E_SCENE_NODE_RENDER_PASS renderPass) = 0;
|
||||||
|
|
||||||
//! Called before the given scene node is rendered
|
//! 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;
|
virtual void OnNodePreRender(ISceneNode* node) = 0;
|
||||||
|
|
||||||
//! Called after the the node specified in OnNodePreRender() has been rendered
|
//! 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;
|
virtual void OnNodePostRender(ISceneNode* node) = 0;
|
||||||
};
|
};
|
||||||
} // end namespace scene
|
} // end namespace scene
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
//! Returns true if the file might be loaded by this class.
|
//! Returns true if the file might be loaded by this class.
|
||||||
/** This decision should be based on the file extension (e.g. ".cob")
|
/** This decision should be based on the file extension (e.g. ".cob")
|
||||||
only.
|
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. */
|
\return True if the file might be loaded by this class. */
|
||||||
virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
|
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;
|
virtual void scale(IMeshBuffer* buffer, const core::vector3df& factor) const = 0;
|
||||||
|
|
||||||
//! Scales the actual mesh, not a scene node.
|
//! Scales the actual mesh, not a scene node.
|
||||||
/** \deprecated
|
/** \deprecated Use scale() instead
|
||||||
\param mesh Mesh on which the operation is performed.
|
\param mesh Mesh on which the operation is performed.
|
||||||
\param factor Scale factor for each axis. */
|
\param factor Scale factor for each axis. */
|
||||||
virtual void scaleMesh(IMesh* mesh, const core::vector3df& factor) const {return scale(mesh,factor);}
|
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;
|
virtual void transform(IMeshBuffer* buffer, const core::matrix4& m) const = 0;
|
||||||
|
|
||||||
//! Applies a transformation to a mesh
|
//! Applies a transformation to a mesh
|
||||||
/** \deprecated
|
/** \deprecated Use transform() instead
|
||||||
\param mesh Mesh on which the operation is performed.
|
\param mesh Mesh on which the operation is performed.
|
||||||
\param m transformation matrix. */
|
\param m transformation matrix. */
|
||||||
virtual void transformMesh(IMesh* mesh, const core::matrix4& m) const {return transform(mesh,m);}
|
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
|
//! 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.
|
/** 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 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 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).
|
\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:
|
public:
|
||||||
|
|
||||||
//! Finds the collision point of a line and lots of triangles, if there is one.
|
//! 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
|
\param selector: TriangleSelector containing the triangles. It
|
||||||
can be created for example using
|
can be created for example using
|
||||||
ISceneManager::createTriangleSelector() or
|
ISceneManager::createTriangleSelector() or
|
||||||
|
@ -58,6 +58,7 @@ namespace scene
|
||||||
movement of the ellipsoid.
|
movement of the ellipsoid.
|
||||||
\param triout: Optional parameter where the last triangle
|
\param triout: Optional parameter where the last triangle
|
||||||
causing a collision is stored, if there is a collision.
|
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
|
\param outFalling: Is set to true if the ellipsoid is falling
|
||||||
down, caused by gravity.
|
down, caused by gravity.
|
||||||
\param outNode: the node with which the ellipoid collided (if any)
|
\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
|
* a dummy object in this mode. Meshes included in the
|
||||||
* scene will be added into the scene manager with the
|
* scene will be added into the scene manager with the
|
||||||
* following naming scheme:
|
* 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
|
* meshes is logged. Currently, this loader is able to
|
||||||
* create meshes (made of only polygons), lights, and
|
* create meshes (made of only polygons), lights, and
|
||||||
* cameras. Materials and animations are currently not
|
* 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& rotation = core::vector3df(0,0,0),
|
||||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 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.
|
//! Adds a cube scene node
|
||||||
/** It is a simple cube of (1,1,1) size.
|
/** \param size: Size of the cube, uniformly in each dimension.
|
||||||
\param size: Size of the cube.
|
\param parent: Parent of the scene node. Can be 0 if no parent.
|
||||||
\param parent: Parent of the scene node. Can be NULL if no parent.
|
|
||||||
\param id: Id of the node. This id can be used to identify the scene node.
|
\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
|
\param position: Position of the space relative to its parent
|
||||||
scene node will be placed.
|
where the scene node will be placed.
|
||||||
\param rotation: Initital rotation of the scene node.
|
\param rotation: Initital rotation of the scene node.
|
||||||
\param scale: Initial scale of the scene node.
|
\param scale: Initial scale of the scene node.
|
||||||
\return Pointer to the created test scene node. This
|
\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& rotation = core::vector3df(0,0,0),
|
||||||
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f)) = 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.
|
//! Adds a sphere scene node of the given radius and detail
|
||||||
/** It is a simple sphere.
|
/** \param radius: Radius of the sphere.
|
||||||
\param radius: Radius of the sphere.
|
\param polyCount: Polycount of the sphere, i.e. subdivision in
|
||||||
\param polyCount: Polycount of the sphere.
|
horizontal and vertical direction.
|
||||||
\param parent: Parent of the scene node. Can be NULL if no parent.
|
\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 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
|
\param position: Position of the space relative to its parent
|
||||||
scene node will be placed.
|
where the scene node will be placed.
|
||||||
\param rotation: Initital rotation of the scene node.
|
\param rotation: Initital rotation of the scene node.
|
||||||
\param scale: Initial scale of the scene node.
|
\param scale: Initial scale of the scene node.
|
||||||
\return Pointer to the created test scene node. This
|
\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,
|
\param parent: Parent scene node of the camera. Can be null. If the parent moves,
|
||||||
the camera will move too.
|
the camera will move too.
|
||||||
\param id: id of the camera. This id can be used to identify 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 Pointer to interface to camera if successful, otherwise 0.
|
\return Pointer to interface to camera if successful, otherwise 0.
|
||||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
||||||
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
|
virtual ICameraSceneNode* addCameraSceneNode(ISceneNode* parent = 0,
|
||||||
const core::vector3df& position = core::vector3df(0,0,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.
|
//! 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
|
/** This is a standard camera with an animator that provides mouse control similar
|
||||||
to camera in the 3D Software Maya by Alias Wavefront.
|
to camera in the 3D Software Maya by Alias Wavefront.
|
||||||
\param parent: Parent scene node of the camera. Can be null.
|
\param parent: Parent scene node of the camera. Can be null.
|
||||||
\param rotateSpeed: Rotation speed of the camera.
|
\param rotateSpeed: Rotation speed of the camera.
|
||||||
\param zoomSpeed: Zoom speed of the camera.
|
\param zoomSpeed: Zoom speed of the camera.
|
||||||
\param translationSpeed: TranslationSpeed 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 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.
|
\param makeActive Flag whether this camera should become the active one.
|
||||||
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
|
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,
|
virtual ICameraSceneNode* addCameraSceneNodeMaya(ISceneNode* parent = 0,
|
||||||
f32 rotateSpeed = -1500.0f, f32 zoomSpeed = 200.0f,
|
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).
|
//! 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
|
/** 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
|
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
|
moved up, the default is 'false' which means it will follow the
|
||||||
movement of the mouse cursor.
|
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,
|
\return Pointer to the interface of the camera if successful,
|
||||||
otherwise 0. This pointer should not be dropped. See
|
otherwise 0. This pointer should not be dropped. See
|
||||||
IReferenceCounted::drop() for more information. */
|
IReferenceCounted::drop() for more information. */
|
||||||
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
|
virtual ICameraSceneNode* addCameraSceneNodeFPS(ISceneNode* parent = 0,
|
||||||
f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
|
f32 rotateSpeed = 100.0f, f32 moveSpeed = 0.5f, s32 id=-1,
|
||||||
SKeyMap* keyMapArray=0, s32 keyMapSize=0, bool noVerticalMovement=false,
|
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.
|
//! Adds a dynamic light scene node to the scene graph.
|
||||||
/** The light will cast dynamic light on all
|
/** The light will cast dynamic light on all
|
||||||
|
@ -692,6 +700,7 @@ namespace scene
|
||||||
\param spherePercentage: How much of the sphere is drawn.
|
\param spherePercentage: How much of the sphere is drawn.
|
||||||
Value should be between 0 and 2, where 1 is an exact
|
Value should be between 0 and 2, where 1 is an exact
|
||||||
half-sphere and 2 is a full sphere.
|
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,
|
\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
|
so this should be null. Note: If a parent is set, the dome will not
|
||||||
change how it is drawn.
|
change how it is drawn.
|
||||||
|
@ -1098,6 +1107,8 @@ namespace scene
|
||||||
move from the start point to the end point.
|
move from the start point to the end point.
|
||||||
\param loop: If set to false, the node stops when the end point is reached.
|
\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.
|
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()
|
\return The animator. Attach it to a scene node with ISceneNode::addAnimator()
|
||||||
and the animator will animate it.
|
and the animator will animate it.
|
||||||
If you no longer need the animator, you should call ISceneNodeAnimator::drop().
|
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;
|
virtual ITriangleSelector* createTriangleSelector(IMesh* mesh, ISceneNode* node) = 0;
|
||||||
|
|
||||||
//! Creates a simple ITriangleSelector, based on an animated mesh scene node.
|
//! Creates a simple ITriangleSelector, based on an animated mesh scene node.
|
||||||
//! Details of the mesh associated with the node will be extracted internally.
|
/** Details of the mesh associated with the node will be extracted internally.
|
||||||
//! Call ITriangleSelector::update() to have the triangle selector updated based
|
Call ITriangleSelector::update() to have the triangle selector updated based
|
||||||
//! on the current frame of the animated mesh scene node.
|
on the current frame of the animated mesh scene node.
|
||||||
//! \param: The animated mesh scene node from which to build the selector
|
\param node The animated mesh scene node from which to build the selector
|
||||||
|
*/
|
||||||
virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
|
virtual ITriangleSelector* createTriangleSelector(IAnimatedMeshSceneNode* node) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,14 @@ namespace video
|
||||||
EFT_FOG_EXP2
|
EFT_FOG_EXP2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const c8* const FogTypeNames[] =
|
||||||
|
{
|
||||||
|
"FogExp",
|
||||||
|
"FogLinear",
|
||||||
|
"FogExp2",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
struct SOverrideMaterial
|
struct SOverrideMaterial
|
||||||
{
|
{
|
||||||
//! The Material values
|
//! The Material values
|
||||||
|
@ -396,7 +404,7 @@ namespace video
|
||||||
example in picture edit programs. To avoid this problem, you
|
example in picture edit programs. To avoid this problem, you
|
||||||
could use the makeColorKeyTexture method, which takes the
|
could use the makeColorKeyTexture method, which takes the
|
||||||
position of a pixel instead a color value.
|
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
|
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
|
(i.e. black). This behaviour matches the legacy (buggy) behaviour prior
|
||||||
to release 1.5 and is provided for backwards compatibility only.*/
|
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
|
\param colorKeyPixelPos Position of a pixel with the color key
|
||||||
color. Every texel with this color will become fully transparent as
|
color. Every texel with this color will become fully transparent as
|
||||||
described above.
|
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
|
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
|
(i.e. black). This behaviour matches the legacy (buggy) behaviour prior
|
||||||
to release 1.5 and is provided for backwards compatibility only.*/
|
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 vertexCount Amount of vertices in the array.
|
||||||
\param indexList Pointer to array of indices.
|
\param indexList Pointer to array of indices.
|
||||||
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
||||||
virtual void drawIndexedTriangleList(const S3DVertex* vertices,
|
void drawIndexedTriangleList(const S3DVertex* vertices,
|
||||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||||
|
{
|
||||||
|
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||||
|
}
|
||||||
|
|
||||||
//! Draws an indexed triangle list.
|
//! Draws an indexed triangle list.
|
||||||
/** Note that there may be at maximum 65536 vertices, because
|
/** 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 vertexCount Amount of vertices in the array.
|
||||||
\param indexList Pointer to array of indices.
|
\param indexList Pointer to array of indices.
|
||||||
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
||||||
virtual void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,
|
void drawIndexedTriangleList(const S3DVertex2TCoords* vertices,
|
||||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||||
|
{
|
||||||
|
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_2TCOORDS, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||||
|
}
|
||||||
|
|
||||||
//! Draws an indexed triangle list.
|
//! Draws an indexed triangle list.
|
||||||
/** Note that there may be at maximum 65536 vertices, because
|
/** 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 vertexCount Amount of vertices in the array.
|
||||||
\param indexList Pointer to array of indices.
|
\param indexList Pointer to array of indices.
|
||||||
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
\param triangleCount Amount of Triangles. Usually amount of indices / 3. */
|
||||||
virtual void drawIndexedTriangleList(const S3DVertexTangents* vertices,
|
void drawIndexedTriangleList(const S3DVertexTangents* vertices,
|
||||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
u32 vertexCount, const u16* indexList, u32 triangleCount)
|
||||||
|
{
|
||||||
|
drawVertexPrimitiveList(vertices, vertexCount, indexList, triangleCount, EVT_TANGENTS, scene::EPT_TRIANGLES, EIT_16BIT);
|
||||||
|
}
|
||||||
|
|
||||||
//! Draws an indexed triangle fan.
|
//! Draws an indexed triangle fan.
|
||||||
/** Note that there may be at maximum 65536 vertices, because
|
/** 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 vertexCount Amount of vertices in the array.
|
||||||
\param indexList Pointer to array of indices.
|
\param indexList Pointer to array of indices.
|
||||||
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
||||||
virtual void drawIndexedTriangleFan(const S3DVertex* vertices,
|
void drawIndexedTriangleFan(const S3DVertex* vertices,
|
||||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
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.
|
//! Draws an indexed triangle fan.
|
||||||
/** Note that there may be at maximum 65536 vertices, because
|
/** 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 vertexCount Amount of vertices in the array.
|
||||||
\param indexList Pointer to array of indices.
|
\param indexList Pointer to array of indices.
|
||||||
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
\param triangleCount Amount of Triangles. Usually amount of indices - 2. */
|
||||||
virtual void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
|
void drawIndexedTriangleFan(const S3DVertex2TCoords* vertices,
|
||||||
u32 vertexCount, const u16* indexList, u32 triangleCount) =0;
|
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.
|
//! Draws a 3d line.
|
||||||
/** For some implementations, this method simply calls
|
/** 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
|
Note that the line is drawn using the current transformation
|
||||||
matrix and material. So if you need to draw the 3D line
|
matrix and material. So if you need to draw the 3D line
|
||||||
independently of the current transformation, use
|
independently of the current transformation, use
|
||||||
\code
|
\code
|
||||||
driver->setMaterial(unlitMaterial);
|
driver->setMaterial(someMaterial);
|
||||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||||
\endcode
|
\endcode
|
||||||
for some properly set up material before drawing the line.
|
for some properly set up material before drawing the line.
|
||||||
Some drivers support line thickness set in the material.
|
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;
|
const core::vector3df& end, SColor color = SColor(255,255,255,255)) =0;
|
||||||
|
|
||||||
//! Draws a 3d triangle.
|
//! 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
|
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
|
Note that the triangle is drawn using the current
|
||||||
transformation matrix and material. So if you need to draw it
|
transformation matrix and material. So if you need to draw it
|
||||||
independently of the current transformation, use
|
independently of the current transformation, use
|
||||||
\code
|
\code
|
||||||
driver->setMaterial(unlitMaterial);
|
driver->setMaterial(someMaterial);
|
||||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||||
\endcode
|
\endcode
|
||||||
for some properly set up material before drawing the triangle.
|
for some properly set up material before drawing the triangle.
|
||||||
\param triangle The triangle to draw.
|
\param triangle The triangle to draw.
|
||||||
|
@ -640,8 +678,8 @@ namespace video
|
||||||
matrix and material. So if you need to draw it independently of
|
matrix and material. So if you need to draw it independently of
|
||||||
the current transformation, use
|
the current transformation, use
|
||||||
\code
|
\code
|
||||||
driver->setMaterial(unlitMaterial);
|
driver->setMaterial(someMaterial);
|
||||||
driver->setTransform(video::ETS_WORLD, core::matrix4());
|
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
|
||||||
\endcode
|
\endcode
|
||||||
for some properly set up material before drawing the box.
|
for some properly set up material before drawing the box.
|
||||||
\param box The axis aligned box to draw
|
\param box The axis aligned box to draw
|
||||||
|
@ -864,8 +902,7 @@ namespace video
|
||||||
/** These are global values attached to each 3d object rendered,
|
/** These are global values attached to each 3d object rendered,
|
||||||
which has the fog flag enabled in its material.
|
which has the fog flag enabled in its material.
|
||||||
\param color Color of the fog
|
\param color Color of the fog
|
||||||
\param linearFog Set this to true for linear fog, otherwise
|
\param fogType Type of fog used
|
||||||
exponential fog is applied.
|
|
||||||
\param start Only used in linear fog mode (linearFog=true).
|
\param start Only used in linear fog mode (linearFog=true).
|
||||||
Specifies where fog starts.
|
Specifies where fog starts.
|
||||||
\param end Only used in linear fog mode (linearFog=true).
|
\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,
|
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
|
||||||
bool pixelFog=false, bool rangeFog=false) =0;
|
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
|
//! Get the current color format of the color buffer
|
||||||
/** \return Color format of the color buffer. */
|
/** \return Color format of the color buffer. */
|
||||||
virtual ECOLOR_FORMAT getColorFormat() const =0;
|
virtual ECOLOR_FORMAT getColorFormat() const =0;
|
||||||
|
@ -965,7 +1007,7 @@ namespace video
|
||||||
|
|
||||||
//! Returns the maximum amount of primitives
|
//! Returns the maximum amount of primitives
|
||||||
/** (mostly vertices) which the device is able to render with
|
/** (mostly vertices) which the device is able to render with
|
||||||
one drawIndexedTriangleList call.
|
one drawVertexPrimitiveList call.
|
||||||
\return Maximum amount of primitives. */
|
\return Maximum amount of primitives. */
|
||||||
virtual u32 getMaximalPrimitiveCount() const =0;
|
virtual u32 getMaximalPrimitiveCount() const =0;
|
||||||
|
|
||||||
|
@ -1253,6 +1295,9 @@ namespace video
|
||||||
Use the SceneManager attribute to set this value from your app.
|
Use the SceneManager attribute to set this value from your app.
|
||||||
\param flag Default behavior is to disable ZWrite, i.e. false. */
|
\param flag Default behavior is to disable ZWrite, i.e. false. */
|
||||||
virtual void setAllowZWriteOnTransparent(bool flag) =0;
|
virtual void setAllowZWriteOnTransparent(bool flag) =0;
|
||||||
|
|
||||||
|
//! Returns the maximum texture size supported.
|
||||||
|
virtual core::dimension2du getMaxTextureSize() const =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#define IRRLICHT_VERSION_REVISION 0
|
#define IRRLICHT_VERSION_REVISION 0
|
||||||
// This flag will be defined only in SVN, the official release code will have
|
// This flag will be defined only in SVN, the official release code will have
|
||||||
// it undefined
|
// it undefined
|
||||||
#define IRRLICHT_VERSION_SVN
|
//#define IRRLICHT_VERSION_SVN
|
||||||
#define IRRLICHT_SDK_VERSION "1.6-SVN"
|
#define IRRLICHT_SDK_VERSION "1.6"
|
||||||
|
|
||||||
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
|
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
|
||||||
|
|
||||||
|
@ -92,10 +92,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
|
#if !defined(_IRR_WINDOWS_API_) && !defined(_IRR_OSX_PLATFORM_)
|
||||||
#if defined(__sparc__) || defined(__sun__)
|
#ifndef _IRR_SOLARIS_PLATFORM_
|
||||||
#define __BIG_ENDIAN__
|
|
||||||
#define _IRR_SOLARIS_PLATFORM_
|
|
||||||
#else
|
|
||||||
#define _IRR_LINUX_PLATFORM_
|
#define _IRR_LINUX_PLATFORM_
|
||||||
#endif
|
#endif
|
||||||
#define _IRR_POSIX_API_
|
#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))
|
#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
|
//! 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_
|
#define _IRR_COMPILE_WITH_DIRECT3D_9_
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -509,6 +506,10 @@ precision will be lower but speed higher. currently X86 only
|
||||||
#undef _IRR_WCHAR_FILESYSTEM
|
#undef _IRR_WCHAR_FILESYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__sparc__) || defined(__sun__)
|
||||||
|
#define __BIG_ENDIAN__
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_IRR_SOLARIS_PLATFORM_)
|
#if defined(_IRR_SOLARIS_PLATFORM_)
|
||||||
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
#undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -191,13 +191,19 @@ namespace video
|
||||||
0 means no blue, 255 means full blue. */
|
0 means no blue, 255 means full blue. */
|
||||||
u32 getBlue() const { return color & 0xff; }
|
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
|
f32 getLuminance() const
|
||||||
{
|
{
|
||||||
return 0.3f*getRed() + 0.59f*getGreen() + 0.11f*getBlue();
|
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
|
u32 getAverage() const
|
||||||
{
|
{
|
||||||
return ( getRed() + getGreen() + getBlue() ) / 3;
|
return ( getRed() + getGreen() + getBlue() ) / 3;
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace scene
|
||||||
const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const;
|
const core::matrix4& getTransform( video::E_TRANSFORMATION_STATE state) const;
|
||||||
|
|
||||||
//! clips a line to the view frustum.
|
//! 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;
|
bool clipLine(core::line3d<f32>& line) const;
|
||||||
|
|
||||||
//! the position of the camera
|
//! the position of the camera
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
//! set a new allocation strategy
|
//! set a new allocation strategy
|
||||||
/** if the maximum size of the array is unknown, you can define how big the
|
/** if the maximum size of the array is unknown, you can define how big the
|
||||||
allocation should happen.
|
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 )
|
void setAllocStrategy ( eAllocStrategy newStrategy = ALLOC_STRATEGY_DOUBLE )
|
||||||
{
|
{
|
||||||
strategy = newStrategy;
|
strategy = newStrategy;
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace core
|
||||||
|
|
||||||
//! Rounding error constant often used when comparing f32 values.
|
//! 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 f32 ROUNDING_ERROR_f32 = 0.000001f;
|
||||||
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
const f64 ROUNDING_ERROR_f64 = 0.00000001;
|
||||||
|
|
||||||
|
@ -450,7 +450,6 @@ namespace core
|
||||||
// calculate: 1 / x
|
// calculate: 1 / x
|
||||||
REALINLINE f32 reciprocal( const f32 f )
|
REALINLINE f32 reciprocal( const f32 f )
|
||||||
{
|
{
|
||||||
_IRR_DEBUG_BREAK_IF(f==0.f); //divide by zero
|
|
||||||
#if defined (IRRLICHT_FAST_MATH)
|
#if defined (IRRLICHT_FAST_MATH)
|
||||||
|
|
||||||
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
||||||
|
@ -484,7 +483,6 @@ namespace core
|
||||||
// calculate: 1 / x
|
// calculate: 1 / x
|
||||||
REALINLINE f64 reciprocal ( const f64 f )
|
REALINLINE f64 reciprocal ( const f64 f )
|
||||||
{
|
{
|
||||||
_IRR_DEBUG_BREAK_IF(f==0.); //divide by zero
|
|
||||||
return 1.0 / f;
|
return 1.0 / f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +490,6 @@ namespace core
|
||||||
// calculate: 1 / x, low precision allowed
|
// calculate: 1 / x, low precision allowed
|
||||||
REALINLINE f32 reciprocal_approxim ( const f32 f )
|
REALINLINE f32 reciprocal_approxim ( const f32 f )
|
||||||
{
|
{
|
||||||
_IRR_DEBUG_BREAK_IF(f==0.f); //divide by zero
|
|
||||||
#if defined( IRRLICHT_FAST_MATH)
|
#if defined( IRRLICHT_FAST_MATH)
|
||||||
|
|
||||||
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
// SSE Newton-Raphson reciprocal estimate, accurate to 23 significant
|
||||||
|
|
|
@ -124,8 +124,7 @@ public:
|
||||||
|
|
||||||
// temporary buffer for 16 numbers
|
// temporary buffer for 16 numbers
|
||||||
|
|
||||||
c8 tmpbuf[16];
|
c8 tmpbuf[16]={0};
|
||||||
tmpbuf[15] = 0;
|
|
||||||
u32 idx = 15;
|
u32 idx = 15;
|
||||||
|
|
||||||
// special case '0'
|
// special case '0'
|
||||||
|
@ -164,8 +163,7 @@ public:
|
||||||
{
|
{
|
||||||
// temporary buffer for 16 numbers
|
// temporary buffer for 16 numbers
|
||||||
|
|
||||||
c8 tmpbuf[16];
|
c8 tmpbuf[16]={0};
|
||||||
tmpbuf[15] = 0;
|
|
||||||
u32 idx = 15;
|
u32 idx = 15;
|
||||||
|
|
||||||
// special case '0'
|
// special case '0'
|
||||||
|
@ -222,7 +220,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~string()
|
~string()
|
||||||
{
|
{
|
||||||
allocator.deallocate(array); // delete [] array;
|
allocator.deallocate(array); // delete [] array;
|
||||||
}
|
}
|
||||||
|
@ -737,10 +735,11 @@ public:
|
||||||
|
|
||||||
//! finds another string in this string
|
//! finds another string in this string
|
||||||
/** \param str: Another string
|
/** \param str: Another string
|
||||||
|
\param start: Start position of the search
|
||||||
\return Positions where the string has been found,
|
\return Positions where the string has been found,
|
||||||
or -1 if not found. */
|
or -1 if not found. */
|
||||||
template <class B>
|
template <class B>
|
||||||
s32 find(const B* const str) const
|
s32 find(const B* const str, const u32 start = 0) const
|
||||||
{
|
{
|
||||||
if (str && *str)
|
if (str && *str)
|
||||||
{
|
{
|
||||||
|
@ -752,7 +751,7 @@ public:
|
||||||
if (len > used-1)
|
if (len > used-1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (u32 i=0; i<used-len; ++i)
|
for (u32 i=start; i<used-len; ++i)
|
||||||
{
|
{
|
||||||
u32 j=0;
|
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.
|
//! Trims the string.
|
||||||
/** Removes the specified characters (by default, Latin-1 whitespace)
|
/** Removes the specified characters (by default, Latin-1 whitespace)
|
||||||
from the begining and the end of the string. */
|
from the begining and the end of the string. */
|
||||||
|
@ -942,7 +1022,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//! gets the last char of a string or null
|
//! gets the last char of a string or null
|
||||||
inline T lastChar() const
|
T lastChar() const
|
||||||
{
|
{
|
||||||
return used > 1 ? array[used-2] : 0;
|
return used > 1 ? array[used-2] : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,12 +122,15 @@ typedef unsigned short wchar_t;
|
||||||
namespace irr
|
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)
|
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||||
//! 16 bit character variable. Used for unicode Filesystem and unicode strings
|
|
||||||
typedef wchar_t fschar_t;
|
typedef wchar_t fschar_t;
|
||||||
#else
|
#else
|
||||||
//! 8 bit character variable. Used for ansi Filesystem and non-unicode strings
|
|
||||||
typedef char fschar_t;
|
typedef char fschar_t;
|
||||||
#endif
|
#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
|
/** some compilers can create those by directly writing the
|
||||||
code like 'code', but some generate warnings so we use this macro here */
|
code like 'code', but some generate warnings so we use this macro here */
|
||||||
#define MAKE_IRR_ID(c0, c1, c2, c3) \
|
#define MAKE_IRR_ID(c0, c1, c2, c3) \
|
||||||
((u32)(u8)(c0) | ((u32)(u8)(c1) << 8) | \
|
((irr::u32)(irr::u8)(c0) | ((irr::u32)(irr::u8)(c1) << 8) | \
|
||||||
((u32)(u8)(c2) << 16) | ((u32)(u8)(c3) << 24 ))
|
((irr::u32)(irr::u8)(c2) << 16) | ((irr::u32)(irr::u8)(c3) << 24 ))
|
||||||
|
|
||||||
#endif // __IRR_TYPES_H_INCLUDED__
|
#endif // __IRR_TYPES_H_INCLUDED__
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
Here you'll find any information you'll need to develop applications with
|
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,
|
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>
|
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
|
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
|
this documentation is an important part of it. If you have any questions or
|
||||||
|
@ -522,7 +522,7 @@ namespace io
|
||||||
bool deleteCallback = false);
|
bool deleteCallback = false);
|
||||||
|
|
||||||
|
|
||||||
/*! \file irrxml.h
|
/*! \file irrXML.h
|
||||||
\brief Header file of the irrXML, the Irrlicht XML parser.
|
\brief Header file of the irrXML, the Irrlicht XML parser.
|
||||||
|
|
||||||
This file includes everything needed for using irrXML,
|
This file includes everything needed for using irrXML,
|
||||||
|
@ -534,7 +534,7 @@ namespace io
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
It is also common to use the two namespaces in which irrXML is included,
|
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
|
\code
|
||||||
#include <irrXML.h>
|
#include <irrXML.h>
|
||||||
|
|
|
@ -184,7 +184,7 @@
|
||||||
#include "vector2d.h"
|
#include "vector2d.h"
|
||||||
#include "vector3d.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>
|
* <div align="center"><img src="logobig.png" ></div>
|
||||||
*
|
*
|
||||||
|
@ -357,7 +357,7 @@ namespace irr
|
||||||
// THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
|
// THE FOLLOWING IS AN EMPTY LIST OF ALL SUB NAMESPACES
|
||||||
// EXISTING ONLY FOR THE DOCUMENTATION SOFTWARE DOXYGEN.
|
// 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
|
namespace core
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -367,14 +367,12 @@ namespace irr
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//! This namespace provides interfaces for input/output: Reading and
|
//! This namespace provides interfaces for input/output: Reading and writing files, accessing zip archives, xml files, ...
|
||||||
//! writing files, accessing zip archives, xml files, ...
|
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//! All scene management can be found in this namespace: Mesh loading,
|
//! All scene management can be found in this namespace: Mesh loading, special scene nodes like octrees and billboards, ...
|
||||||
//! special scene nodes like octrees and billboards, ...
|
|
||||||
namespace scene
|
namespace scene
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -391,4 +389,3 @@ namespace irr
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -310,9 +310,9 @@ namespace core
|
||||||
*/
|
*/
|
||||||
CMatrix4<T>& buildRotateFromTo(const core::vector3df& from, const core::vector3df& to);
|
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
|
//! Builds a combined matrix which translates to a center before rotation and translates from origin afterwards
|
||||||
/** \param from: vector to rotate from
|
/** \param center Position to rotate around
|
||||||
\param to: vector to rotate to
|
\param translate Translation applied after the rotation
|
||||||
*/
|
*/
|
||||||
void setRotationCenter(const core::vector3df& center, const core::vector3df& translate);
|
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
|
//! 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>
|
template <class T>
|
||||||
inline void CMatrix4<T>::setRotationCenter(const core::vector3df& center, const core::vector3df& translation)
|
inline void CMatrix4<T>::setRotationCenter(const core::vector3df& center, const core::vector3df& translation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace irr
|
||||||
namespace io
|
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;
|
typedef core::string<fschar_t> path;
|
||||||
|
|
||||||
} // io
|
} // io
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace irr
|
||||||
{
|
{
|
||||||
namespace core
|
namespace core
|
||||||
{
|
{
|
||||||
|
|
||||||
// Use typedefs where possible as they are more explicit...
|
// Use typedefs where possible as they are more explicit...
|
||||||
|
|
||||||
//! \deprecated position2d is now a synonym for vector2d, but vector2d should be used directly.
|
//! \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
|
#define position2d vector2d
|
||||||
|
|
||||||
#endif // __IRR_POSITION_H_INCLUDED__
|
#endif // __IRR_POSITION_H_INCLUDED__
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class quaternion
|
||||||
matrix4 getMatrix() const;
|
matrix4 getMatrix() const;
|
||||||
|
|
||||||
//! Creates a matrix from this quaternion
|
//! 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
|
Creates a matrix from this quaternion
|
||||||
|
@ -102,7 +102,7 @@ class quaternion
|
||||||
lookat *= m3;
|
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
|
//! Creates a matrix from this quaternion
|
||||||
inline void getMatrix_transposed( matrix4 &dest ) const;
|
inline void getMatrix_transposed( matrix4 &dest ) const;
|
||||||
|
@ -339,10 +339,9 @@ inline void quaternion::getMatrix( matrix4 &dest, const core::vector3df ¢er
|
||||||
m2.setInverseTranslation ( center );
|
m2.setInverseTranslation ( center );
|
||||||
lookat *= m2;
|
lookat *= m2;
|
||||||
*/
|
*/
|
||||||
inline void quaternion::getMatrixCenter( matrix4 &dest,
|
inline void quaternion::getMatrixCenter(matrix4 &dest,
|
||||||
const core::vector3df ¢er,
|
const core::vector3df ¢er,
|
||||||
const core::vector3df &translation
|
const core::vector3df &translation) const
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
f32 * m = dest.pointer();
|
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
|
Psionic
|
||||||
|
|
||||||
http://www.psionic3d.co.uk
|
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\14.Win32Window\main.cpp >>tut.txt
|
||||||
..\sed.exe -f tutorials.sed ..\..\..\examples\15.LoadIrrFile\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\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
|
..\doxygen.exe doxygen.cfg
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
rm tut.txt || true;
|
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;
|
sed -f tutorials.sed $i >>tut.txt;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,6 @@ namespace scene
|
||||||
virtual void calculateBoundingBox();
|
virtual void calculateBoundingBox();
|
||||||
|
|
||||||
u32 FrameCount;
|
u32 FrameCount;
|
||||||
s32 TriangleCount;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,7 @@ void CAnimatedMeshSceneNode::render()
|
||||||
{
|
{
|
||||||
video::SMaterial debug_mat;
|
video::SMaterial debug_mat;
|
||||||
debug_mat.Lighting = false;
|
debug_mat.Lighting = false;
|
||||||
|
debug_mat.AntiAliasing=0;
|
||||||
driver->setMaterial(debug_mat);
|
driver->setMaterial(debug_mat);
|
||||||
// show normals
|
// show normals
|
||||||
if (DebugDataVisible & scene::EDS_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
|
//! returns the axis aligned bounding box of this node
|
||||||
const core::aabbox3d<f32>& CAnimatedMeshSceneNode::getBoundingBox() const
|
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("Looping", Looping);
|
||||||
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
|
out->addBool("ReadOnlyMaterials", ReadOnlyMaterials);
|
||||||
out->addFloat("FramesPerSecond", FramesPerSecond);
|
out->addFloat("FramesPerSecond", FramesPerSecond);
|
||||||
|
out->addInt("StartFrame", StartFrame);
|
||||||
// TODO: write animation names instead of frame begin and ends
|
out->addInt("EndFrame", EndFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -783,6 +790,8 @@ void CAnimatedMeshSceneNode::deserializeAttributes(io::IAttributes* in, io::SAtt
|
||||||
Looping = in->getAttributeAsBool("Looping");
|
Looping = in->getAttributeAsBool("Looping");
|
||||||
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
|
ReadOnlyMaterials = in->getAttributeAsBool("ReadOnlyMaterials");
|
||||||
FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");
|
FramesPerSecond = in->getAttributeAsFloat("FramesPerSecond");
|
||||||
|
StartFrame = in->getAttributeAsInt("StartFrame");
|
||||||
|
EndFrame = in->getAttributeAsInt("EndFrame");
|
||||||
|
|
||||||
if (newMeshStr != "" && oldMeshStr != newMeshStr)
|
if (newMeshStr != "" && oldMeshStr != newMeshStr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,9 +57,12 @@ namespace scene
|
||||||
//! playback has ended. Set this to 0 to disable the callback again.
|
//! playback has ended. Set this to 0 to disable the callback again.
|
||||||
virtual void setAnimationEndCallback(IAnimationEndCallBack* callback=0);
|
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);
|
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
|
//! returns the material based on the zero based index i. To get the amount
|
||||||
//! of materials used by this scene node, use getMaterialCount().
|
//! of materials used by this scene node, use getMaterialCount().
|
||||||
//! This function is needed for inserting the node into the scene hirachy on a
|
//! 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)
|
virtual void setTexture(video::ITexture* value)
|
||||||
{
|
{
|
||||||
|
if ( value == Value )
|
||||||
|
return;
|
||||||
|
|
||||||
if (Value)
|
if (Value)
|
||||||
Value->drop();
|
Value->drop();
|
||||||
|
|
||||||
|
|
|
@ -234,6 +234,16 @@ void CCameraSceneNode::recalculateProjectionMatrix()
|
||||||
//! prerender
|
//! prerender
|
||||||
void CCameraSceneNode::OnRegisterSceneNode()
|
void CCameraSceneNode::OnRegisterSceneNode()
|
||||||
{
|
{
|
||||||
|
if ( SceneManager->getActiveCamera () == this )
|
||||||
|
SceneManager->registerNodeForRendering(this, ESNRP_CAMERA);
|
||||||
|
|
||||||
|
ISceneNode::OnRegisterSceneNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! render
|
||||||
|
void CCameraSceneNode::render()
|
||||||
|
{
|
||||||
core::vector3df pos = getAbsolutePosition();
|
core::vector3df pos = getAbsolutePosition();
|
||||||
core::vector3df tgtv = Target - pos;
|
core::vector3df tgtv = Target - pos;
|
||||||
tgtv.normalize();
|
tgtv.normalize();
|
||||||
|
@ -245,7 +255,7 @@ void CCameraSceneNode::OnRegisterSceneNode()
|
||||||
|
|
||||||
f32 dp = tgtv.dotProduct(up);
|
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;
|
up.X += 0.5f;
|
||||||
}
|
}
|
||||||
|
@ -254,16 +264,6 @@ void CCameraSceneNode::OnRegisterSceneNode()
|
||||||
ViewArea.getTransform(video::ETS_VIEW) *= Affector;
|
ViewArea.getTransform(video::ETS_VIEW) *= Affector;
|
||||||
recalculateViewArea();
|
recalculateViewArea();
|
||||||
|
|
||||||
if ( SceneManager->getActiveCamera () == this )
|
|
||||||
SceneManager->registerNodeForRendering(this, ESNRP_CAMERA);
|
|
||||||
|
|
||||||
ISceneNode::OnRegisterSceneNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! render
|
|
||||||
void CCameraSceneNode::render()
|
|
||||||
{
|
|
||||||
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
video::IVideoDriver* driver = SceneManager->getVideoDriver();
|
||||||
if ( driver)
|
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
|
||||||
} // 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.
|
//! Queries if the camera scene node's rotation and its target position are bound together.
|
||||||
virtual bool getTargetAndRotationBinding(void) const;
|
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:
|
protected:
|
||||||
|
|
||||||
void recalculateProjectionMatrix();
|
void recalculateProjectionMatrix();
|
||||||
|
|
|
@ -151,7 +151,7 @@ bool CD3D8Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
||||||
#if defined( _IRR_XBOX_PLATFORM_)
|
#if defined( _IRR_XBOX_PLATFORM_)
|
||||||
D3DCREATETYPE d3dCreate = (D3DCREATETYPE) &Direct3DCreate8;
|
D3DCREATETYPE d3dCreate = (D3DCREATETYPE) &Direct3DCreate8;
|
||||||
#else
|
#else
|
||||||
D3DLibrary = LoadLibrary( "d3d8.dll" );
|
D3DLibrary = LoadLibrary( __TEXT("d3d8.dll") );
|
||||||
|
|
||||||
if (!D3DLibrary)
|
if (!D3DLibrary)
|
||||||
{
|
{
|
||||||
|
@ -904,7 +904,19 @@ void CD3D8Driver::draw2D3DVertexPrimitiveList(const void* vertices,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
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)
|
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 video
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,9 @@ namespace video
|
||||||
//! \param enable: If true, enable the clipping plane else disable it.
|
//! \param enable: If true, enable the clipping plane else disable it.
|
||||||
virtual void enableClipPlane(u32 index, bool enable);
|
virtual void enableClipPlane(u32 index, bool enable);
|
||||||
|
|
||||||
|
//! Returns the maximum texture size supported.
|
||||||
|
virtual core::dimension2du getMaxTextureSize() const;
|
||||||
|
|
||||||
virtual bool checkDriverReset() {return DriverWasReset;}
|
virtual bool checkDriverReset() {return DriverWasReset;}
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -401,10 +401,10 @@ public:
|
||||||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||||
else
|
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);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE4X);
|
||||||
else
|
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);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE2X);
|
||||||
else
|
else
|
||||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||||
|
|
|
@ -163,7 +163,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<u32>& screenSize,
|
||||||
|
|
||||||
if (!pID3D)
|
if (!pID3D)
|
||||||
{
|
{
|
||||||
D3DLibrary = LoadLibrary( "d3d9.dll" );
|
D3DLibrary = LoadLibrary( __TEXT("d3d9.dll") );
|
||||||
|
|
||||||
if (!D3DLibrary)
|
if (!D3DLibrary)
|
||||||
{
|
{
|
||||||
|
@ -1173,7 +1173,19 @@ void CD3D9Driver::draw2D3DVertexPrimitiveList(const void* vertices,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
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)
|
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 video
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
|
||||||
|
|
|
@ -272,6 +272,9 @@ namespace video
|
||||||
/** \return Color format of the color buffer. */
|
/** \return Color format of the color buffer. */
|
||||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
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
|
//! Get the current color format of the color buffer
|
||||||
/** \return Color format of the color buffer as D3D color value. */
|
/** \return Color format of the color buffer as D3D color value. */
|
||||||
D3DFORMAT getD3DColorFormat() const;
|
D3DFORMAT getD3DColorFormat() const;
|
||||||
|
|
|
@ -377,7 +377,7 @@ public:
|
||||||
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
pID3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||||
|
|
||||||
// 127 is required by EMT_TRANSPARENT_ALPHA_CHANNEL_REF
|
// 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_ALPHAFUNC, D3DCMP_GREATEREQUAL);
|
||||||
pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
|
pID3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -431,10 +431,10 @@ public:
|
||||||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
||||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
|
||||||
else
|
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);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE4X);
|
||||||
else
|
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);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE2X);
|
||||||
else
|
else
|
||||||
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
pID3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||||
|
|
|
@ -325,7 +325,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXAssembleShader(LPCSTR pSrcData,
|
||||||
if (!pFn && !LoadFailed)
|
if (!pFn && !LoadFailed)
|
||||||
{
|
{
|
||||||
// try to load dll
|
// try to load dll
|
||||||
core::stringc strDllName = "d3dx9_";
|
io::path strDllName = "d3dx9_";
|
||||||
strDllName += (int)D3DX_SDK_VERSION;
|
strDllName += (int)D3DX_SDK_VERSION;
|
||||||
strDllName += ".dll";
|
strDllName += ".dll";
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXAssembleShaderFromFile(LPCSTR pSrcF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// invoke static linked function
|
// invoke static linked function
|
||||||
return D3DXAssembleShaderFromFile(pSrcFile, pDefines, pInclude, Flags,
|
return D3DXAssembleShaderFromFileA(pSrcFile, pDefines, pInclude, Flags,
|
||||||
ppShader, ppErrorMsgs);
|
ppShader, ppErrorMsgs);
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
|
@ -385,7 +385,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXAssembleShaderFromFile(LPCSTR pSrcF
|
||||||
if (!pFn && !LoadFailed)
|
if (!pFn && !LoadFailed)
|
||||||
{
|
{
|
||||||
// try to load dll
|
// try to load dll
|
||||||
core::stringc strDllName = "d3dx9_";
|
io::path strDllName = "d3dx9_";
|
||||||
strDllName += (int)D3DX_SDK_VERSION;
|
strDllName += (int)D3DX_SDK_VERSION;
|
||||||
strDllName += ".dll";
|
strDllName += ".dll";
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXCompileShader(LPCSTR pSrcData, UINT
|
||||||
if (!pFn && !LoadFailed)
|
if (!pFn && !LoadFailed)
|
||||||
{
|
{
|
||||||
// try to load dll
|
// try to load dll
|
||||||
core::stringc strDllName = "d3dx9_";
|
io::path strDllName = "d3dx9_";
|
||||||
strDllName += (int)D3DX_SDK_VERSION;
|
strDllName += (int)D3DX_SDK_VERSION;
|
||||||
strDllName += ".dll";
|
strDllName += ".dll";
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ HRESULT CD3D9ShaderMaterialRenderer::stubD3DXCompileShaderFromFile(LPCSTR pSrcFi
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// invoke static linked function
|
// 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
|
#else
|
||||||
{
|
{
|
||||||
// try to load shader functions from the dll and print error if failed.
|
// 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)
|
if (!pFn && !LoadFailed)
|
||||||
{
|
{
|
||||||
// try to load dll
|
// try to load dll
|
||||||
core::stringc strDllName = "d3dx9_";
|
io::path strDllName = "d3dx9_";
|
||||||
strDllName += (int)D3DX_SDK_VERSION;
|
strDllName += (int)D3DX_SDK_VERSION;
|
||||||
strDllName += ".dll";
|
strDllName += ".dll";
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,12 @@ u32 CFileList::addItem(const io::path& fullPath, u32 size, bool isDirectory, u32
|
||||||
return Files.size() - 1;
|
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 CFileList::isDirectory(u32 index) const
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
@ -107,7 +113,7 @@ bool CFileList::isDirectory(u32 index) const
|
||||||
//! Returns the size of a file
|
//! Returns the size of a file
|
||||||
u32 CFileList::getFileSize(u32 index) const
|
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 */
|
\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);
|
virtual u32 addItem(const io::path& fullPath, u32 size, bool isDirectory, u32 id=0);
|
||||||
|
|
||||||
//! Sorts the file list
|
//! Sorts the file list. You should call this after adding any items to the file list
|
||||||
void sort();
|
virtual void sort();
|
||||||
|
|
||||||
// IFileList methods
|
|
||||||
|
|
||||||
//! Returns the amount of files in the filelist.
|
//! Returns the amount of files in the filelist.
|
||||||
virtual u32 getFileCount() const;
|
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.
|
//! Gets the full name of a file in the list, path included, based on an index.
|
||||||
virtual const io::path& getFullFileName(u32 index) const;
|
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
|
//! Returns true if the file is a directory
|
||||||
virtual bool isDirectory(u32 index) const;
|
virtual bool isDirectory(u32 index) const;
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#if defined (_IRR_WINDOWS_API_)
|
#if defined (_IRR_WINDOWS_API_)
|
||||||
#if !defined ( _WIN32_WCE )
|
#if !defined ( _WIN32_WCE )
|
||||||
#include <direct.h> // for _chdir
|
#include <direct.h> // for _chdir
|
||||||
|
#include <io.h> // for _access
|
||||||
#endif
|
#endif
|
||||||
#include <io.h> // for _access
|
|
||||||
#else
|
#else
|
||||||
#if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
|
#if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -438,7 +438,7 @@ io::path CFileSystem::getAbsolutePath(const io::path& filename) const
|
||||||
#elif defined(_IRR_WINDOWS_API_)
|
#elif defined(_IRR_WINDOWS_API_)
|
||||||
|
|
||||||
#if defined(_IRR_WCHAR_FILESYSTEM )
|
#if defined(_IRR_WCHAR_FILESYSTEM )
|
||||||
c16 fpath[_MAX_PATH];
|
wchar_t fpath[_MAX_PATH];
|
||||||
p = _wfullpath(fpath, filename.c_str(), _MAX_PATH);
|
p = _wfullpath(fpath, filename.c_str(), _MAX_PATH);
|
||||||
#else
|
#else
|
||||||
c8 fpath[_MAX_PATH];
|
c8 fpath[_MAX_PATH];
|
||||||
|
@ -689,6 +689,13 @@ IFileList* CFileSystem::createFileList()
|
||||||
return r;
|
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.
|
//! determines if a file exists and would be able to be opened.
|
||||||
bool CFileSystem::existFile(const io::path& filename) const
|
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)
|
if (FileArchives[i]->getFileList()->findFile(filename)!=-1)
|
||||||
return true;
|
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;
|
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||||
|
#if defined(_MSC_VER)
|
||||||
#if defined(_IRR_WCHAR_FILESYSTEM)
|
#if defined(_IRR_WCHAR_FILESYSTEM)
|
||||||
return (_waccess(filename.c_str(), 0) != -1);
|
return (_waccess(filename.c_str(), 0) != -1);
|
||||||
#elif defined(_MSC_VER)
|
#else
|
||||||
return (_access(filename.c_str(), 0) != -1);
|
return (_access(filename.c_str(), 0) != -1);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
return (access(filename.c_str(), F_OK) != -1);
|
return (access(filename.c_str(), F_OK) != -1);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,9 @@ public:
|
||||||
//! and returns it.
|
//! and returns it.
|
||||||
virtual IFileList* createFileList();
|
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.
|
//! determines if a file exists and would be able to be opened.
|
||||||
virtual bool existFile(const io::path& filename) const;
|
virtual bool existFile(const io::path& filename) const;
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ CGUIColorSelectDialog::CGUIColorSelectDialog(const wchar_t* title, IGUIEnvironme
|
||||||
}
|
}
|
||||||
|
|
||||||
SBatteryItem item;
|
SBatteryItem item;
|
||||||
|
item.Incoming=0.f;
|
||||||
|
item.Outgoing=0.f;
|
||||||
|
|
||||||
r.UpperLeftCorner.X = Template[i].x + 15;
|
r.UpperLeftCorner.X = Template[i].x + 15;
|
||||||
r.UpperLeftCorner.Y = Template[i].y;
|
r.UpperLeftCorner.Y = Template[i].y;
|
||||||
|
@ -218,7 +220,7 @@ void CGUIColorSelectDialog::buildColorRing( const core::dimension2d<u32> & dim,
|
||||||
const f32 r = sqrtf((f32) r2);
|
const f32 r = sqrtf((f32) r2);
|
||||||
|
|
||||||
// normalize, dotproduct = xnorm
|
// 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);
|
hsl.Hue = acosf(xn);
|
||||||
if ( p.Y > 0 )
|
if ( p.Y > 0 )
|
||||||
|
|
|
@ -24,7 +24,7 @@ CGUIContextMenu::CGUIContextMenu(IGUIEnvironment* environment,
|
||||||
IGUIElement* parent, s32 id,
|
IGUIElement* parent, s32 id,
|
||||||
core::rect<s32> rectangle, bool getFocus, bool allowFocus)
|
core::rect<s32> rectangle, bool getFocus, bool allowFocus)
|
||||||
: IGUIContextMenu(environment, parent, id, rectangle), EventParent(0), LastFont(0),
|
: 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
|
#ifdef _DEBUG
|
||||||
setDebugName("CGUIContextMenu");
|
setDebugName("CGUIContextMenu");
|
||||||
|
@ -51,6 +51,17 @@ CGUIContextMenu::~CGUIContextMenu()
|
||||||
LastFont->drop();
|
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
|
//! Returns amount of menu items
|
||||||
u32 CGUIContextMenu::getItemCount() const
|
u32 CGUIContextMenu::getItemCount() const
|
||||||
|
@ -60,29 +71,57 @@ u32 CGUIContextMenu::getItemCount() const
|
||||||
|
|
||||||
|
|
||||||
//! Adds a menu item.
|
//! 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;
|
SItem s;
|
||||||
s.Enabled = enabled;
|
s.Enabled = enabled;
|
||||||
s.Checked = checked;
|
s.Checked = checked;
|
||||||
|
s.AutoChecking = autoChecking;
|
||||||
s.Text = text;
|
s.Text = text;
|
||||||
s.IsSeparator = (text == 0);
|
s.IsSeparator = (text == 0);
|
||||||
s.SubMenu = 0;
|
s.SubMenu = 0;
|
||||||
s.CommandId = id;
|
s.CommandId = commandId;
|
||||||
|
|
||||||
if (hasSubMenu)
|
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);
|
core::rect<s32>(0,0,100,100), false, false);
|
||||||
s.SubMenu->setVisible(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();
|
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.
|
//! Adds a sub menu from an element that already exists.
|
||||||
void CGUIContextMenu::setSubMenu(u32 index, CGUIContextMenu* menu)
|
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
|
//! Adds a separator item to the menu
|
||||||
void CGUIContextMenu::addSeparator()
|
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();
|
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
|
//! Returns if a menu item is enabled
|
||||||
bool CGUIContextMenu::isItemEnabled(u32 idx) const
|
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)
|
if (event.GUIEvent.Caller == this && !isMyChild(event.GUIEvent.Element) && AllowFocus)
|
||||||
{
|
{
|
||||||
// set event parent of submenus
|
// set event parent of submenus
|
||||||
setEventParent(Parent);
|
setEventParent(EventParent ? EventParent : Parent);
|
||||||
remove();
|
|
||||||
|
if ( CloseHandling & ECMC_HIDE )
|
||||||
|
{
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
if ( CloseHandling & ECMC_REMOVE )
|
||||||
|
{
|
||||||
|
remove();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -326,16 +392,20 @@ u32 CGUIContextMenu::sendClick(const core::position2d<s32>& p)
|
||||||
Items[HighLighted].SubMenu)
|
Items[HighLighted].SubMenu)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
if ( Items[HighLighted].AutoChecking )
|
||||||
|
{
|
||||||
|
Items[HighLighted].Checked = Items[HighLighted].Checked ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
SEvent event;
|
SEvent event;
|
||||||
event.EventType = EET_GUI_EVENT;
|
event.EventType = EET_GUI_EVENT;
|
||||||
event.GUIEvent.Caller = this;
|
event.GUIEvent.Caller = this;
|
||||||
event.GUIEvent.Element = 0;
|
event.GUIEvent.Element = 0;
|
||||||
event.GUIEvent.EventType = EGET_MENU_ITEM_SELECTED;
|
event.GUIEvent.EventType = EGET_MENU_ITEM_SELECTED;
|
||||||
if (Parent)
|
|
||||||
Parent->OnEvent(event);
|
|
||||||
else
|
|
||||||
if (EventParent)
|
if (EventParent)
|
||||||
EventParent->OnEvent(event);
|
EventParent->OnEvent(event);
|
||||||
|
else if (Parent)
|
||||||
|
Parent->OnEvent(event);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -644,6 +714,8 @@ void CGUIContextMenu::serializeAttributes(io::IAttributes* out, io::SAttributeRe
|
||||||
out->addInt("ParentItem", i);
|
out->addInt("ParentItem", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out->addInt("CloseHandling", (s32)CloseHandling);
|
||||||
|
|
||||||
// write out the item list
|
// write out the item list
|
||||||
out->addInt("ItemCount", Items.size());
|
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);
|
out->addInt(tmp.c_str(), Items[i].CommandId);
|
||||||
tmp = "Enabled"; tmp += i;
|
tmp = "Enabled"; tmp += i;
|
||||||
out->addBool(tmp.c_str(), Items[i].Enabled);
|
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 ) )
|
if (Parent && ( Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) )
|
||||||
((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this);
|
((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this);
|
||||||
|
|
||||||
|
CloseHandling = (ECONTEXT_MENU_CLOSE)in->getAttributeAsInt("CloseHandling");
|
||||||
|
|
||||||
removeAllItems();
|
removeAllItems();
|
||||||
|
|
||||||
|
@ -688,28 +765,37 @@ void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeR
|
||||||
{
|
{
|
||||||
core::stringc tmp;
|
core::stringc tmp;
|
||||||
core::stringw txt;
|
core::stringw txt;
|
||||||
s32 commandid;
|
s32 commandid=-1;
|
||||||
bool enabled;
|
bool enabled=true;
|
||||||
bool checked;
|
bool checked=false;
|
||||||
|
bool autochecking=false;
|
||||||
|
|
||||||
tmp = "IsSeparator"; tmp += i;
|
tmp = "IsSeparator"; tmp += i;
|
||||||
if ( in->getAttributeAsBool(tmp.c_str()) )
|
if ( in->existsAttribute(tmp.c_str()) && in->getAttributeAsBool(tmp.c_str()) )
|
||||||
addSeparator();
|
addSeparator();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp = "Text"; tmp += i;
|
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;
|
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;
|
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;
|
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
|
//! destructor
|
||||||
virtual ~CGUIContextMenu();
|
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
|
//! Returns amount of menu items
|
||||||
virtual u32 getItemCount() const;
|
virtual u32 getItemCount() const;
|
||||||
|
|
||||||
//! Adds a menu item.
|
//! Adds a menu item.
|
||||||
virtual u32 addItem(const wchar_t* text, s32 commandid,
|
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
|
//! Adds a separator item to the menu
|
||||||
virtual void addSeparator();
|
virtual void addSeparator();
|
||||||
|
@ -81,6 +94,12 @@ namespace gui
|
||||||
//! Sets the visible state of this element.
|
//! Sets the visible state of this element.
|
||||||
virtual void setVisible(bool visible);
|
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
|
//! Returns command id of a menu item
|
||||||
virtual s32 getItemCommandId(u32 idx) const;
|
virtual s32 getItemCommandId(u32 idx) const;
|
||||||
|
|
||||||
|
@ -90,6 +109,9 @@ namespace gui
|
||||||
//! Adds a sub menu from an element that already exists.
|
//! Adds a sub menu from an element that already exists.
|
||||||
virtual void setSubMenu(u32 index, CGUIContextMenu* menu);
|
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.
|
//! Writes attributes of the element.
|
||||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
||||||
|
|
||||||
|
@ -107,6 +129,7 @@ namespace gui
|
||||||
bool IsSeparator;
|
bool IsSeparator;
|
||||||
bool Enabled;
|
bool Enabled;
|
||||||
bool Checked;
|
bool Checked;
|
||||||
|
bool AutoChecking;
|
||||||
core::dimension2d<u32> Dim;
|
core::dimension2d<u32> Dim;
|
||||||
s32 PosY;
|
s32 PosY;
|
||||||
CGUIContextMenu* SubMenu;
|
CGUIContextMenu* SubMenu;
|
||||||
|
@ -130,12 +153,12 @@ namespace gui
|
||||||
//! Gets drawing rect of Item
|
//! Gets drawing rect of Item
|
||||||
virtual core::rect<s32> getRect(const SItem& i, const core::rect<s32>& absolute) const;
|
virtual core::rect<s32> getRect(const SItem& i, const core::rect<s32>& absolute) const;
|
||||||
|
|
||||||
void setEventParent(IGUIElement *parent);
|
|
||||||
|
|
||||||
core::array<SItem> Items;
|
core::array<SItem> Items;
|
||||||
core::position2d<s32> Pos;
|
core::position2d<s32> Pos;
|
||||||
IGUIElement* EventParent;
|
IGUIElement* EventParent;
|
||||||
IGUIFont *LastFont;
|
IGUIFont *LastFont;
|
||||||
|
ECONTEXT_MENU_CLOSE CloseHandling;
|
||||||
s32 HighLighted;
|
s32 HighLighted;
|
||||||
u32 ChangeTime;
|
u32 ChangeTime;
|
||||||
bool AllowFocus;
|
bool AllowFocus;
|
||||||
|
|
|
@ -978,7 +978,7 @@ IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)
|
||||||
|
|
||||||
//! Adds a message box.
|
//! Adds a message box.
|
||||||
IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t* text,
|
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)
|
if (!CurrentSkin)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -990,8 +990,8 @@ IGUIWindow* CGUIEnvironment::addMessageBox(const wchar_t* caption, const wchar_t
|
||||||
|
|
||||||
screenDim.Width = parent->getAbsolutePosition().getWidth();
|
screenDim.Width = parent->getAbsolutePosition().getWidth();
|
||||||
screenDim.Height = parent->getAbsolutePosition().getHeight();
|
screenDim.Height = parent->getAbsolutePosition().getHeight();
|
||||||
msgBoxDim.Width = CurrentSkin->getSize(gui::EGDS_MESSAGE_BOX_WIDTH);
|
msgBoxDim.Width = 2;
|
||||||
msgBoxDim.Height = CurrentSkin->getSize(gui::EGDS_MESSAGE_BOX_HEIGHT);
|
msgBoxDim.Height = 2;
|
||||||
|
|
||||||
rect.UpperLeftCorner.X = (screenDim.Width - msgBoxDim.Width) / 2;
|
rect.UpperLeftCorner.X = (screenDim.Width - msgBoxDim.Width) / 2;
|
||||||
rect.UpperLeftCorner.Y = (screenDim.Height - msgBoxDim.Height) / 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,
|
IGUIWindow* win = new CGUIMessageBox(this, caption, text, flag,
|
||||||
parent, id, rect);
|
parent, id, rect, image);
|
||||||
|
|
||||||
win->drop();
|
win->drop();
|
||||||
return win;
|
return win;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
|
|
||||||
//! Adds a message box.
|
//! Adds a message box.
|
||||||
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,
|
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.
|
//! adds a scrollbar. The returned pointer must not be dropped.
|
||||||
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
|
virtual IGUIScrollBar* addScrollBar(bool horizontal, const core::rect<s32>& rectangle,
|
||||||
|
|
|
@ -327,7 +327,9 @@ void CGUIFileOpenDialog::fillListBox()
|
||||||
FileList = FileSystem->createFileList();
|
FileList = FileSystem->createFileList();
|
||||||
core::stringw s;
|
core::stringw s;
|
||||||
|
|
||||||
|
#if !defined(_IRR_WINDOWS_CE_PLATFORM_)
|
||||||
setlocale(LC_ALL,"");
|
setlocale(LC_ALL,"");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (FileList)
|
if (FileList)
|
||||||
{
|
{
|
||||||
|
@ -339,7 +341,7 @@ void CGUIFileOpenDialog::fillListBox()
|
||||||
int len = mbstowcs(ws,cs,strlen(cs));
|
int len = mbstowcs(ws,cs,strlen(cs));
|
||||||
ws[len] = 0;
|
ws[len] = 0;
|
||||||
s = ws;
|
s = ws;
|
||||||
delete ws;
|
delete [] ws;
|
||||||
#else
|
#else
|
||||||
s = FileList->getFileName(i).c_str();
|
s = FileList->getFileName(i).c_str();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "IGUIEnvironment.h"
|
#include "IGUIEnvironment.h"
|
||||||
#include "IGUIButton.h"
|
#include "IGUIButton.h"
|
||||||
#include "IGUIFont.h"
|
#include "IGUIFont.h"
|
||||||
|
#include "ITexture.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
{
|
{
|
||||||
|
@ -18,9 +19,10 @@ namespace gui
|
||||||
//! constructor
|
//! constructor
|
||||||
CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption,
|
CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption,
|
||||||
const wchar_t* text, s32 flags,
|
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),
|
: CGUIWindow(environment, parent, id, rectangle),
|
||||||
OkButton(0), CancelButton(0), YesButton(0), NoButton(0), StaticText(0),
|
OkButton(0), CancelButton(0), YesButton(0), NoButton(0), StaticText(0),
|
||||||
|
Icon(0), IconTexture(image),
|
||||||
Flags(flags), MessageText(text), Pressed(false)
|
Flags(flags), MessageText(text), Pressed(false)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -43,6 +45,9 @@ CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* capt
|
||||||
|
|
||||||
Environment->setFocus(this);
|
Environment->setFocus(this);
|
||||||
|
|
||||||
|
if ( IconTexture )
|
||||||
|
IconTexture->grab();
|
||||||
|
|
||||||
refreshControls();
|
refreshControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,62 +69,134 @@ CGUIMessageBox::~CGUIMessageBox()
|
||||||
|
|
||||||
if (NoButton)
|
if (NoButton)
|
||||||
NoButton->drop();
|
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()
|
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();
|
const IGUISkin* skin = Environment->getSkin();
|
||||||
IGUIElement* focusMe = 0;
|
|
||||||
|
|
||||||
const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT);
|
const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT);
|
||||||
const s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH);
|
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 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
|
||||||
|
const s32 borderWidth = skin->getSize(EGDS_MESSAGE_BOX_GAP_SPACE);
|
||||||
|
|
||||||
// add static multiline text
|
// add the static text for the message
|
||||||
|
core::rect<s32> staticRect;
|
||||||
core::dimension2d<s32> dim(AbsoluteClippingRect.getWidth() - buttonWidth,
|
staticRect.UpperLeftCorner.X = borderWidth;
|
||||||
AbsoluteClippingRect.getHeight() - (buttonHeight * 2));
|
staticRect.UpperLeftCorner.Y = titleHeight + borderWidth;
|
||||||
const core::position2d<s32> pos((AbsoluteClippingRect.getWidth() - dim.Width) / 2,
|
staticRect.LowerRightCorner.X = staticRect.UpperLeftCorner.X + skin->getSize(EGDS_MESSAGE_BOX_MAX_TEST_WIDTH);
|
||||||
buttonHeight / 2 + titleHeight);
|
staticRect.LowerRightCorner.Y = staticRect.UpperLeftCorner.Y + skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT);
|
||||||
|
|
||||||
if (!StaticText)
|
if (!StaticText)
|
||||||
{
|
{
|
||||||
StaticText = Environment->addStaticText(MessageText.c_str(),
|
StaticText = Environment->addStaticText(MessageText.c_str(), staticRect, false, false, this);
|
||||||
core::rect<s32>(pos, dim), false, false, this);
|
|
||||||
StaticText->setWordWrap(true);
|
StaticText->setWordWrap(true);
|
||||||
StaticText->setSubElement(true);
|
StaticText->setSubElement(true);
|
||||||
StaticText->grab();
|
StaticText->grab();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StaticText->setRelativePosition(core::rect<s32>(pos, dim));
|
StaticText->setRelativePosition(staticRect);
|
||||||
StaticText->setText(MessageText.c_str());
|
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();
|
if ( textWidth < skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH) )
|
||||||
core::rect<s32> tmp = StaticText->getRelativePosition();
|
textWidth = skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH) + 6;
|
||||||
tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + textHeight;
|
// no neeed to check for max because it couldn't get larger due to statictextbox.
|
||||||
StaticText->setRelativePosition(tmp);
|
if ( textHeight < skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT) )
|
||||||
dim.Height = dim.Height - buttonHeight < tmp.getHeight() ? tmp.getHeight() : dim.Height - buttonHeight;
|
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();
|
// add icon
|
||||||
s32 msgBoxHeight = textHeight + core::floor32(2.5f * buttonHeight) + titleHeight;
|
if ( IconTexture )
|
||||||
msgBoxHeight = tmp.getHeight() < msgBoxHeight ? msgBoxHeight : tmp.getHeight();
|
{
|
||||||
|
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;
|
contentWidth += borderWidth + IconTexture->getOriginalSize().Width;
|
||||||
tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + msgBoxHeight;
|
}
|
||||||
setRelativePosition(tmp);
|
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;
|
s32 countButtons = 0;
|
||||||
if (Flags & EMBF_OK)
|
if (Flags & EMBF_OK)
|
||||||
++countButtons;
|
++countButtons;
|
||||||
|
@ -130,123 +207,44 @@ void CGUIMessageBox::refreshControls()
|
||||||
if (Flags & EMBF_NO)
|
if (Flags & EMBF_NO)
|
||||||
++countButtons;
|
++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;
|
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.LowerRightCorner.Y = btnRect.UpperLeftCorner.Y + buttonHeight;
|
||||||
btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() -
|
btnRect.UpperLeftCorner.X = borderWidth;
|
||||||
(buttonWidth*countButtons + (buttonDistance*countButtons+1))) / 2 +
|
if ( contentWidth > buttonBoxWidth )
|
||||||
buttonDistance / 2;
|
btnRect.UpperLeftCorner.X += (contentWidth - buttonBoxWidth) / 2; // center buttons
|
||||||
btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth;
|
btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth;
|
||||||
|
|
||||||
// add/remove ok button
|
IGUIElement* focusMe = 0;
|
||||||
if (Flags & EMBF_OK)
|
setButton(OkButton, (Flags & EMBF_OK) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_OK), focusMe);
|
||||||
{
|
if ( Flags & EMBF_OK )
|
||||||
if (!OkButton)
|
btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0);
|
||||||
{
|
setButton(CancelButton, (Flags & EMBF_CANCEL) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_CANCEL), focusMe);
|
||||||
OkButton = Environment->addButton(btnRect, this);
|
if ( Flags & EMBF_CANCEL )
|
||||||
OkButton->setSubElement(true);
|
btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0);
|
||||||
OkButton->grab();
|
setButton(YesButton, (Flags & EMBF_YES) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_YES), focusMe);
|
||||||
}
|
if ( Flags & EMBF_YES )
|
||||||
else
|
btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0);
|
||||||
OkButton->setRelativePosition(btnRect);
|
setButton(NoButton, (Flags & EMBF_NO) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_NO), focusMe);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Environment->hasFocus(this) && focusMe)
|
if (Environment->hasFocus(this) && focusMe)
|
||||||
Environment->setFocus(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 ("CancelButton", (Flags & EMBF_CANCEL) != 0 );
|
||||||
out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );
|
out->addBool ("YesButton", (Flags & EMBF_YES) != 0 );
|
||||||
out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );
|
out->addBool ("NoButton", (Flags & EMBF_NO) != 0 );
|
||||||
|
out->addTexture ("Texture", IconTexture);
|
||||||
|
|
||||||
out->addString ("MessageText", MessageText.c_str());
|
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("YesButton") ? EMBF_YES : 0;
|
||||||
Flags |= in->getAttributeAsBool("NoButton") ? EMBF_NO : 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();
|
MessageText = in->getAttributeAsStringW("MessageText").c_str();
|
||||||
|
|
||||||
CGUIWindow::deserializeAttributes(in,options);
|
CGUIWindow::deserializeAttributes(in,options);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include "CGUIWindow.h"
|
#include "CGUIWindow.h"
|
||||||
#include "IGUIStaticText.h"
|
#include "IGUIStaticText.h"
|
||||||
|
#include "IGUIImage.h"
|
||||||
#include "irrArray.h"
|
#include "irrArray.h"
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
|
@ -23,7 +24,7 @@ namespace gui
|
||||||
//! constructor
|
//! constructor
|
||||||
CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption,
|
CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption,
|
||||||
const wchar_t* text, s32 flag,
|
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
|
//! destructor
|
||||||
virtual ~CGUIMessageBox();
|
virtual ~CGUIMessageBox();
|
||||||
|
@ -40,12 +41,15 @@ namespace gui
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void refreshControls();
|
void refreshControls();
|
||||||
|
void setButton(IGUIButton*& button, bool isAvailable, const core::rect<s32> & btnRect, const wchar_t * text, IGUIElement*& focusMe);
|
||||||
|
|
||||||
IGUIButton* OkButton;
|
IGUIButton* OkButton;
|
||||||
IGUIButton* CancelButton;
|
IGUIButton* CancelButton;
|
||||||
IGUIButton* YesButton;
|
IGUIButton* YesButton;
|
||||||
IGUIButton* NoButton;
|
IGUIButton* NoButton;
|
||||||
IGUIStaticText* StaticText;
|
IGUIStaticText* StaticText;
|
||||||
|
IGUIImage * Icon;
|
||||||
|
video::ITexture * IconTexture;
|
||||||
|
|
||||||
s32 Flags;
|
s32 Flags;
|
||||||
core::stringw MessageText;
|
core::stringw MessageText;
|
||||||
|
|
|
@ -104,6 +104,12 @@ CGUISkin::CGUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
|
||||||
Sizes[EGDS_TITLEBARTEXT_DISTANCE_Y] = 2;
|
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_OK] = L"OK";
|
||||||
Texts[EGDT_MSG_BOX_CANCEL] = L"Cancel";
|
Texts[EGDT_MSG_BOX_CANCEL] = L"Cancel";
|
||||||
Texts[EGDT_MSG_BOX_YES] = L"Yes";
|
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;
|
ButtonX += 3;
|
||||||
|
|
||||||
core::rect<s32> rectangle(ButtonX,2,0,0);
|
core::rect<s32> rectangle(ButtonX,2,ButtonX+1,3);
|
||||||
if ( img )
|
if ( img )
|
||||||
{
|
{
|
||||||
const core::dimension2du &size = img->getOriginalSize();
|
const core::dimension2du &size = img->getOriginalSize();
|
||||||
rectangle.LowerRightCorner.X = rectangle.UpperLeftCorner.X + size.Width + 8;
|
rectangle.LowerRightCorner.X = rectangle.UpperLeftCorner.X + size.Width + 8;
|
||||||
rectangle.LowerRightCorner.Y = rectangle.UpperLeftCorner.Y + size.Height + 6;
|
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();
|
ButtonX += rectangle.getWidth();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ BOOL WINAPI ConsoleHandler(DWORD CEvent)
|
||||||
DeviceToClose->closeDevice();
|
DeviceToClose->closeDevice();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#else
|
#elif defined(_IRR_POSIX_API_)
|
||||||
// sigterm handler
|
// sigterm handler
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ const u16 ASCIIArtCharsCount = 32;
|
||||||
|
|
||||||
//! constructor
|
//! constructor
|
||||||
CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
|
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;
|
DeviceToClose = this;
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ CIrrDeviceConsole::CIrrDeviceConsole(const SIrrlichtCreationParameters& params)
|
||||||
// catch windows close/break signals
|
// catch windows close/break signals
|
||||||
SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE);
|
SetConsoleCtrlHandler((PHANDLER_ROUTINE)ConsoleHandler, TRUE);
|
||||||
|
|
||||||
#else
|
#elif defined(_IRR_POSIX_API_)
|
||||||
// catch other signals
|
// catch other signals
|
||||||
signal(SIGABRT, &sighandler);
|
signal(SIGABRT, &sighandler);
|
||||||
signal(SIGTERM, &sighandler);
|
signal(SIGTERM, &sighandler);
|
||||||
signal(SIGINT, &sighandler);
|
signal(SIGINT, &sighandler);
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ bool CIrrDeviceConsole::run()
|
||||||
// todo: keyboard input from terminal in raw mode
|
// todo: keyboard input from terminal in raw mode
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return IsDeviceRunning;
|
return !Close;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Cause the device to temporarily pause execution and let other processes to run
|
//! 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)
|
void CIrrDeviceConsole::setWindowCaption(const wchar_t* text)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_WINDOWS_NT_CONSOLE_
|
#ifdef _IRR_WINDOWS_NT_CONSOLE_
|
||||||
core::stringc txt(text);
|
SetConsoleTitleW(text);
|
||||||
SetConsoleTitle(txt.c_str());
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +412,7 @@ bool CIrrDeviceConsole::present(video::IImage* surface, void* windowId, core::re
|
||||||
void CIrrDeviceConsole::closeDevice()
|
void CIrrDeviceConsole::closeDevice()
|
||||||
{
|
{
|
||||||
// return false next time we run()
|
// return false next time we run()
|
||||||
IsDeviceRunning = false;
|
Close = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -223,8 +223,7 @@ namespace irr
|
||||||
core::stringc Text;
|
core::stringc Text;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool IsDeviceRunning,
|
bool IsWindowFocused;
|
||||||
IsWindowFocused;
|
|
||||||
|
|
||||||
core::array<core::stringc> OutputBuffer;
|
core::array<core::stringc> OutputBuffer;
|
||||||
gui::IGUIFont *ConsoleFont;
|
gui::IGUIFont *ConsoleFont;
|
||||||
|
@ -328,3 +327,4 @@ namespace gui
|
||||||
|
|
||||||
#endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
#endif // _IRR_COMPILE_WITH_CONSOLE_DEVICE_
|
||||||
#endif // __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
|
#endif // __C_IRR_DEVICE_CONSOLE_H_INCLUDED__
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.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.
|
// 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.
|
// 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
|
// 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 <sys/ioctl.h> // Would normally be included in linux/input.h
|
||||||
#include <linux/joystick.h>
|
#include <linux/joystick.h>
|
||||||
#undef _INPUT_H
|
#undef _INPUT_H
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
#endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_
|
||||||
|
|
||||||
namespace irr
|
namespace irr
|
||||||
|
@ -73,7 +79,7 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||||
Close(false), WindowHasFocus(false), WindowMinimized(false),
|
WindowHasFocus(false), WindowMinimized(false),
|
||||||
UseXVidMode(false), UseXRandR(false), UseGLXWindow(false),
|
UseXVidMode(false), UseXRandR(false), UseGLXWindow(false),
|
||||||
ExternalWindow(false), AutorepeatSupport(0)
|
ExternalWindow(false), AutorepeatSupport(0)
|
||||||
{
|
{
|
||||||
|
@ -128,6 +134,8 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
if (StdHints)
|
if (StdHints)
|
||||||
XFree(StdHints);
|
XFree(StdHints);
|
||||||
|
// Disable cursor and free it later on
|
||||||
|
CursorControl->setVisible(false);
|
||||||
if (display)
|
if (display)
|
||||||
{
|
{
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
|
@ -149,21 +157,8 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
|
||||||
}
|
}
|
||||||
#endif // #ifdef _IRR_COMPILE_WITH_OPENGL_
|
#endif // #ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
|
|
||||||
#ifdef _IRR_LINUX_X11_VIDMODE_
|
// Reset fullscreen resolution change
|
||||||
if (UseXVidMode && CreationParams.Fullscreen)
|
switchToFullscreen(true);
|
||||||
{
|
|
||||||
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
|
|
||||||
|
|
||||||
if (SoftwareImage)
|
if (SoftwareImage)
|
||||||
XDestroyImage(SoftwareImage);
|
XDestroyImage(SoftwareImage);
|
||||||
|
@ -207,6 +202,109 @@ int IrrPrintXError(Display *display, XErrorEvent *event)
|
||||||
#endif
|
#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()
|
bool CIrrDeviceLinux::createWindow()
|
||||||
{
|
{
|
||||||
#ifdef _IRR_COMPILE_WITH_X11_
|
#ifdef _IRR_COMPILE_WITH_X11_
|
||||||
|
@ -228,86 +326,7 @@ bool CIrrDeviceLinux::createWindow()
|
||||||
|
|
||||||
screennr = DefaultScreen(display);
|
screennr = DefaultScreen(display);
|
||||||
|
|
||||||
// query extension
|
switchToFullscreen();
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
|
|
||||||
|
@ -563,7 +582,7 @@ bool CIrrDeviceLinux::createWindow()
|
||||||
|
|
||||||
attributes.colormap = colormap;
|
attributes.colormap = colormap;
|
||||||
attributes.border_pixel = 0;
|
attributes.border_pixel = 0;
|
||||||
attributes.event_mask = StructureNotifyMask | FocusChangeMask;
|
attributes.event_mask = StructureNotifyMask | FocusChangeMask | ExposureMask;
|
||||||
if (!CreationParams.IgnoreInput)
|
if (!CreationParams.IgnoreInput)
|
||||||
attributes.event_mask |= PointerMotionMask |
|
attributes.event_mask |= PointerMotionMask |
|
||||||
ButtonPressMask | KeyPressMask |
|
ButtonPressMask | KeyPressMask |
|
||||||
|
@ -571,44 +590,27 @@ bool CIrrDeviceLinux::createWindow()
|
||||||
|
|
||||||
if (!CreationParams.WindowId)
|
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)
|
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,
|
XGrabKeyboard(display, window, True, GrabModeAsync,
|
||||||
GrabModeAsync, CurrentTime);
|
GrabModeAsync, CurrentTime);
|
||||||
XGrabPointer(display, window, True, ButtonPressMask,
|
XGrabPointer(display, window, True, ButtonPressMask,
|
||||||
GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
|
GrabModeAsync, GrabModeAsync, window, None, CurrentTime);
|
||||||
}
|
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1558,15 +1560,26 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
||||||
devName = "/dev/input/js";
|
devName = "/dev/input/js";
|
||||||
devName += joystick;
|
devName += joystick;
|
||||||
info.fd = open(devName.c_str(), O_RDONLY);
|
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)
|
if(-1 == info.fd)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
#ifdef __FREE_BSD_
|
||||||
|
info.axes=2;
|
||||||
|
info.buttons=2;
|
||||||
|
#else
|
||||||
ioctl( info.fd, JSIOCGAXES, &(info.axes) );
|
ioctl( info.fd, JSIOCGAXES, &(info.axes) );
|
||||||
ioctl( info.fd, JSIOCGBUTTONS, &(info.buttons) );
|
ioctl( info.fd, JSIOCGBUTTONS, &(info.buttons) );
|
||||||
|
|
||||||
fcntl( info.fd, F_SETFL, O_NONBLOCK );
|
fcntl( info.fd, F_SETFL, O_NONBLOCK );
|
||||||
|
#endif
|
||||||
|
|
||||||
(void)memset(&info.persistentData, 0, sizeof(info.persistentData));
|
(void)memset(&info.persistentData, 0, sizeof(info.persistentData));
|
||||||
info.persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
|
info.persistentData.EventType = irr::EET_JOYSTICK_INPUT_EVENT;
|
||||||
|
@ -1583,9 +1596,11 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
|
||||||
returnInfo.Axes = info.axes;
|
returnInfo.Axes = info.axes;
|
||||||
returnInfo.Buttons = info.buttons;
|
returnInfo.Buttons = info.buttons;
|
||||||
|
|
||||||
|
#ifndef __FREE_BSD_
|
||||||
char name[80];
|
char name[80];
|
||||||
ioctl( info.fd, JSIOCGNAME(80), name);
|
ioctl( info.fd, JSIOCGNAME(80), name);
|
||||||
returnInfo.Name = name;
|
returnInfo.Name = name;
|
||||||
|
#endif
|
||||||
|
|
||||||
joystickInfo.push_back(returnInfo);
|
joystickInfo.push_back(returnInfo);
|
||||||
}
|
}
|
||||||
|
@ -1612,11 +1627,19 @@ void CIrrDeviceLinux::pollJoysticks()
|
||||||
if(0 == ActiveJoysticks.size())
|
if(0 == ActiveJoysticks.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
u32 joystick;
|
u32 j;
|
||||||
for(joystick = 0; joystick < ActiveJoysticks.size(); ++joystick)
|
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;
|
struct js_event event;
|
||||||
while(sizeof(event) == read(info.fd, &event, sizeof(event)))
|
while(sizeof(event) == read(info.fd, &event, sizeof(event)))
|
||||||
{
|
{
|
||||||
|
@ -1637,6 +1660,7 @@ void CIrrDeviceLinux::pollJoysticks()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Send an irrlicht joystick event once per ::run() even if no new data were received.
|
// Send an irrlicht joystick event once per ::run() even if no new data were received.
|
||||||
(void)postEventFromUser(info.persistentData);
|
(void)postEventFromUser(info.persistentData);
|
||||||
|
|
|
@ -135,6 +135,8 @@ namespace irr
|
||||||
|
|
||||||
void initXAtoms();
|
void initXAtoms();
|
||||||
|
|
||||||
|
bool switchToFullscreen(bool reset=false);
|
||||||
|
|
||||||
//! Implementation of the linux cursor control
|
//! Implementation of the linux cursor control
|
||||||
class CCursorControl : public gui::ICursorControl
|
class CCursorControl : public gui::ICursorControl
|
||||||
{
|
{
|
||||||
|
@ -354,7 +356,6 @@ namespace irr
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
u32 Width, Height;
|
u32 Width, Height;
|
||||||
bool Close;
|
|
||||||
bool WindowHasFocus;
|
bool WindowHasFocus;
|
||||||
bool WindowMinimized;
|
bool WindowMinimized;
|
||||||
bool UseXVidMode;
|
bool UseXVidMode;
|
||||||
|
|
|
@ -59,8 +59,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
||||||
Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_ANYFORMAT),
|
Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_ANYFORMAT),
|
||||||
MouseX(0), MouseY(0), MouseButtonStates(0),
|
MouseX(0), MouseY(0), MouseButtonStates(0),
|
||||||
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
|
||||||
Close(0), Resizable(false),
|
Resizable(false), WindowHasFocus(false), WindowMinimized(false)
|
||||||
WindowHasFocus(false), WindowMinimized(false)
|
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CIrrDeviceSDL");
|
setDebugName("CIrrDeviceSDL");
|
||||||
|
@ -75,7 +74,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
|
||||||
SDL_INIT_NOPARACHUTE ) < 0)
|
SDL_INIT_NOPARACHUTE ) < 0)
|
||||||
{
|
{
|
||||||
os::Printer::log( "Unable to initialize SDL!", SDL_GetError());
|
os::Printer::log( "Unable to initialize SDL!", SDL_GetError());
|
||||||
Close = 1;
|
Close = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_IRR_WINDOWS_)
|
#if defined(_IRR_WINDOWS_)
|
||||||
|
|
|
@ -203,7 +203,6 @@ namespace irr
|
||||||
|
|
||||||
u32 Width, Height;
|
u32 Width, Height;
|
||||||
|
|
||||||
bool Close;
|
|
||||||
bool Resizable;
|
bool Resizable;
|
||||||
bool WindowHasFocus;
|
bool WindowHasFocus;
|
||||||
bool WindowMinimized;
|
bool WindowMinimized;
|
||||||
|
|
|
@ -19,7 +19,8 @@ namespace irr
|
||||||
CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters& params)
|
||||||
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
: IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0),
|
||||||
Timer(0), CursorControl(0), UserReceiver(params.EventReceiver), Logger(0), Operator(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();
|
Timer = new CTimer();
|
||||||
if (os::Printer::Logger)
|
if (os::Printer::Logger)
|
||||||
|
|
|
@ -147,8 +147,6 @@ namespace irr
|
||||||
IOSOperator* Operator;
|
IOSOperator* Operator;
|
||||||
io::IFileSystem* FileSystem;
|
io::IFileSystem* FileSystem;
|
||||||
scene::ISceneManager* InputReceivingSceneManager;
|
scene::ISceneManager* InputReceivingSceneManager;
|
||||||
video::CVideoModeList VideoModeList;
|
|
||||||
SIrrlichtCreationParameters CreationParams;
|
|
||||||
|
|
||||||
struct SMouseMultiClicks
|
struct SMouseMultiClicks
|
||||||
{
|
{
|
||||||
|
@ -162,6 +160,9 @@ namespace irr
|
||||||
core::position2di LastClick;
|
core::position2di LastClick;
|
||||||
};
|
};
|
||||||
SMouseMultiClicks MouseMultiClicks;
|
SMouseMultiClicks MouseMultiClicks;
|
||||||
|
video::CVideoModeList VideoModeList;
|
||||||
|
SIrrlichtCreationParameters CreationParams;
|
||||||
|
bool Close;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace irr
|
} // end namespace irr
|
||||||
|
|
|
@ -258,6 +258,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
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:
|
case WM_USER:
|
||||||
event.EventType = irr::EET_USER_EVENT;
|
event.EventType = irr::EET_USER_EVENT;
|
||||||
event.UserEvent.UserData1 = (irr::s32)wParam;
|
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
|
// create the window if we need to and we do not use the null device
|
||||||
if (!CreationParams.WindowId && CreationParams.DriverType != video::EDT_NULL)
|
if (!CreationParams.WindowId && CreationParams.DriverType != video::EDT_NULL)
|
||||||
{
|
{
|
||||||
const c8* ClassName = "CIrrDeviceWin32";
|
const fschar_t* ClassName = __TEXT("CIrrDeviceWin32");
|
||||||
|
|
||||||
// Register Class
|
// Register Class
|
||||||
WNDCLASSEX wcex;
|
WNDCLASSEX wcex;
|
||||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
wcex.lpfnWndProc = WndProc;
|
wcex.lpfnWndProc = WndProc;
|
||||||
wcex.cbClsExtra = 0;
|
wcex.cbClsExtra = 0;
|
||||||
wcex.cbWndExtra = 0;
|
wcex.cbWndExtra = 0;
|
||||||
wcex.hInstance = hInstance;
|
wcex.hInstance = hInstance;
|
||||||
wcex.hIcon = NULL;
|
wcex.hIcon = NULL;
|
||||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||||
wcex.lpszMenuName = 0;
|
wcex.lpszMenuName = 0;
|
||||||
|
@ -316,7 +328,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
||||||
wcex.hIconSm = 0;
|
wcex.hIconSm = 0;
|
||||||
|
|
||||||
// if there is an icon, load it
|
// 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);
|
RegisterClassEx(&wcex);
|
||||||
|
|
||||||
|
@ -349,7 +361,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
||||||
|
|
||||||
// create window
|
// create window
|
||||||
|
|
||||||
HWnd = CreateWindow( ClassName, "", style, windowLeft, windowTop,
|
HWnd = CreateWindow( ClassName, __TEXT(""), style, windowLeft, windowTop,
|
||||||
realWidth, realHeight, NULL, NULL, hInstance, NULL);
|
realWidth, realHeight, NULL, NULL, hInstance, NULL);
|
||||||
CreationParams.WindowId = HWnd;
|
CreationParams.WindowId = HWnd;
|
||||||
|
|
||||||
|
@ -414,8 +426,7 @@ CIrrDeviceWin32::~CIrrDeviceWin32()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ChangedToFullScreen)
|
switchToFullScreen(true);
|
||||||
ChangeDisplaySettings(NULL,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,9 +474,7 @@ void CIrrDeviceWin32::createDriver()
|
||||||
case video::EDT_OPENGL:
|
case video::EDT_OPENGL:
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||||
|
switchToFullScreen();
|
||||||
if (CreationParams.Fullscreen)
|
|
||||||
switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
|
|
||||||
|
|
||||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||||
if (!VideoDriver)
|
if (!VideoDriver)
|
||||||
|
@ -501,8 +510,7 @@ void CIrrDeviceWin32::createDriver()
|
||||||
case video::EDT_SOFTWARE:
|
case video::EDT_SOFTWARE:
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
#ifdef _IRR_COMPILE_WITH_SOFTWARE_
|
||||||
if (CreationParams.Fullscreen)
|
switchToFullScreen();
|
||||||
switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
|
|
||||||
|
|
||||||
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
||||||
#else
|
#else
|
||||||
|
@ -513,8 +521,7 @@ void CIrrDeviceWin32::createDriver()
|
||||||
|
|
||||||
case video::EDT_BURNINGSVIDEO:
|
case video::EDT_BURNINGSVIDEO:
|
||||||
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
|
||||||
if (CreationParams.Fullscreen)
|
switchToFullScreen();
|
||||||
switchToFullScreen(CreationParams.WindowSize.Width, CreationParams.WindowSize.Height, CreationParams.Bits);
|
|
||||||
|
|
||||||
VideoDriver = video::createSoftwareDriver2(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
VideoDriver = video::createSoftwareDriver2(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);
|
||||||
#else
|
#else
|
||||||
|
@ -541,8 +548,6 @@ bool CIrrDeviceWin32::run()
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
bool quit = false;
|
|
||||||
|
|
||||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
|
@ -553,17 +558,17 @@ bool CIrrDeviceWin32::run()
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
|
|
||||||
if (msg.message == WM_QUIT)
|
if (msg.message == WM_QUIT)
|
||||||
quit = true;
|
Close = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!quit)
|
if (!Close)
|
||||||
resizeIfNecessary();
|
resizeIfNecessary();
|
||||||
|
|
||||||
if(!quit)
|
if(!Close)
|
||||||
pollJoysticks();
|
pollJoysticks();
|
||||||
|
|
||||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||||
return !quit;
|
return !Close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -701,6 +706,7 @@ void CIrrDeviceWin32::closeDevice()
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
||||||
DestroyWindow(HWnd);
|
DestroyWindow(HWnd);
|
||||||
|
Close=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -735,16 +741,26 @@ bool CIrrDeviceWin32::isWindowMinimized() const
|
||||||
|
|
||||||
|
|
||||||
//! switches to fullscreen
|
//! 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;
|
DEVMODE dm;
|
||||||
memset(&dm, 0, sizeof(dm));
|
memset(&dm, 0, sizeof(dm));
|
||||||
dm.dmSize = sizeof(dm);
|
dm.dmSize = sizeof(dm);
|
||||||
// use default values from current setting
|
// use default values from current setting
|
||||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
|
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
|
||||||
dm.dmPelsWidth = width;
|
dm.dmPelsWidth = CreationParams.WindowSize.Width;
|
||||||
dm.dmPelsHeight = height;
|
dm.dmPelsHeight = CreationParams.WindowSize.Height;
|
||||||
dm.dmBitsPerPel = bits;
|
dm.dmBitsPerPel = CreationParams.Bits;
|
||||||
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
||||||
|
|
||||||
LONG res = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
|
LONG res = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
|
||||||
|
@ -881,17 +897,17 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
||||||
DWORD dwBufLen;
|
DWORD dwBufLen;
|
||||||
|
|
||||||
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
RegOpenKeyEx( HKEY_LOCAL_MACHINE,
|
||||||
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
|
__TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
|
||||||
0, KEY_QUERY_VALUE, &hKey );
|
0, KEY_QUERY_VALUE, &hKey );
|
||||||
RegQueryValueEx( hKey, "ProductType", NULL, NULL,
|
RegQueryValueEx( hKey, __TEXT("ProductType"), NULL, NULL,
|
||||||
(LPBYTE) szProductType, &dwBufLen);
|
(LPBYTE) szProductType, &dwBufLen);
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
|
|
||||||
if (lstrcmpi( "WINNT", szProductType) == 0 )
|
if (_strcmpi( "WINNT", szProductType) == 0 )
|
||||||
out.append("Professional ");
|
out.append("Professional ");
|
||||||
if (lstrcmpi( "LANMANNT", szProductType) == 0)
|
if (_strcmpi( "LANMANNT", szProductType) == 0)
|
||||||
out.append("Server ");
|
out.append("Server ");
|
||||||
if (lstrcmpi( "SERVERNT", szProductType) == 0)
|
if (_strcmpi( "SERVERNT", szProductType) == 0)
|
||||||
out.append("Advanced Server ");
|
out.append("Advanced Server ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,14 +101,18 @@ namespace irr
|
||||||
return CIrrDeviceStub::checkSuccessiveClicks(mouseX, mouseY);
|
return CIrrDeviceStub::checkSuccessiveClicks(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! switchs to fullscreen
|
||||||
|
bool switchToFullScreen(bool reset=false);
|
||||||
|
|
||||||
//! Implementation of the win32 cursor control
|
//! Implementation of the win32 cursor control
|
||||||
class CCursorControl : public gui::ICursorControl
|
class CCursorControl : public gui::ICursorControl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CCursorControl(const core::dimension2d<u32>& wsize, HWND hwnd, bool fullscreen)
|
CCursorControl(const core::dimension2d<u32>& wsize, HWND hwnd, bool fullscreen)
|
||||||
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f), IsVisible(true),
|
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f),
|
||||||
HWnd(hwnd), BorderX(0), BorderY(0), UseReferenceRect(false)
|
HWnd(hwnd), BorderX(0), BorderY(0),
|
||||||
|
UseReferenceRect(false), IsVisible(true)
|
||||||
{
|
{
|
||||||
if (WindowSize.Width!=0)
|
if (WindowSize.Width!=0)
|
||||||
InvWindowSize.Width = 1.0f / WindowSize.Width;
|
InvWindowSize.Width = 1.0f / WindowSize.Width;
|
||||||
|
@ -172,9 +176,9 @@ namespace irr
|
||||||
virtual void setPosition(f32 x, f32 y)
|
virtual void setPosition(f32 x, f32 y)
|
||||||
{
|
{
|
||||||
if (!UseReferenceRect)
|
if (!UseReferenceRect)
|
||||||
setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height));
|
setPosition(core::round32(x*WindowSize.Width), core::round32(y*WindowSize.Height));
|
||||||
else
|
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.
|
//! Sets the new position of the cursor.
|
||||||
|
@ -247,6 +251,7 @@ namespace irr
|
||||||
/** Used to notify the cursor that the window was resized. */
|
/** Used to notify the cursor that the window was resized. */
|
||||||
virtual void OnResize(const core::dimension2d<u32>& size)
|
virtual void OnResize(const core::dimension2d<u32>& size)
|
||||||
{
|
{
|
||||||
|
WindowSize = size;
|
||||||
if (size.Width!=0)
|
if (size.Width!=0)
|
||||||
InvWindowSize.Width = 1.0f / size.Width;
|
InvWindowSize.Width = 1.0f / size.Width;
|
||||||
else
|
else
|
||||||
|
@ -297,12 +302,12 @@ namespace irr
|
||||||
core::position2d<s32> CursorPos;
|
core::position2d<s32> CursorPos;
|
||||||
core::dimension2d<u32> WindowSize;
|
core::dimension2d<u32> WindowSize;
|
||||||
core::dimension2d<f32> InvWindowSize;
|
core::dimension2d<f32> InvWindowSize;
|
||||||
bool IsVisible;
|
|
||||||
HWND HWnd;
|
HWND HWnd;
|
||||||
|
|
||||||
s32 BorderX, BorderY;
|
s32 BorderX, BorderY;
|
||||||
bool UseReferenceRect;
|
|
||||||
core::rect<s32> ReferenceRect;
|
core::rect<s32> ReferenceRect;
|
||||||
|
bool UseReferenceRect;
|
||||||
|
bool IsVisible;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! returns the win32 cursor control
|
//! returns the win32 cursor control
|
||||||
|
@ -313,9 +318,6 @@ namespace irr
|
||||||
//! create the driver
|
//! create the driver
|
||||||
void createDriver();
|
void createDriver();
|
||||||
|
|
||||||
//! switchs to fullscreen
|
|
||||||
bool switchToFullScreen(s32 width, s32 height, s32 bits);
|
|
||||||
|
|
||||||
void getWindowsVersion(core::stringc& version);
|
void getWindowsVersion(core::stringc& version);
|
||||||
|
|
||||||
void resizeIfNecessary();
|
void resizeIfNecessary();
|
||||||
|
@ -344,4 +346,3 @@ namespace irr
|
||||||
|
|
||||||
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
#endif // _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||||
#endif // __C_IRR_DEVICE_WIN32_H_INCLUDED__
|
#endif // __C_IRR_DEVICE_WIN32_H_INCLUDED__
|
||||||
|
|
||||||
|
|
|
@ -552,8 +552,6 @@ bool CIrrDeviceWinCE::run()
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
bool quit = false;
|
|
||||||
|
|
||||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
|
@ -564,14 +562,14 @@ bool CIrrDeviceWinCE::run()
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
|
|
||||||
if (msg.message == WM_QUIT)
|
if (msg.message == WM_QUIT)
|
||||||
quit = true;
|
Close = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!quit)
|
if (!Close)
|
||||||
resizeIfNecessary();
|
resizeIfNecessary();
|
||||||
|
|
||||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||||
return !quit;
|
return !Close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -713,6 +711,7 @@ void CIrrDeviceWinCE::closeDevice()
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
|
||||||
DestroyWindow(HWnd);
|
DestroyWindow(HWnd);
|
||||||
|
Close=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,9 @@ namespace irr
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CCursorControl(const core::dimension2d<u32>& wsize, HWND hwnd, bool fullscreen)
|
CCursorControl(const core::dimension2d<u32>& wsize, HWND hwnd, bool fullscreen)
|
||||||
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f), IsVisible(true),
|
: WindowSize(wsize), InvWindowSize(0.0f, 0.0f),
|
||||||
HWnd(hwnd), BorderX(0), BorderY(0), UseReferenceRect(false)
|
HWnd(hwnd), BorderX(0), BorderY(0),
|
||||||
|
UseReferenceRect(false), IsVisible(true)
|
||||||
{
|
{
|
||||||
if (WindowSize.Width!=0)
|
if (WindowSize.Width!=0)
|
||||||
InvWindowSize.Width = 1.0f / WindowSize.Width;
|
InvWindowSize.Width = 1.0f / WindowSize.Width;
|
||||||
|
@ -129,9 +130,9 @@ namespace irr
|
||||||
virtual void setPosition(f32 x, f32 y)
|
virtual void setPosition(f32 x, f32 y)
|
||||||
{
|
{
|
||||||
if (!UseReferenceRect)
|
if (!UseReferenceRect)
|
||||||
setPosition((s32)(x*WindowSize.Width), (s32)(y*WindowSize.Height));
|
setPosition(core::round32(x*WindowSize.Width), core::round32(y*WindowSize.Height));
|
||||||
else
|
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.
|
//! Sets the new position of the cursor.
|
||||||
|
@ -205,6 +206,7 @@ namespace irr
|
||||||
/** Used to notify the cursor that the window was resized. */
|
/** Used to notify the cursor that the window was resized. */
|
||||||
virtual void OnResize(const core::dimension2d<u32>& size)
|
virtual void OnResize(const core::dimension2d<u32>& size)
|
||||||
{
|
{
|
||||||
|
WindowSize = size;
|
||||||
if (size.Width!=0)
|
if (size.Width!=0)
|
||||||
InvWindowSize.Width = 1.0f / size.Width;
|
InvWindowSize.Width = 1.0f / size.Width;
|
||||||
else
|
else
|
||||||
|
@ -255,12 +257,12 @@ namespace irr
|
||||||
core::position2d<s32> CursorPos;
|
core::position2d<s32> CursorPos;
|
||||||
core::dimension2d<s32> WindowSize;
|
core::dimension2d<s32> WindowSize;
|
||||||
core::dimension2d<f32> InvWindowSize;
|
core::dimension2d<f32> InvWindowSize;
|
||||||
bool IsVisible;
|
|
||||||
HWND HWnd;
|
HWND HWnd;
|
||||||
|
|
||||||
s32 BorderX, BorderY;
|
s32 BorderX, BorderY;
|
||||||
bool UseReferenceRect;
|
|
||||||
core::rect<s32> ReferenceRect;
|
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 uvTag = Materials[tag]->Texture[0].UVTag;
|
||||||
const u16 duvTag = Materials[tag]->Texture[0].DUVTag;
|
const u16 duvTag = Materials[tag]->Texture[0].DUVTag;
|
||||||
video::S3DVertex vertex;
|
video::S3DVertex vertex;
|
||||||
|
vertex.Color=0xffffffff;
|
||||||
const u32 vertCount=mb->Vertices.size();
|
const u32 vertCount=mb->Vertices.size();
|
||||||
for (u32 i=0; i<polySize; ++i)
|
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()));
|
os::Printer::log("LWO loader: Vertex count", core::stringc(Materials[i]->Meshbuffer->Vertices.size()));
|
||||||
#endif
|
#endif
|
||||||
if (!Materials[i]->Meshbuffer->Vertices.size())
|
if (!Materials[i]->Meshbuffer->Vertices.size())
|
||||||
|
{
|
||||||
|
Materials[i]->Meshbuffer->drop();
|
||||||
|
delete Materials[i];
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
for (u32 j=0; j<Materials[i]->Meshbuffer->Vertices.size(); ++j)
|
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->Vertices[j].Color=Materials[i]->Meshbuffer->Material.DiffuseColor;
|
||||||
Materials[i]->Meshbuffer->recalculateBoundingBox();
|
Materials[i]->Meshbuffer->recalculateBoundingBox();
|
||||||
|
@ -343,17 +348,17 @@ IAnimatedMesh* CLWOMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get the resolution for this axis
|
// get the resolution for this axis
|
||||||
f32 resolutionS = 1.f/Materials[i]->Texture[0].Size.Z;
|
f32 resolutionS = core::reciprocal(Materials[i]->Texture[0].Size.Z);
|
||||||
f32 resolutionT = 1.f/Materials[i]->Texture[0].Size.Y;
|
f32 resolutionT = core::reciprocal(Materials[i]->Texture[0].Size.Y);
|
||||||
if (Materials[i]->Texture[0].Axis==1)
|
if (Materials[i]->Texture[0].Axis==1)
|
||||||
{
|
{
|
||||||
resolutionS = 1.f/Materials[i]->Texture[0].Size.X;
|
resolutionS = core::reciprocal(Materials[i]->Texture[0].Size.X);
|
||||||
resolutionT = 1.f/Materials[i]->Texture[0].Size.Z;
|
resolutionT = core::reciprocal(Materials[i]->Texture[0].Size.Z);
|
||||||
}
|
}
|
||||||
else if (Materials[i]->Texture[0].Axis==2)
|
else if (Materials[i]->Texture[0].Axis==2)
|
||||||
{
|
{
|
||||||
resolutionS = 1.f/Materials[i]->Texture[0].Size.X;
|
resolutionS = core::reciprocal(Materials[i]->Texture[0].Size.X);
|
||||||
resolutionT = 1.f/Materials[i]->Texture[0].Size.Y;
|
resolutionT = core::reciprocal(Materials[i]->Texture[0].Size.Y);
|
||||||
}
|
}
|
||||||
// use the two-way planar mapping
|
// use the two-way planar mapping
|
||||||
SceneManager->getMeshManipulator()->makePlanarTextureMapping(Materials[i]->Meshbuffer, resolutionS, resolutionT, Materials[i]->Texture[0].Axis, Materials[i]->Texture[0].Center);
|
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
|
// add bump maps
|
||||||
if (Materials[i]->Meshbuffer->Material.MaterialType==video::EMT_NORMAL_MAP_SOLID)
|
if (Materials[i]->Meshbuffer->Material.MaterialType==video::EMT_NORMAL_MAP_SOLID)
|
||||||
{
|
{
|
||||||
SMesh tmpmesh;
|
SMesh* tmpmesh = new SMesh();
|
||||||
tmpmesh.addMeshBuffer(Materials[i]->Meshbuffer);
|
tmpmesh->addMeshBuffer(Materials[i]->Meshbuffer);
|
||||||
SceneManager->getMeshManipulator()->createMeshWithTangents(&tmpmesh, true, true);
|
SceneManager->getMeshManipulator()->createMeshWithTangents(tmpmesh, true, true);
|
||||||
Mesh->addMeshBuffer(tmpmesh.getMeshBuffer(0));
|
Mesh->addMeshBuffer(tmpmesh->getMeshBuffer(0));
|
||||||
|
tmpmesh->getMeshBuffer(0)->drop();
|
||||||
|
tmpmesh->drop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SceneManager->getMeshManipulator()->recalculateNormals(Materials[i]->Meshbuffer);
|
SceneManager->getMeshManipulator()->recalculateNormals(Materials[i]->Meshbuffer);
|
||||||
Mesh->addMeshBuffer(Materials[i]->Meshbuffer);
|
Mesh->addMeshBuffer(Materials[i]->Meshbuffer);
|
||||||
}
|
}
|
||||||
Mesh->getMeshBuffer(Mesh->getMeshBufferCount()-1)->drop();
|
Materials[i]->Meshbuffer->drop();
|
||||||
// clear the material array elements
|
// clear the material array elements
|
||||||
delete Materials[i];
|
delete Materials[i];
|
||||||
}
|
}
|
||||||
|
@ -607,6 +614,7 @@ void CLWOMeshFileLoader::readObj1(u32 size)
|
||||||
u16 numVerts, vertIndex;
|
u16 numVerts, vertIndex;
|
||||||
s16 material;
|
s16 material;
|
||||||
video::S3DVertex vertex;
|
video::S3DVertex vertex;
|
||||||
|
vertex.Color=0xffffffff;
|
||||||
|
|
||||||
while (size!=0)
|
while (size!=0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -909,9 +909,9 @@ IMesh* CMeshManipulator::createMeshWithTangents(IMesh* mesh, bool recalculateNor
|
||||||
v[idx[i+2]].TCoords);
|
v[idx[i+2]].TCoords);
|
||||||
|
|
||||||
if (recalculateNormals)
|
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]].Binormal += localBinormal * weight.X;
|
||||||
v[idx[i+0]].Normal += localNormal * weight.X;
|
|
||||||
|
|
||||||
calculateTangents(
|
calculateTangents(
|
||||||
localNormal,
|
localNormal,
|
||||||
|
@ -925,9 +925,9 @@ IMesh* CMeshManipulator::createMeshWithTangents(IMesh* mesh, bool recalculateNor
|
||||||
v[idx[i+0]].TCoords);
|
v[idx[i+0]].TCoords);
|
||||||
|
|
||||||
if (recalculateNormals)
|
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]].Binormal += localBinormal * weight.Y;
|
||||||
v[idx[i+1]].Normal += localNormal * weight.Y;
|
|
||||||
|
|
||||||
calculateTangents(
|
calculateTangents(
|
||||||
localNormal,
|
localNormal,
|
||||||
|
@ -941,9 +941,9 @@ IMesh* CMeshManipulator::createMeshWithTangents(IMesh* mesh, bool recalculateNor
|
||||||
v[idx[i+1]].TCoords);
|
v[idx[i+1]].TCoords);
|
||||||
|
|
||||||
if (recalculateNormals)
|
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]].Binormal += localBinormal * weight.Z;
|
||||||
v[idx[i+2]].Normal += localNormal * weight.Z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the tangents and binormals
|
// Normalize the tangents and binormals
|
||||||
|
@ -1104,7 +1104,6 @@ IMesh* CMeshManipulator::createMeshWith1TCoords(IMesh* mesh) const
|
||||||
|
|
||||||
SMeshBuffer* buffer = new SMeshBuffer();
|
SMeshBuffer* buffer = new SMeshBuffer();
|
||||||
buffer->Material = mesh->getMeshBuffer(b)->getMaterial();
|
buffer->Material = mesh->getMeshBuffer(b)->getMaterial();
|
||||||
buffer->Material.MaterialType = video::EMT_SOLID;
|
|
||||||
|
|
||||||
// copy vertices
|
// copy vertices
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@ void CMeshSceneNode::render()
|
||||||
{
|
{
|
||||||
video::SMaterial m;
|
video::SMaterial m;
|
||||||
m.Lighting = false;
|
m.Lighting = false;
|
||||||
|
m.AntiAliasing=0;
|
||||||
driver->setMaterial(m);
|
driver->setMaterial(m);
|
||||||
|
|
||||||
if (DebugDataVisible & scene::EDS_BBOX)
|
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.
|
//! Draws a 3d line.
|
||||||
void CNullDriver::draw3DLine(const core::vector3df& start,
|
void CNullDriver::draw3DLine(const core::vector3df& start,
|
||||||
const core::vector3df& end, SColor color)
|
const core::vector3df& end, SColor color)
|
||||||
|
@ -642,17 +592,27 @@ void CNullDriver::draw3DLine(const core::vector3df& start,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Draws a 3d triangle.
|
//! Draws a 3d triangle.
|
||||||
void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color)
|
void CNullDriver::draw3DTriangle(const core::triangle3df& triangle, SColor color)
|
||||||
{
|
{
|
||||||
draw3DLine(triangle.pointA, triangle.pointB, color);
|
S3DVertex vertices[3];
|
||||||
draw3DLine(triangle.pointB, triangle.pointC, color);
|
vertices[0].Pos=triangle.pointA;
|
||||||
draw3DLine(triangle.pointC, triangle.pointA, color);
|
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.
|
//! Draws a 3d axis aligned box.
|
||||||
void CNullDriver::draw3DBox(const core::aabbox3d<f32>& box, SColor color)
|
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;
|
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
|
//! Draws a mesh buffer
|
||||||
void CNullDriver::drawMeshBuffer(const scene::IMeshBuffer* mb)
|
void CNullDriver::drawMeshBuffer(const scene::IMeshBuffer* mb)
|
||||||
|
@ -2101,5 +2073,12 @@ SOverrideMaterial& CNullDriver::getOverrideMaterial()
|
||||||
return OverrideMaterial;
|
return OverrideMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
core::dimension2du CNullDriver::getMaxTextureSize() const
|
||||||
|
{
|
||||||
|
return core::dimension2du(0x10000,0x10000); // maybe large enough
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
|
@ -107,34 +107,12 @@ namespace video
|
||||||
//! draws a vertex primitive list
|
//! draws a vertex primitive list
|
||||||
virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
virtual void drawVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
||||||
const void* indexList, u32 primitiveCount,
|
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
|
//! draws a vertex primitive list in 2d
|
||||||
virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
virtual void draw2DVertexPrimitiveList(const void* vertices, u32 vertexCount,
|
||||||
const void* indexList, u32 primitiveCount,
|
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 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);
|
|
||||||
|
|
||||||
//! Draws a 3d line.
|
//! Draws a 3d line.
|
||||||
virtual void draw3DLine(const core::vector3df& start,
|
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,
|
f32 start=50.0f, f32 end=100.0f, f32 density=0.01f,
|
||||||
bool pixelFog=false, bool rangeFog=false);
|
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
|
//! get color format of the current color buffer
|
||||||
virtual ECOLOR_FORMAT getColorFormat() const;
|
virtual ECOLOR_FORMAT getColorFormat() const;
|
||||||
|
|
||||||
|
@ -579,6 +561,9 @@ namespace video
|
||||||
virtual void setAllowZWriteOnTransparent(bool flag)
|
virtual void setAllowZWriteOnTransparent(bool flag)
|
||||||
{ AllowZWriteOnTransparent=flag; }
|
{ AllowZWriteOnTransparent=flag; }
|
||||||
|
|
||||||
|
//! Returns the maximum texture size supported.
|
||||||
|
virtual core::dimension2du getMaxTextureSize() const;
|
||||||
|
|
||||||
//! deprecated method
|
//! deprecated method
|
||||||
virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size,
|
virtual ITexture* createRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||||
const c8* name=0);
|
const c8* name=0);
|
||||||
|
|
|
@ -423,13 +423,20 @@ const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const buf
|
||||||
texname.replace('\\', '/');
|
texname.replace('\\', '/');
|
||||||
|
|
||||||
video::ITexture * texture = 0;
|
video::ITexture * texture = 0;
|
||||||
|
bool newTexture=false;
|
||||||
if (texname.size())
|
if (texname.size())
|
||||||
{
|
{
|
||||||
if (FileSystem->existFile(texname))
|
if (FileSystem->existFile(texname))
|
||||||
|
{
|
||||||
|
newTexture = SceneManager->getVideoDriver()->findTexture(texname) == 0;
|
||||||
texture = SceneManager->getVideoDriver()->getTexture(texname);
|
texture = SceneManager->getVideoDriver()->getTexture(texname);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
newTexture = SceneManager->getVideoDriver()->findTexture(relPath + texname) == 0;
|
||||||
// try to read in the relative path, the .obj is loaded from
|
// try to read in the relative path, the .obj is loaded from
|
||||||
texture = SceneManager->getVideoDriver()->getTexture( relPath + texname );
|
texture = SceneManager->getVideoDriver()->getTexture( relPath + texname );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( texture )
|
if ( texture )
|
||||||
{
|
{
|
||||||
|
@ -437,7 +444,8 @@ const c8* COBJMeshFileLoader::readTextures(const c8* bufPtr, const c8* const buf
|
||||||
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
currMaterial->Meshbuffer->Material.setTexture(0, texture);
|
||||||
else if (type==1)
|
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.setTexture(1, texture);
|
||||||
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
currMaterial->Meshbuffer->Material.MaterialType=video::EMT_PARALLAX_MAP_SOLID;
|
||||||
currMaterial->Meshbuffer->Material.MaterialTypeParam=0.035f;
|
currMaterial->Meshbuffer->Material.MaterialTypeParam=0.035f;
|
||||||
|
|
|
@ -132,7 +132,7 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
||||||
|
|
||||||
HKEY Key;
|
HKEY Key;
|
||||||
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0",
|
__TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"),
|
||||||
0, KEY_READ, &Key);
|
0, KEY_READ, &Key);
|
||||||
|
|
||||||
if(Error != ERROR_SUCCESS)
|
if(Error != ERROR_SUCCESS)
|
||||||
|
@ -140,7 +140,7 @@ bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
|
||||||
|
|
||||||
DWORD Speed = 0;
|
DWORD Speed = 0;
|
||||||
DWORD Size = sizeof(Speed);
|
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);
|
RegCloseKey(Key);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
|
||||||
if (AntiAlias > 1)
|
if (AntiAlias > 1)
|
||||||
{
|
{
|
||||||
// Create a window to test antialiasing support
|
// Create a window to test antialiasing support
|
||||||
const c8* ClassName = "GLCIrrDeviceWin32";
|
const fschar_t* ClassName = __TEXT("GLCIrrDeviceWin32");
|
||||||
HINSTANCE lhInstance = GetModuleHandle(0);
|
HINSTANCE lhInstance = GetModuleHandle(0);
|
||||||
|
|
||||||
// Register Class
|
// Register Class
|
||||||
|
@ -116,7 +116,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
|
||||||
const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
|
const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
|
||||||
const s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 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);
|
realWidth, realHeight, NULL, NULL, lhInstance, NULL);
|
||||||
|
|
||||||
if (!temporary_wnd)
|
if (!temporary_wnd)
|
||||||
|
@ -1435,7 +1435,17 @@ void COpenGLDriver::draw2DVertexPrimitiveList(const void* vertices, u32 vertexCo
|
||||||
|
|
||||||
// draw everything
|
// draw everything
|
||||||
this->setActiveTexture(0, Material.getTexture(0));
|
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)
|
if (MultiTextureExtension)
|
||||||
extGlClientActiveTexture(GL_TEXTURE0_ARB);
|
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
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
||||||
|
|
|
@ -315,6 +315,9 @@ namespace video
|
||||||
//! Returns the graphics card vendor name.
|
//! Returns the graphics card vendor name.
|
||||||
virtual core::stringc getVendorInfo() {return vendorName;}
|
virtual core::stringc getVendorInfo() {return vendorName;}
|
||||||
|
|
||||||
|
//! Returns the maximum texture size supported.
|
||||||
|
virtual core::dimension2du getMaxTextureSize() const;
|
||||||
|
|
||||||
ITexture* createDepthTexture(ITexture* texture, bool shared=true);
|
ITexture* createDepthTexture(ITexture* texture, bool shared=true);
|
||||||
void removeDepthTexture(ITexture* texture);
|
void removeDepthTexture(ITexture* texture);
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ public:
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
u32 getGLBlend ( E_BLEND_FACTOR factor ) const
|
u32 getGLBlend ( E_BLEND_FACTOR factor ) const
|
||||||
|
@ -405,7 +405,7 @@ public:
|
||||||
{
|
{
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, 0.5f);
|
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);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
|
||||||
|
|
||||||
if (material.MaterialType == EMT_LIGHTMAP_ADD)
|
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
|
else
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
|
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"\
|
"PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix.\n"\
|
||||||
"TEMP Temp;\n"\
|
"TEMP Temp;\n"\
|
||||||
"TEMP TempColor;\n"\
|
"TEMP TempColor;\n"\
|
||||||
"TEMP TempNormal;\n"\
|
|
||||||
"TEMP TempTangent;\n"\
|
|
||||||
"TEMP TempBinormal;\n"\
|
|
||||||
"TEMP TempLightVector1;\n"\
|
"TEMP TempLightVector1;\n"\
|
||||||
"TEMP TempLightVector2;\n"\
|
"TEMP TempLightVector2;\n"\
|
||||||
"TEMP TempTransLightV1;\n"\
|
"TEMP TempTransLightV1;\n"\
|
||||||
|
@ -63,40 +60,19 @@ const char OPENGL_NORMAL_MAP_VSH[] =
|
||||||
"MOV OutPos.z, Temp.z;\n"\
|
"MOV OutPos.z, Temp.z;\n"\
|
||||||
"MOV result.fogcoord.x, Temp.z;\n"\
|
"MOV result.fogcoord.x, Temp.z;\n"\
|
||||||
"\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"\
|
"# vertex - lightpositions \n"\
|
||||||
"SUB TempLightVector1, program.local[12], Temp; \n"\
|
"SUB TempLightVector1, program.local[12], InPos; \n"\
|
||||||
"SUB TempLightVector2, program.local[14], Temp; \n"\
|
"SUB TempLightVector2, program.local[14], InPos; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# transform the light vector 1 with U, V, W \n"\
|
"# transform the light vector 1 with U, V, W \n"\
|
||||||
"DP3 TempTransLightV1.x, TempTangent, TempLightVector1; \n"\
|
"DP3 TempTransLightV1.x, InTangent, TempLightVector1; \n"\
|
||||||
"DP3 TempTransLightV1.y, TempBinormal, TempLightVector1; \n"\
|
"DP3 TempTransLightV1.y, InBinormal, TempLightVector1; \n"\
|
||||||
"DP3 TempTransLightV1.z, TempNormal, TempLightVector1; \n"\
|
"DP3 TempTransLightV1.z, InNormal, TempLightVector1; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# transform the light vector 2 with U, V, W \n"\
|
"# transform the light vector 2 with U, V, W \n"\
|
||||||
"DP3 TempTransLightV2.x, TempTangent, TempLightVector2; \n"\
|
"DP3 TempTransLightV2.x, InTangent, TempLightVector2; \n"\
|
||||||
"DP3 TempTransLightV2.y, TempBinormal, TempLightVector2; \n"\
|
"DP3 TempTransLightV2.y, InBinormal, TempLightVector2; \n"\
|
||||||
"DP3 TempTransLightV2.z, TempNormal, TempLightVector2; \n"\
|
"DP3 TempTransLightV2.z, InNormal, TempLightVector2; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# normalize light vector 1 \n"\
|
"# normalize light vector 1 \n"\
|
||||||
"DP3 TempTransLightV1.w, TempTransLightV1, TempTransLightV1; \n"\
|
"DP3 TempTransLightV1.w, TempTransLightV1, TempTransLightV1; \n"\
|
||||||
|
@ -277,6 +253,10 @@ void COpenGLNormalMapRenderer::OnSetConstants(IMaterialRendererServices* service
|
||||||
|
|
||||||
u32 cnt = driver->getDynamicLightCount();
|
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)
|
for (u32 i=0; i<2; ++i)
|
||||||
{
|
{
|
||||||
video::SLight light;
|
video::SLight light;
|
||||||
|
@ -291,6 +271,9 @@ void COpenGLNormalMapRenderer::OnSetConstants(IMaterialRendererServices* service
|
||||||
|
|
||||||
light.DiffuseColor.a = 1.0f/(light.Radius*light.Radius); // set attenuation
|
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(
|
services->setVertexShaderConstant(
|
||||||
reinterpret_cast<const f32*>(&light.Position), 12+(i*2), 1);
|
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"\
|
"PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix.\n"\
|
||||||
"TEMP Temp;\n"\
|
"TEMP Temp;\n"\
|
||||||
"TEMP TempColor;\n"\
|
"TEMP TempColor;\n"\
|
||||||
"TEMP TempNormal;\n"\
|
|
||||||
"TEMP TempTangent;\n"\
|
|
||||||
"TEMP TempBinormal;\n"\
|
|
||||||
"TEMP TempLightVector1;\n"\
|
"TEMP TempLightVector1;\n"\
|
||||||
"TEMP TempLightVector2;\n"\
|
"TEMP TempLightVector2;\n"\
|
||||||
"TEMP TempEyeVector;\n"\
|
"TEMP TempEyeVector;\n"\
|
||||||
|
@ -66,48 +63,27 @@ const char OPENGL_PARALLAX_MAP_VSH[] =
|
||||||
"MOV OutPos.z, Temp.z;\n"\
|
"MOV OutPos.z, Temp.z;\n"\
|
||||||
"MOV result.fogcoord.x, Temp.z;\n"\
|
"MOV result.fogcoord.x, Temp.z;\n"\
|
||||||
"\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"\
|
"# vertex - lightpositions \n"\
|
||||||
"SUB TempLightVector1, program.local[12], Temp; \n"\
|
"SUB TempLightVector1, program.local[12], InPos; \n"\
|
||||||
"SUB TempLightVector2, program.local[14], Temp; \n"\
|
"SUB TempLightVector2, program.local[14], InPos; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# eye vector \n"\
|
"# eye vector \n"\
|
||||||
"SUB Temp, program.local[16], Temp; \n"\
|
"SUB Temp, program.local[16], InPos; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# transform the light vector 1 with U, V, W \n"\
|
"# transform the light vector 1 with U, V, W \n"\
|
||||||
"DP3 TempTransLightV1.x, TempTangent, TempLightVector1; \n"\
|
"DP3 TempTransLightV1.x, InTangent, TempLightVector1; \n"\
|
||||||
"DP3 TempTransLightV1.y, TempBinormal, TempLightVector1; \n"\
|
"DP3 TempTransLightV1.y, InBinormal, TempLightVector1; \n"\
|
||||||
"DP3 TempTransLightV1.z, TempNormal, TempLightVector1; \n"\
|
"DP3 TempTransLightV1.z, InNormal, TempLightVector1; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# transform the light vector 2 with U, V, W \n"\
|
"# transform the light vector 2 with U, V, W \n"\
|
||||||
"DP3 TempTransLightV2.x, TempTangent, TempLightVector2; \n"\
|
"DP3 TempTransLightV2.x, InTangent, TempLightVector2; \n"\
|
||||||
"DP3 TempTransLightV2.y, TempBinormal, TempLightVector2; \n"\
|
"DP3 TempTransLightV2.y, InBinormal, TempLightVector2; \n"\
|
||||||
"DP3 TempTransLightV2.z, TempNormal, TempLightVector2; \n"\
|
"DP3 TempTransLightV2.z, InNormal, TempLightVector2; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# transform the eye vector with U, V, W \n"\
|
"# transform the eye vector with U, V, W \n"\
|
||||||
"DP3 TempEyeVector.x, TempTangent, Temp; \n"\
|
"DP3 TempEyeVector.x, InTangent, Temp; \n"\
|
||||||
"DP3 TempEyeVector.y, TempBinormal, Temp; \n"\
|
"DP3 TempEyeVector.y, InBinormal, Temp; \n"\
|
||||||
"DP3 TempEyeVector.z, TempNormal, Temp; \n"\
|
"DP3 TempEyeVector.z, InNormal, Temp; \n"\
|
||||||
"\n"\
|
"\n"\
|
||||||
"# normalize light vector 1 \n"\
|
"# normalize light vector 1 \n"\
|
||||||
"DP3 TempTransLightV1.w, TempTransLightV1, TempTransLightV1; \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();
|
const core::matrix4& tWorld = driver->getTransform(video::ETS_WORLD).getTransposed();
|
||||||
services->setVertexShaderConstant(tWorld.pointer(), 0, 4);
|
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
|
// set transposed worldViewProj matrix
|
||||||
core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
|
core::matrix4 worldViewProj(driver->getTransform(video::ETS_PROJECTION));
|
||||||
worldViewProj *= driver->getTransform(video::ETS_VIEW);
|
worldViewProj *= driver->getTransform(video::ETS_VIEW);
|
||||||
|
@ -334,6 +299,10 @@ void COpenGLParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* servi
|
||||||
|
|
||||||
u32 cnt = driver->getDynamicLightCount();
|
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)
|
for (u32 i=0; i<2; ++i)
|
||||||
{
|
{
|
||||||
video::SLight light;
|
video::SLight light;
|
||||||
|
@ -348,6 +317,9 @@ void COpenGLParallaxMapRenderer::OnSetConstants(IMaterialRendererServices* servi
|
||||||
|
|
||||||
light.DiffuseColor.a = 1.0f/(light.Radius*light.Radius); // set attenuation
|
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(
|
services->setVertexShaderConstant(
|
||||||
reinterpret_cast<const f32*>(&light.Position), 12+(i*2), 1);
|
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);
|
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
|
// set scale factor
|
||||||
f32 factor = 0.02f; // default value
|
f32 factor = 0.02f; // default value
|
||||||
if (CurrentScale != 0.0f)
|
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)
|
// (we do, but this could be disabled to increase the speed of loading hundreds of meshes)
|
||||||
if (Buffer)
|
if (Buffer)
|
||||||
{
|
{
|
||||||
delete Buffer;
|
delete [] Buffer;
|
||||||
Buffer = 0;
|
Buffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ IAnimatedMesh* CPLYMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
|
|
||||||
|
|
||||||
// free the buffer
|
// free the buffer
|
||||||
delete Buffer;
|
delete [] Buffer;
|
||||||
Buffer = 0;
|
Buffer = 0;
|
||||||
File->drop();
|
File->drop();
|
||||||
File = 0;
|
File = 0;
|
||||||
|
@ -557,7 +557,7 @@ c8* CPLYMeshFileLoader::getNextLine()
|
||||||
|
|
||||||
// begin at the start of the next line
|
// begin at the start of the next line
|
||||||
c8* pos = StartPointer;
|
c8* pos = StartPointer;
|
||||||
while (*pos && pos < EndPointer && *pos != '\r' && *pos != '\n')
|
while (pos < EndPointer && *pos && *pos != '\r' && *pos != '\n')
|
||||||
++pos;
|
++pos;
|
||||||
|
|
||||||
if ( pos < EndPointer && ( *(pos+1) == '\r' || *(pos+1) == '\n') )
|
if ( pos < EndPointer && ( *(pos+1) == '\r' || *(pos+1) == '\n') )
|
||||||
|
|
|
@ -15,20 +15,34 @@ namespace irr
|
||||||
namespace io
|
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
|
//! Constructor
|
||||||
CArchiveLoaderPAK::CArchiveLoaderPAK( io::IFileSystem* fs)
|
CArchiveLoaderPAK::CArchiveLoaderPAK( io::IFileSystem* fs)
|
||||||
: FileSystem(fs)
|
: FileSystem(fs)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CArchiveLoaderPAK");
|
setDebugName("CArchiveLoaderPAK");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! returns true if the file maybe is able to be loaded by this class
|
//! returns true if the file maybe is able to be loaded by this class
|
||||||
bool CArchiveLoaderPAK::isALoadableFileFormat(const io::path& filename) const
|
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.
|
//! 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)
|
if (file)
|
||||||
{
|
{
|
||||||
archive = createArchive ( file, ignoreCase, ignorePaths );
|
archive = createArchive(file, ignoreCase, ignorePaths);
|
||||||
file->drop ();
|
file->drop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +90,9 @@ bool CArchiveLoaderPAK::isALoadableFileFormat(io::IReadFile* file) const
|
||||||
{
|
{
|
||||||
SPAKFileHeader header;
|
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)
|
CPakReader::CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
|
||||||
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file)
|
: CFileList(file ? file->getFileName() : "", ignoreCase, ignorePaths), File(file)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
setDebugName("CPakReader");
|
setDebugName("CPakReader");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (File)
|
if (File)
|
||||||
{
|
{
|
||||||
File->grab();
|
File->grab();
|
||||||
|
|
||||||
// scan local headers
|
|
||||||
scanLocalHeader();
|
scanLocalHeader();
|
||||||
|
|
||||||
sort();
|
sort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,48 +127,43 @@ const IFileList* CPakReader::getFileList() const
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! scans for a local header, returns false if there is no more local file header.
|
|
||||||
bool CPakReader::scanLocalHeader()
|
bool CPakReader::scanLocalHeader()
|
||||||
{
|
{
|
||||||
|
SPAKFileHeader header;
|
||||||
|
|
||||||
|
// Read and validate the header
|
||||||
|
File->read(&header, sizeof(header));
|
||||||
|
if (!isHeaderValid(header))
|
||||||
|
return false;
|
||||||
|
|
||||||
c8 tmp[1024];
|
// Seek to the table of contents
|
||||||
io::path PakFileName;
|
#ifdef __BIG_ENDIAN__
|
||||||
|
header.offset = os::Byteswap::byteswap(header.offset);
|
||||||
memset(&header, 0, sizeof(SPAKFileHeader));
|
header.length = os::Byteswap::byteswap(header.length);
|
||||||
File->read(&header, sizeof(SPAKFileHeader));
|
#endif
|
||||||
|
|
||||||
if (header.tag[0] != 'P' && header.tag[1] != 'A')
|
|
||||||
return false; // local file headers end here.
|
|
||||||
|
|
||||||
File->seek(header.offset);
|
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
|
// read an entry
|
||||||
PakFileName.reserve(56+2);
|
SPAKFileEntry entry;
|
||||||
File->read(tmp, 56);
|
File->read(&entry, sizeof(entry));
|
||||||
tmp[56] = 0x0;
|
|
||||||
PakFileName = tmp;
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
os::Printer::log(PakFileName.c_str());
|
os::Printer::log(entry.name);
|
||||||
#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);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addItem(PakFileName, size, false, Offsets.size());
|
#ifdef __BIG_ENDIAN__
|
||||||
Offsets.push_back(offset);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,24 @@ namespace irr
|
||||||
{
|
{
|
||||||
namespace io
|
namespace io
|
||||||
{
|
{
|
||||||
|
//! File header containing location and size of the table of contents
|
||||||
struct SPAKFileHeader
|
struct SPAKFileHeader
|
||||||
{
|
{
|
||||||
|
// Don't change the order of these fields! They must match the order stored on disk.
|
||||||
c8 tag[4];
|
c8 tag[4];
|
||||||
u32 offset;
|
u32 offset;
|
||||||
u32 length;
|
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
|
//! Archiveloader capable of loading PAK Archives
|
||||||
class CArchiveLoaderPAK : public IArchiveLoader
|
class CArchiveLoaderPAK : public IArchiveLoader
|
||||||
{
|
{
|
||||||
|
@ -79,7 +90,6 @@ namespace io
|
||||||
// file archive methods
|
// file archive methods
|
||||||
|
|
||||||
//! return the id of the file Archive
|
//! return the id of the file Archive
|
||||||
|
|
||||||
virtual const io::path& getArchiveName() const
|
virtual const io::path& getArchiveName() const
|
||||||
{
|
{
|
||||||
return File->getFileName();
|
return File->getFileName();
|
||||||
|
@ -99,16 +109,11 @@ namespace io
|
||||||
|
|
||||||
private:
|
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();
|
bool scanLocalHeader();
|
||||||
|
|
||||||
//! splits filename from zip file into useful filenames and paths
|
|
||||||
//void extractFilename(SPakFileEntry* entry);
|
|
||||||
|
|
||||||
IReadFile* File;
|
IReadFile* File;
|
||||||
|
|
||||||
SPAKFileHeader header;
|
|
||||||
|
|
||||||
//! Contains offsets of the files from the start of the archive file
|
//! Contains offsets of the files from the start of the archive file
|
||||||
core::array<u32> Offsets;
|
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