Merging r6196 through r6248 from trunk to ogl-es branch

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6249 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2021-08-26 21:57:27 +00:00
parent 08a2846a93
commit 21302d038a
119 changed files with 9580 additions and 4362 deletions

@ -9,6 +9,26 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
--------------------------
Changes in 1.9 (not yet released)
- Add equals and set_data functions to core::array for easier working with blocks of data.
- SIrrlichtCreationParameters::IgnoreInput set to false works again on X11.
Thanks @ Victor Gaydov for report + patch + very good test cases! (bug #401)
This had been broken since Irrlicht 1.6
- Add steer parameter to CSceneNodeAnimatorFollowSpline which allows rotating node toward direction of movement.
Thanks @ Bate for the patch (patch #175)
- Add a workaround for XWarpPointer bug that causes mouse to jump when users have set a Coordinate Transformation Matrix for their mouse on X11.
This was mentioned in bug #450 by vikaig.
The fix needs compiling with _IRR_LINUX_X11_XINPUT2_ enabled (so far disabled by default)
- Add IGeometryCreator::createTorusMesh to create donuts.
- Don't try loading broken image files twice with same loader anymore.
- Make CImageLoaderJPG thread safe. Thanks @ Edoardo Lolletti for report and patch (patch #324)
- Add ETCF_SUPPORT_VERTEXT_TEXTURE flag which can be used to enable vertex texture sampling support in Direct3D 9.
Note that this was enabled for a long time in 1.9 svn, but is now disabled by default.
- CGUIListBox now serializes the state of "Selected". Feature wish by chronologicaldot (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=52719)
- Bugfix: Changing focus with tab-keys now also work when elements are inside a modal screen.
- COBJMeshFileLoader using a bit more exact color conversion for 0-1 to 0-255 range (same now as SColorf::toSColor uses).
- Speedup for COBJMeshWriter
- Add blinkMode parameter to IGUIEnvironment::addModalScreen, so blinking can be suppressed
- Speedup: Avoid string copy in CXMLReaderImpl::getAttributeByName
- Fix bug in rect::clipAgainst that had caused rects completely outside to the left-top of the rect to be clipped against ending up with both corners outside.
It still worked for UI in most cases as the resulting rectangle still had an area of 0.
- Add getAlign functions to IGUIElement
@ -84,7 +104,7 @@ Changes in 1.9 (not yet released)
- Drivers can now try to create textures from images in more exotic color formats (like floating point formats). It depends on the driver how much that works (so far mainly OpenGL can handle it somewhat).
- Fix OpenGL to no longer switch colors red and blue in 24-bit RGB format. But warnings added to documentation to avoid 24-bit textures as they are generally just trouble.
- No longer try to convert ECF_R5G6B5 to ECF_A1R5G5B5 on OpenGL (just made texture-loading seem to fail).
- Add flag SIrrlichtCreationParameters.WindowResizable. Mainly to work around troubles with SDL+OpenGL on some platforms where resizing later can be tricky/impossible.
- Add parameter SIrrlichtCreationParameters.WindowResizable. Mainly to work around troubles with SDL+OpenGL on some platforms where resizing later can be tricky/impossible.
- Add operator[] to vector2d and vector3d
- Bugfix: IrrlichtDevice::isWindowMinimized no longer returns true when it's maximized on Windows.
- Ignore degenerated faces in obj file loader when they would generate triangles where 2 vertices use identical indices.
@ -318,6 +338,7 @@ Changes in 1.9 (not yet released)
--------------------------
Changes in 1.8.5
- Update script to generate tutorial.html's in example folders. Add missing ones. Update existing ones. Thanks @Guillian J for noticing those were outdated.
- Update libpng to 1.6.37 (from 1.6.23)
- Fix CIrrDeviceSDL::getVideoModeList which didn't return video modes before. Thx @kas1e for report and patch.
- CIrrDeviceMacOSX now sets the SEvent.MouseInput Shift and Control values on mouse events like the other devices. Thanks @ Zero King for patch (#321)

@ -1,12 +1,12 @@
Checklist for Irrlicht developers for doing releases.
Checklist for Irrlicht developers doing releases.
Note: Generally the more platforms, compilers, settings you can test the better. Ask for help for platforms which you don't own.
- PRE-BUILD TESTS:
- - Run tests in the tests folder
- - Compile and run all examples for testing (preferably on all platforms,
compilers, settings ... until you are certain enough stuff works sufficiently).
Ask for help for platforms which you don't own.
- - Compile the tools on all platforms you have. Note that some tools are in the buildall-examples VS project files on Windows, but on Linux
command line you have to compile them individually.
- - Compile and run examples.
- - Compile and run the tools. Note that some tools are in the buildall-examples VS project files on Windows,
but on Linux command line you have to compile them individually.
- VERSION UPDATES:
- - check IRRLICHT_SDK_VERSION (in IrrCompileConfig.h)
@ -15,13 +15,16 @@ command line you have to compile them individually.
- - Add new release information (date+version-number) in changes.txt
- - go through folders if other .txt files still make sense (things change and updating those files tends to be forgotten)
- DOCUMENTATION UPDATES:
- - run makedocumentation.sh in scripts\doc\irrlicht
- - run maketutorial.sh in scripts\doc\irrlicht (commit changed tutorial.html's)
- BUILDING THE RELEASE
(TBD - should we still release dll's? Newer and older VS builds are no longer compatible anyway)
- - run a clean build for buildAllExamples in the examples folder with the
target compiler for 32-bit and for release (preferably oldest supported VS
compiler, otherwise oldest you have still installed)
target compiler for 32-bit and for release (old VS compiler - so far VS2010)
- - when possible compile the dll for MinGW on Windows (in release and with -s for smaller size)
- - when possible compile the dll for 64 bit (again with Visual Studio and release)
- - run makedocumentation in scripts\doc\irrlicht
- - create a target directory, like irrlicht-1.8.1 for example
- - svn export to the target directory
- - copy the subfolders of doctemp into the doc folder of the target directory

@ -1,394 +1,231 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Irrlicht Engine Tutorial</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Tutorial 1: HelloWorld</title>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Wanted to avoid copying .css to each folder, so copied default .css from doxyen in here, kicked out most stuff we don't need for examples and modified some a little bit.
Target was having a single html in each example folder which is created from the main.cpp files and needs no files besides some images below media folder.
Feel free to improve :)
-->
<style>
body, table, div, p, dl {
font: 400 14px/22px;
}
body {
background-color: #F0F0F0;
color: black;
margin-left: 5%;
margin-right: 5%;
}
p.reference, p.definition {
font: 400 14px/22px;
}
.title {
font: 400 14px/28px;
font-size: 150%;
font-weight: bold;
margin: 10px 2px;
}
h1, h2, h3, h4, h5, h6 {
-webkit-transition: text-shadow 0.5s linear;
-moz-transition: text-shadow 0.5s linear;
-ms-transition: text-shadow 0.5s linear;
-o-transition: text-shadow 0.5s linear;
transition: text-shadow 0.5s linear;
margin-right: 15px;
}
caption {
font-weight: bold;
}
h3.version {
font-size: 90%;
text-align: center;
}
a {
color: #3D578C;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #4665A2;
}
a:hover {
text-decoration: underline;
}
a.el {
font-weight: bold;
}
a.code, a.code:visited, a.line, a.line:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #4665A2;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
font-family: monospace, fixed;
font-size: 105%;
}
div.fragment {
padding: 0px;
margin: 4px 8px 4px 2px;
background-color: #FBFCFD;
border: 1px solid #C4CFE5;
}
div.line {
font-family: monospace, fixed;
font-size: 13px;
min-height: 13px;
line-height: 1.0;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
text-indent: -53px;
padding-left: 53px;
padding-bottom: 0px;
margin: 0px;
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
div.contents {
margin-top: 10px;
margin-left: 12px;
margin-right: 8px;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
blockquote {
background-color: #F7F8FB;
border-left: 2px solid #9CAFD4;
margin: 0 24px 0 4px;
padding: 0 12px 0 16px;
}
hr {
height: 0px;
border: none;
border-top: 1px solid #4A6AAA;
}
address {
font-style: normal;
color: #2A3D61;
}
div.header {
background-image:url('nav_h.png');
background-repeat:repeat-x;
background-color: #F9FAFC;
margin: 0px;
border-bottom: 1px solid #C4CFE5;
}
div.headertitle {
padding: 5px 5px 5px 10px;
}
.image {
text-align: center;
}
.caption {
font-weight: bold;
}
div.zoom {
border: 1px solid #90A5CE;
}
tr.heading h2 {
margin-top: 12px;
margin-bottom: 4px;
}
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td bgcolor="#666699"> <b><font color="#FFFFFF">Tutorial 1.HelloWorld</font></b></td>
</tr>
<tr>
<td height="90" bgcolor="#F7F3F7"> <div align="left">
<p>This Tutorial shows how to set up the IDE for using the
Irrlicht Engine and how to write a simple HelloWorld program
with it. The program will show how to use the basics of
the VideoDriver, the GUIEnvironment and the SceneManager.<br>
The result of this example will look like this:</p>
<p align="center"><img src="../../media/001shot.jpg" width="259" height="204"><br>
</p>
</div></td>
</tr>
</table>
<br> <table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr> <a name="settingup"></a>
<td bgcolor="#666699"> <b><font color="#FFFFFF">Setting up the
IDE</font></b></td>
</tr>
<tr>
<td height="90" bgcolor="#F7F3F7"> <div align="left">
<div align="left">
<p align="left">To use the engine, we will have to include
the header file &lt;irrlicht.h&gt;, which can be found
in the Irrlicht Engine SDK directory \include. To let
the compiler find this header file, the directory where
it is located should be specified somewhere. This is different
for every IDE and compiler. I will explain how to do this
in Microsoft Visual Studio C++ 6.0 and .NET:</p>
</div>
<ul>
<li>
<div align="left">If you use Version 6.0, select the Menu
Extras -&gt; Options. Select the directories tab, and
select the 'Include' Item in the combo box. Add the
\include directory of the Irrlicht Engine folder to
the list of directories. Now the compiler will find
the Irrlicht.h header file. We also need the location
of irrlicht.lib to be listed, so select the 'Libraries'
tab and add the \lib\VisualStudio directory.<br>
<br>
<img src="../../media/vc6optionsdir.jpg" width="231" height="172" align="middle">&nbsp;&nbsp;<img src="../../media/vc6include.jpg" width="231" height="159" align="middle"><br>
&nbsp; <br>
</div>
</li>
<li>If your IDE is Visual Studio .NET, select Tools -&gt;
Options. Select the Projects entry and then select VC++
directories. Select 'show directories for include files'
in the combo box, and add the \include directory of the
Irrlicht Engine folder to the list of directories so the
compiler will find the Irrlicht.h header file. We also
need the irrlicht.lib to be found, so select 'show directories
for Library files' and add the \lib\VisualStudio directory.<br>
<br>
<img src="../../media/vcnetinclude.jpg" width="256" height="160">
<br>
</li>
</ul>
<p>&nbsp;</p>
</div></td>
</tr>
</table>
<br> <table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td bgcolor="#666699"> <font color="#FFFFFF"><b>Lets start!</b></font></td>
</tr>
<tr>
<td height="90" bgcolor="#F7F3F7" valign="top"> <div align="left">
<div align="left">
<div align="left">
<div align="left">
<p>After we have set up the IDE, the compiler will know
where to find the Irrlicht Engine header files so
we can include it now into our code.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>#include &lt;irrlicht.h&gt;</pre> </td>
</tr>
</table>
<p>In the Irrlicht Engine, everything can be found in
the namespace 'irr'. So if you want to use a class
of the engine, you'll have to type an irr:: before
the name of the class. For example, to use the IrrlichtDevice,
write: irr::IrrlichtDevice. To avoid having to put
irr:: before of the name of every class, we tell the
compiler that we use that namespace.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>using namespace irr;</pre> </td>
</tr>
</table>
<p>There are 5 sub-namespaces in the Irrlicht Engine.
Take a look at them: you can read a detailed description
of them in the documentation by clicking on the top
menu item '<a href="http://irrlicht.sourceforge.net/docu/namespaces.html">Namespace
List</a>'. To keep this example simple, we don't want
to have to specify the name spaces, Hence:</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>using namespace core;<br>using namespace scene;<br>using namespace video;<br>using namespace io;<br>using namespace gui;</pre> </td>
</tr>
</table>
<p>To be able to use the Irrlicht.DLL file, we need
to link with the Irrlicht.lib. We could set this option
in the project settings, but to make it easy we use
a pragma comment:</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>#pragma comment(lib, &quot;Irrlicht.lib&quot;)</pre> </td>
</tr>
</table>
<p>Now the main method: to keep this example simple
we use int main(), which can be used on any platform.
However, on Windows platforms, we could also use the
WinMain method if we would want to get rid of the
console window which pops up when starting a program
with main().</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>int main()<br>{</pre> </td>
</tr>
</table>
<p>The most important function of the engine is the
'createDevice' function. The Irrlicht Device, which
is the root object for doing everything with the engine,
can be created with it. createDevice() has 7 parameters:</p>
</div>
<ul>
<li>
<div align="left"> deviceType: Type of the device. This can currently
be the Null device, the Software device, Direct3D8, Direct3D9,
or OpenGL. In this example we use EDT_SOFTWARE, but, to try
them out, you might want to change it to EDT_NULL, EDT_DIRECT3D8,
EDT_DIRECT3D9 or EDT_OPENGL. </div>
</li>
<li>
<div align="left">windowSize: Size of the window or
full screen mode to be created. In this example
we use 512x384.</div>
</li>
<li>
<div align="left">bits: Number of bits per pixel when
in full screen mode. This should be 16 or 32. This
parameter is ignored when running in windowed mode.</div>
</li>
<li>
<div align="left">fullscreen: Specifies if we want
the device to run in full screen mode or not.</div>
</li>
<li>stencilbuffer: Specifies if we want to use the stencil
buffer for drawing shadows.</li>
<li>vsync: Specifies if we want to have vsync enabled.
This is only useful in full screen mode.</li>
<li>
<div align="left">eventReceiver: An object to receive
events. We do not want to use this parameter here,
and set it to 0.</div>
</li>
</ul>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>IrrlichtDevice *device =<br> createDevice(EDT_SOFTWARE, dimension2d&lt;s32&gt;(512, 384), 16,<br> false, false, false, 0);</pre> </td>
</tr>
</table>
<p>Now we set the caption of the window to some nice text.
Note that there is a 'L' in front of the string: the
Irrlicht Engine uses wide character strings when displaying
text.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>device-&gt;setWindowCaption(L&quot;Hello World! - Irrlicht Engine Demo&quot;);</pre> </td>
</tr>
</table>
<p>Now we store a pointer to the video driver, the SceneManager,
and the graphical user interface environment so that
we do not always have to write device-&gt;getVideoDriver(),
device-&gt;getSceneManager(), and device-&gt;getGUIEnvironment().</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>IVideoDriver* driver = device-&gt;getVideoDriver();<br>ISceneManager* smgr = device-&gt;getSceneManager();<br>IGUIEnvironment* guienv = device-&gt;getGUIEnvironment();</pre> </td>
</tr>
</table>
<p> We add a hello world label to the window using the
GUI environment. The text is placed at the position
(10,10) as top left corner and (200,22) as lower right
corner.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>guienv-&gt;addStaticText(L&quot;Hello World! This is the Irrlicht Software engine!&quot;,<br> rect&lt;s32&gt;(10,10,200,22), true);</pre> </td>
</tr>
</table>
<p>To display something interesting, we load a Quake 2
model and display it. We only have to get the Mesh from
the Scene Manager with getMesh() and add a SceneNode
to display the mesh with addAnimatedMeshSceneNode().
Instead of loading a Quake2 file (.md2), it is also
possible to load a Maya object file (.obj), a complete
Quake3 map (.bsp), or a Milshape file (.ms3d).<br>
By the way, that cool Quake 2 model called sydney.md2
was modelled by Brian Collins.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>IAnimatedMesh* mesh = smgr-&gt;getMesh(&quot;../../media/sydney.md2&quot;);<br>IAnimatedMeshSceneNode* node = smgr-&gt;addAnimatedMeshSceneNode( mesh );</pre> </td>
</tr>
</table>
<p>To make the mesh look a little bit nicer, we change
its material a little bit: we disable lighting because
we do not have a dynamic light in here and the mesh
would be totally black. Then we set the frame loop so
that the animation is looped between the frames 0 and
310. Then, at last, we apply a texture to the mesh.
Without it the mesh would be drawn using only a solid
color.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>if (node)<br>{<br> node-&gt;setMaterialFlag(EMF_LIGHTING, false);<br> node-&gt;setFrameLoop(0, 310); <br> node-&gt;setMaterialTexture( 0, driver-&gt;getTexture(&quot;../../media/sydney.bmp&quot;) );<br>}</pre>
</td>
</tr>
</table>
<p>To look at the mesh, we place a camera into 3d space
at the position (0, 10, -40). The camera looks from
there to (0,5,0).</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>smgr-&gt;addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));</pre> </td>
</tr>
</table>
<p>Ok. Now that we have set up the scene, let's draw everything:
we run the device in a while() loop until the device
does not want to run any more. This would be when the
user closes the window or presses ALT+F4 in Windows.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre>while(device-&gt;run())<br>{</pre> </td>
</tr>
</table>
<p> Everything must be drawn between a beginScene() and
an endScene() call. The beginScene clears the screen
with a color and also the depth buffer, if desired.
Then we let the Scene Manager and the GUI environment
draw their content. With the endScene() call, everything
is presented on the screen.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre> driver-&gt;beginScene(true, true, SColor(255,100,101,140));<br>
smgr-&gt;drawAll();
guienv-&gt;drawAll();</pre>
<pre> driver-&gt;endScene();
}</pre> </td>
</tr>
</table>
<p>After we are finished, we have to delete the Irrlicht
Device created earlier with createDevice(). With the
Irrlicht Engine, you should delete all objects you created
with a method or function that starts with 'create'.
The object is deleted simply by calling -&gt;drop().
See the <a href="http://irrlicht.sourceforge.net/docu/classirr_1_1IUnknown.html#a3" target="_blank">documentation</a>
for more information.</p>
<table width="95%" border="0" cellspacing="2" cellpadding="0" bgcolor="#CCCCCC" align="center">
<tr>
<td> <pre> device-&gt;drop();<br> return 0;
}</pre> </td>
</tr>
</table>
<p>That's it. Compile and run. </p>
<p>&nbsp;</p>
</div>
</div>
</div></td>
</tr>
</table>
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
<td bgcolor="#666699"> <b><font color="#FFFFFF">Possible Errors
or Problems</font></b></td>
</tr>
<tr>
<td height="90" bgcolor="#F7F3F7"> <div align="left">
<div align="left">
<div align="left">
<p><strong>Visual Studio</strong><br>
While trying to compile the tutorial, if you get the
error: </p>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">fatal
error C1083: Cannot open include file: 'irrlicht.h':
No such file or directory</font></td>
</tr>
</table>
<p>Solution: You may have set the include directory improperly
in the Visual Studio options. See <a href="#settingup">above</a>
for information on setting it. </p>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">LINK
: LNK6004: HelloWorld.exe not found or not built
by the last incremental link; performing full link<br>
LINK : fatal error LNK1104: cannot open file "Irrlicht.lib"<br>
Error executing link.exe</font></td>
</tr>
</table>
<p> Solution: You may have set the library directory improperly.
See <a href="#settingup">above</a> for information on
setting it. <br>
<br>
</p>
<p><strong>Compiler independent problems<br>
</strong>If the tutorial compiles successfully but gives
the error: </p>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">This
application has failed to start because Irrlicht.dll
was not found. Re-installing the application may
fix this problem</font></td>
</tr>
</table>
<p>Solution: You may have forgotten to copy the Irrlicht.dll
file from Irrlicht\bin\VisualStudio to the directory
the tutorial's project file is in. </p>
If the tutorial compiles and runs successfully but produces
errors in the console like:<br>
<br>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><font face="Courier New, Courier, mono">Could
not load mesh, because file could not be opened.:
../media/sydney.md2</font></td>
</tr>
</table>
<p> Or:</p>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><em><font face="Courier New, Courier, mono">Could
not open file of texture: stones.jpg</font></em><font face="Courier New, Courier, mono"><b><br>
</b><em>Could not load texture: stones.jpg </em></font></td>
</tr>
</table>
<p>Solution: The file listed in the error message cannot
be found. Ensure that the directory specified in the
main.cpp exists and is where the file is located. <br>
</p>
</div>
</div>
</div></td>
</tr>
</table>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--END TITLEAREA-->
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Tutorial 1: HelloWorld </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><div class="image">
<img src="../../media/example_screenshots/001shot.jpg" alt="001shot.jpg"/>
</div>
<p>This tutorial shows how to set up the IDE for using the Irrlicht Engine and how to write a simple HelloWorld program with it. The program will show how to use the basics of the VideoDriver, the GUIEnvironment, and the SceneManager. Microsoft Visual Studio is used as an IDE, but you will also be able to understand everything if you are using a different one or even another operating system than Windows.</p>
<p>You have to include the header file &lt;irrlicht.h&gt; in order to use the engine. The header file can be found in the Irrlicht Engine SDK directory <code>include</code>. To let the compiler find this header file, the directory where it is located has to be added in your project as include path. This is different for every IDE and compiler you use. Let's explain shortly how to do this in Visual Studio 2010:</p>
<ul>
<li>In Visual Studio 2010 select the Menu Project -&gt; Properties. Select the "C/C++" - "General" option, and select the "Additional Include Directories". Add the <code>include</code> directory of the Irrlicht engine folder to the list of directories. Now the compiler will find the irrlicht.h header file. We also need the irrlicht.lib to be found, so select "Linker" - "General" and add the <code>lib/Win64-visualStudio</code> or <code>lib/Win32-visualStudio</code> directory to "Additional Library Directories". Which of the 2 Irrlicht versions you chose depends on the target platform for your application (win32 or x64). In your project properties you can see what your active solution platform is, you can use the same one for Irrlicht.</li>
</ul>
<p>To be able to use the Irrlicht.DLL file, we need to link with the Irrlicht.lib. In most IDE's you have to add irrlicht.lib (or irrlicht.a or irrlicht.so on Linux) to your Linker input files.</p>
<p>For VisualStudio we can be lazy and use the pragma comment lib. We also want to get rid of the console window, which pops up when starting a program with main() (instead of WinMain). This is done by the second pragma. We could also use the WinMain method, though losing platform independence then. </p><div class="fragment"><div class="line"><span class="preprocessor">#ifdef _MSC_VER</span></div><div class="line"><span class="preprocessor">#pragma comment(lib, &quot;Irrlicht.lib&quot;)</span></div><div class="line"><span class="preprocessor">#pragma comment(linker, &quot;/subsystem:windows /ENTRY:mainCRTStartup&quot;)</span></div><div class="line"><span class="preprocessor">#endif</span></div></div><!-- fragment --><p> That's it. With your IDE set up like this, you will now be able to develop applications with the Irrlicht Engine.</p>
<p>Lets start!</p>
<p>After we have set up the IDE, the compiler will know where to find the Irrlicht Engine header files so we can include it now in our code. </p><div class="fragment"><div class="line"><span class="preprocessor">#include &lt;irrlicht.h&gt;</span></div></div><!-- fragment --><p> That header just adds the getExampleMediaPath tool-functions to help locating the media we need. More about that later below. </p><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;exampleHelper.h&quot;</span></div></div><!-- fragment --><p> In the Irrlicht Engine, everything can be found in the namespace 'irr'. So if you want to use a class of the engine, you have to write irr:: before the name of the class. For example to use the IrrlichtDevice write: irr::IrrlichtDevice. To get rid of the irr:: in front of the name of every class, we tell the compiler that we use that namespace from now on, and we will not have to write irr:: anymore. Note that you never should do that in headers - otherwise you will pollute the namespace of every file including such a header. So in headers always write out the full names including all namespaces. </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span>irr;</div></div><!-- fragment --><p> There are 5 sub namespaces in the Irrlicht Engine. Take a look at them, you can read a detailed description of them in the documentation by clicking on the top menu item 'Namespace List' or by using this link: <a href="http://irrlicht.sourceforge.net/docu/namespaces.html">http://irrlicht.sourceforge.net/docu/namespaces.html</a> Like the irr namespace, we do not want these 5 sub namespaces now, to keep this example simple. Hence, we tell the compiler again that we do not want always to write their names. </p><div class="fragment"><div class="line"><span class="keyword">using namespace </span>core;</div><div class="line"><span class="keyword">using namespace </span>scene;</div><div class="line"><span class="keyword">using namespace </span>video;</div><div class="line"><span class="keyword">using namespace </span>io;</div><div class="line"><span class="keyword">using namespace </span>gui;</div></div><!-- fragment --><p> This is the main method. We can now use main() on every platform. </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div></div><!-- fragment --><p> The most important function of the engine is the createDevice() function. The IrrlichtDevice is created by it, which is the root object for doing anything with the engine. createDevice() has the following parameters:</p>
<ul>
<li>driverType: Type of the video driver. This can currently be the Null-device, one of the two software renderers, D3D9, or OpenGL. In this example we use EDT_BURNINGSVIDEO, but to try out, you might want to change it to EDT_SOFTWARE, EDT_NULL, EDT_DIRECT3D9, or EDT_OPENGL. Generally you will want to use OpenGL or Direct3D as they are using your graphic card for calculations instead of the CPU and are way faster (and usually better looking). We just use one of the software renderers here as it even works when your graphic card driver isn't set up for 3d support.</li>
<li>windowSize: Size of the Window or screen in FullScreenMode to be created. In this example we use 640x480.</li>
<li>bits: Amount of color bits per pixel. This should be 16 or 32. The parameter is often ignored when running in windowed mode. More commonly you would chose 32 bit, again we're just playing it safe.</li>
<li>fullscreen: Specifies if we want the device to run in fullscreen mode or windowed.</li>
<li>stencilbuffer: Specifies if we want to use the stencil buffer (you need it for drawing shadows).</li>
<li>vsync: Specifies if we want to have vsync enabled, this is only useful in fullscreen mode.</li>
<li>eventReceiver: An object to receive events. We do not want to use this parameter here, and set it to 0.</li>
</ul>
<p>Always check the return value to cope with unsupported drivers, dimensions, etc. </p><div class="fragment"><div class="line">IrrlichtDevice *device =</div><div class="line"> createDevice( video::EDT_BURNINGSVIDEO, dimension2d&lt;u32&gt;(640, 480), 16,</div><div class="line"> <span class="keyword">false</span>, <span class="keyword">false</span>, <span class="keyword">false</span>, 0);</div><div class="line"></div><div class="line"><span class="keywordflow">if</span> (!device)</div><div class="line"> <span class="keywordflow">return</span> 1;</div></div><!-- fragment --><p> Set the caption of the window to some nice text. Note that there is an 'L' in front of the string. The Irrlicht Engine uses wide character strings when displaying text. </p><div class="fragment"><div class="line">device-&gt;setWindowCaption(L<span class="stringliteral">&quot;Hello World! - Irrlicht Engine Demo&quot;</span>);</div></div><!-- fragment --><p> Get a pointer to the VideoDriver, the SceneManager and the graphical user interface environment, so that we do not always have to write device-&gt;getVideoDriver(), device-&gt;getSceneManager(), or device-&gt;getGUIEnvironment(). </p><div class="fragment"><div class="line">IVideoDriver* driver = device-&gt;getVideoDriver();</div><div class="line">ISceneManager* smgr = device-&gt;getSceneManager();</div><div class="line">IGUIEnvironment* guienv = device-&gt;getGUIEnvironment();</div></div><!-- fragment --><p> We add a hello world label to the window, using the GUI environment. The text is placed at the position (10,10) as top left corner and (260,22) as lower right corner. </p><div class="fragment"><div class="line">guienv-&gt;addStaticText(L<span class="stringliteral">&quot;Hello World! This is Irrlicht with the burnings software renderer!&quot;</span>,</div><div class="line"> rect&lt;s32&gt;(10,10,260,22), <span class="keyword">true</span>);</div></div><!-- fragment --><p> Get a media path dedicated for your platform. Finding media files for your applications can be tricky. First you have 2 options - working with relative paths or working with absolute paths.</p>
<p>On Windows a common solution is that your installer will write a key into the registry with the absolute path of wherever the user installed the media. And in your application you read out that key from the registry. On Linux a common solution is to use config file which is placed in some fixed location (for example in a . file/folder in the user home).</p>
<p>But you can also work with relative paths - which is what we do here. There is a slight complication with relative paths as they are relative to your current working directory. And that depends on the way your application is started and it might change inside your application. But mostly it will be set to your executable on start so you can ignore that problem while developing.</p>
<p>When inside VisualStudio the current working directory is set to your project files location unless you overwrite Project properties - Debugging</p><ul>
<li>Working Directory. In Irrlicht examples the media folder is on most platforms ../../media which works for the examples as it's relative to our project files as well as to the binary (.exe) files.</li>
</ul>
<p>Whatever you chose to find your base-folder for media - wrap it with some function and then you can improve the code to locate the media later on. </p><div class="fragment"><div class="line"><span class="keyword">const</span> io::path mediaPath = getExampleMediaPath();</div></div><!-- fragment --><p> To show something interesting, we load a Quake 2 model and display it. We get the Mesh from the Scene Manager with getMesh() and add a SceneNode to display the mesh with addAnimatedMeshSceneNode(). Check the return value of getMesh() to become aware of loading problems and other errors.</p>
<p>Instead of writing the filename sydney.md2, it would also be possible to load a Maya object file (.obj), a complete Quake3 map (.bsp) or any other supported file format. By the way, that cool Quake 2 model called sydney was modeled by Brian Collins. </p><div class="fragment"><div class="line">IAnimatedMesh* mesh = smgr-&gt;getMesh(mediaPath + <span class="stringliteral">&quot;sydney.md2&quot;</span>);</div><div class="line"><span class="keywordflow">if</span> (!mesh)</div><div class="line">{</div><div class="line"> device-&gt;drop();</div><div class="line"> <span class="keywordflow">return</span> 1;</div><div class="line">}</div><div class="line">IAnimatedMeshSceneNode* node = smgr-&gt;addAnimatedMeshSceneNode( mesh );</div></div><!-- fragment --><p> To let the mesh look a little bit nicer, we change its material. We disable lighting because we do not have a dynamic light in here, and the mesh would be totally black otherwise. Then we set the frame loop, such that the predefined STAND animation is used. And last, we apply a texture to the mesh. Without it the mesh would be drawn using only a color. </p><div class="fragment"><div class="line"><span class="keywordflow">if</span> (node)</div><div class="line">{</div><div class="line"> node-&gt;setMaterialFlag(EMF_LIGHTING, <span class="keyword">false</span>);</div><div class="line"> node-&gt;setMD2Animation(scene::EMAT_STAND);</div><div class="line"> node-&gt;setMaterialTexture( 0, driver-&gt;getTexture(mediaPath + <span class="stringliteral">&quot;sydney.bmp&quot;</span>) );</div><div class="line">}</div></div><!-- fragment --><p> To look at the mesh, we place a camera into 3d space at the position (0, 30, -40). The camera looks from there to (0,5,0), which is approximately the place where our md2 model is. </p><div class="fragment"><div class="line">smgr-&gt;addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));</div></div><!-- fragment --><p> OK, now we have set up the scene, lets draw everything: We run the device in a while() loop, until the device does not want to run any more. This would be when the user closes the window or presses ALT+F4 (or whatever keycode closes a window on your OS). </p><div class="fragment"><div class="line"><span class="keywordflow">while</span>(device-&gt;run())</div><div class="line">{</div></div><!-- fragment --><p> Anything can be drawn between a beginScene() and an endScene() call. The beginScene() call clears the screen with a color and the depth buffer, if desired. Then we let the Scene Manager and the GUI Environment draw their content. With the endScene() call everything is presented on the screen. </p><div class="fragment"><div class="line"> driver-&gt;beginScene(ECBF_COLOR | ECBF_DEPTH, SColor(255,100,101,140));</div><div class="line"></div><div class="line"> smgr-&gt;drawAll();</div><div class="line"> guienv-&gt;drawAll();</div><div class="line"></div><div class="line"> driver-&gt;endScene();</div><div class="line">}</div></div><!-- fragment --><p> After we are done with the render loop, we have to delete the Irrlicht Device created before with createDevice(). In the Irrlicht Engine, you have to delete all objects you created with a method or function which starts with 'create'. The object is simply deleted by calling -&gt;drop(). See the documentation at irr::IReferenceCounted::drop() for more information. </p><div class="fragment"><div class="line"> device-&gt;drop();</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line">}</div></div><!-- fragment --><p> That's it. Compile and run. </p>
</div></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<p>&nbsp;</p>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,4 +1,5 @@
/** Deprecated. This was Example 017 Helloworld mobile for WinCE 6.
/** Example 017 Helloworld mobile for WinCE 6. DEPRECATED
This was Example 017 Helloworld mobile for WinCE 6.
But WinCE6 support has been removed for Irrlicht 1.9.
If you still need that please use Irrlicht 1.8 or svn revision 5045 which was the last one to include it.

File diff suppressed because one or more lines are too long

@ -170,6 +170,9 @@ Sounds a little complicated, but you'll see it isn't:
while(device->run())
{
// Don't reset mouse cursor when window is not active
camera[3]->setInputReceiverEnabled(device->isWindowActive());
//Set the viewpoint to the whole screen and begin scene
driver->setViewPort(rect<s32>(0,0,ResX,ResY));
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,100,100));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -76,7 +76,8 @@ public:
/*
Load xml from disk, overwrite default settings
The xml we are trying to load has the following structure
settings nested in sections nested in the root node, like so
settings nested in sections nested in the root node, like:
\verbatim
<pre>
<?xml version="1.0"?>
<mygame>
@ -87,6 +88,7 @@ public:
</video>
</mygame>
</pre>
\endverbatim
*/
bool load()
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -5,6 +5,8 @@
#ifndef __E_GUI_ALIGNMENT_H_INCLUDED__
#define __E_GUI_ALIGNMENT_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace gui
@ -35,4 +37,3 @@ const c8* const GUIAlignmentNames[] =
} // namespace irr
#endif // __E_GUI_ALIGNMENT_H_INCLUDED__

@ -74,13 +74,13 @@ namespace scene
virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
//! Get the axis aligned bounding box of this node
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
virtual const core::aabbox3d<f32>& getBoundingBox() const _IRR_OVERRIDE_ = 0;
//! Returns the relative transformation of the scene node.
//virtual core::matrix4 getRelativeTransformation() const = 0;
//! The animation method.
virtual void OnAnimate(u32 timeMs) =0;
virtual void OnAnimate(u32 timeMs) _IRR_OVERRIDE_ =0;
//! The render method.
/** Does nothing as bones are not visible. */

@ -72,7 +72,7 @@ namespace scene
ISceneManager::addCameraSceneNodeFPS, may want to get
this input for changing their position, look at target or
whatever. */
virtual bool OnEvent(const SEvent& event) =0;
virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_ =0;
//! Sets the look at target of the camera
/** If the camera's target and rotation are bound ( @see
@ -90,7 +90,7 @@ namespace scene
bindTargetAndRotation() ) then calling this will also change
the camera's target to match the rotation.
\param rotation New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation) =0;
virtual void setRotation(const core::vector3df& rotation) _IRR_OVERRIDE_ =0;
//! Gets the current look at target of the camera
/** \return The current look at target of the camera, in world co-ordinates */

@ -260,10 +260,14 @@ public:
Note that it usually works badly to pass the modal screen already as parent when creating
a new element. It's better to add that new element later to the modal screen with addChild.
\param parent Parent gui element of the modal.
\param blinkMode Bitset of when to blink (can be combined)
0 = never
1 = focus changes
2 = Left mouse button pressed down
\return Pointer to the created modal. Returns 0 if an error occurred.
This pointer should not be dropped. See IReferenceCounted::drop() for
more information. */
virtual IGUIElement* addModalScreen(IGUIElement* parent) = 0;
virtual IGUIElement* addModalScreen(IGUIElement* parent, int blinkMode = 3) = 0;
//! Adds a message box.
/** \param caption Text to be displayed the title of the message box.

@ -36,7 +36,7 @@ public:
kerning value. For example, EGFT_BITMAP will add the right kerning value of previousLetter to the
left side kerning value of thisLetter, then add the global value.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const _IRR_OVERRIDE_ = 0;
};
} // end namespace gui

@ -183,6 +183,26 @@ public:
const video::SColor& colorBottom=video::SColor(0xffffffff),
f32 oblique=0.f) const =0;
//! Create a torus mesh
/** Note: Segments might get reduced to ensure it fits into 16-bit meshbuffer.
With 255 segments for minor and major circle you'll hit the maximum.
When using caps 2 more vertices are added.
Note: UV's for caps are probably not useful
\param majorRadius Starting from mesh center
\param minorRadius Starting from a circle at majorRadius distance around center
\param majorSegments Segments for major circle. Will use at least 3 segments.
\param minorSegments Segments for minor circle. Will use at least 3 segments.
\param angleStart Start major circle between 0 and 360° and < angleEnd
\param angleEnd End major circle between 0 and 360° and > angleStart
\param capEnds When you don't create a full major circle you might want caps
0 = no caps (default)
Bit 1: add cap at angleStart
Bit 2: add cap at angleEnd
*/
virtual IMesh* createTorusMesh(f32 majorRadius, f32 minorRadius,
u32 majorSegments = 32, u32 minorSegments = 16,
f32 angleStart=0.f, f32 angleEnd=360.f, int capEnds=0) const = 0;
//! Create a volume light mesh.
/**
\param subdivideU Horizontal patch count.

@ -7,7 +7,7 @@
#include "IReferenceCounted.h"
#include "irrArray.h"
#include "EHardwareBufferFlags.h"
#include "SVertexIndex.h"
namespace irr

@ -8,12 +8,13 @@
#include "IReferenceCounted.h"
#include "irrArray.h"
#include "ISceneManager.h" // for E_SCENE_NODE_RENDER_PASS, could probably move that to own header?
namespace irr
{
namespace scene
{
class ILightSceneNode;
class ISceneNode;
//! ILightManager provides an interface for user applications to manipulate the list of lights in the scene.
/** The light list can be trimmed or re-ordered before device/ hardware

@ -39,7 +39,7 @@ namespace video
//! Returns an array of previously set textures.
const core::array<ITexture*>& getTexture() const
{
return Texture;
return Textures;
}
//! Returns a of previously set depth / depth-stencil texture.
@ -48,34 +48,49 @@ namespace video
return DepthStencil;
}
//! Returns an array of active surface for cube textures
const core::array<E_CUBE_SURFACE>& getCubeSurfaces() const
{
return CubeSurfaces;
}
//! Set multiple textures.
/** Set multiple textures for the render target.
\param texture Array of texture objects. These textures are used for a color outputs.
\param depthStencil Depth or packed depth-stencil texture. This texture is used as depth
or depth-stencil buffer.
or depth-stencil buffer. You can pass getDepthStencil() if you don't want to change it.
\param cubeSurfaces When rendering to cube textures, set the surface to be used for each texture. Can be empty otherwise.
*/
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces = core::array<E_CUBE_SURFACE>()) = 0;
void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces = core::array<E_CUBE_SURFACE>())
{
setTextures(texture.const_pointer(), texture.size(), depthStencil, cubeSurfaces.const_pointer(), cubeSurfaces.size());
}
//! Set one texture.
//! Sets one texture + depthStencil
//! You can pass getDepthStencil() for depthStencil if you don't want to change that one
void setTexture(ITexture* texture, ITexture* depthStencil)
{
core::array<ITexture*> textureArray(1);
textureArray.push_back(texture);
setTexture(textureArray, depthStencil);
if ( texture )
{
setTextures(&texture, 1, depthStencil);
}
else
{
setTextures(0, 0, depthStencil);
}
}
//! Set one cube surface texture.
void setTexture(ITexture* texture, ITexture* depthStencil, E_CUBE_SURFACE cubeSurface)
{
core::array<ITexture*> textureArray(1);
textureArray.push_back(texture);
core::array<E_CUBE_SURFACE> cubeSurfaces(1);
cubeSurfaces.push_back(cubeSurface);
setTexture(textureArray, depthStencil, cubeSurfaces);
if ( texture )
{
setTextures(&texture, 1, depthStencil, &cubeSurface, 1);
}
else
{
setTextures(0, 0, depthStencil, &cubeSurface, 1);
}
}
//! Get driver type of render target.
@ -86,8 +101,12 @@ namespace video
protected:
//! Set multiple textures.
// NOTE: working with pointers instead of arrays to avoid unnecessary memory allocations for the single textures case
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces=0, u32 numCubeSurfaces=0) = 0;
//! Textures assigned to render target.
core::array<ITexture*> Texture;
core::array<ITexture*> Textures;
//! Depth or packed depth-stencil texture assigned to render target.
ITexture* DepthStencil;

@ -1261,7 +1261,7 @@ namespace scene
See IReferenceCounted::drop() for more information. */
virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
const core::array< core::vector3df >& points,
f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false) = 0;
f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false, bool steer=false) = 0;
//! Creates a simple ITriangleSelector, based on a mesh.
/** Triangle selectors

@ -97,6 +97,14 @@ enum E_TEXTURE_CREATION_FLAG
*/
ETCF_AUTO_GENERATE_MIP_MAPS = 0x00000100,
//! Enable support for vertex shader texture sampling on some drivers
/** Default is false.
This adds a small costs to all texture switches.
Currently only affects D3D9.
On OpenGL vertex shaders use the same texture unit as pixel shaders, so support there only depends on GL version and not on this flag
*/
ETCF_SUPPORT_VERTEXT_TEXTURE = 0x00000200,
/** This flag is never used, it only forces the compiler to compile
these enumeration values to 32 bit. */
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff

@ -7,6 +7,7 @@
#include "IReferenceCounted.h"
#include "irrArray.h"
#include "EHardwareBufferFlags.h"
#include "S3DVertex.h"
namespace irr

@ -483,7 +483,7 @@ namespace video
example in picture edit programs. To avoid this problem, you
could use the makeColorKeyTexture method, which takes the
position of a pixel instead a color value.
\param zeroTexels \deprecated If set to true, then any texels that match
\param zeroTexels (deprecated) If set to true, then any texels that match
the color key will have their color, as well as their alpha, set to zero
(i.e. black). This behavior matches the legacy (buggy) behavior prior
to release 1.5 and is provided for backwards compatibility only.
@ -500,7 +500,7 @@ namespace video
\param colorKeyPixelPos Position of a pixel with the color key
color. Every texel with this color will become fully transparent as
described above.
\param zeroTexels \deprecated If set to true, then any texels that match
\param zeroTexels (deprecated) If set to true, then any texels that match
the color key will have their color, as well as their alpha, set to zero
(i.e. black). This behavior matches the legacy (buggy) behavior prior
to release 1.5 and is provided for backwards compatibility only.

@ -368,7 +368,7 @@ for Windows based systems. You also have to set #define UNICODE for this to comp
#undef _IRR_WCHAR_FILESYSTEM
#endif
//! Define _IRR_COMPILE_WITH_JPEGLIB_ to enable compiling the engine using libjpeg.
//! Define _IRR_COMPILE_WITH_LIBJPEG_ to enable compiling the engine using libjpeg.
/** This enables the engine to read jpeg images. If you comment this out,
the engine will no longer read .jpeg images. */
#define _IRR_COMPILE_WITH_LIBJPEG_

@ -30,7 +30,7 @@ namespace irr
Bits(32),
ZBufferBits(24),
Fullscreen(false),
WindowResizable(false),
WindowResizable(2),
Stencilbuffer(true),
Vsync(false),
AntiAlias(0),
@ -131,8 +131,9 @@ namespace irr
//! Should a non-fullscreen window be resizable.
/** Might not be supported by all devices. Ignored when Fullscreen is true.
Default: false */
bool WindowResizable;
Values: 0 = not resizable, 1 = resizable, 2 = system decides default itself
Default: 2*/
u8 WindowResizable;
//! Specifies if the stencil buffer should be enabled.
/** Set this to true, if you want the engine be able to draw

@ -6,6 +6,7 @@
#define __S_LIGHT_H_INCLUDED__
#include "SColor.h"
#include "vector3d.h"
namespace irr
{
@ -98,4 +99,3 @@ struct SLight
} // end namespace irr
#endif

@ -5,6 +5,7 @@
#ifndef __S_VERTEX_MANIPULATOR_H_INCLUDED__
#define __S_VERTEX_MANIPULATOR_H_INCLUDED__
#include "matrix4.h"
#include "S3DVertex.h"
#include "SColor.h"

@ -5,6 +5,8 @@
#ifndef __I_SCENE_PARAMETERS_H_INCLUDED__
#define __I_SCENE_PARAMETERS_H_INCLUDED__
#include "irrTypes.h"
/*! \file SceneParameters.h
\brief Header file containing all scene parameters for modifying mesh loading etc.

@ -13,6 +13,13 @@ namespace irr
namespace core
{
//! Selection of characters which count as decimal point in fast_atof
//! By default Irrlicht considers "." as the decimal point in numbers.
//! But sometimes you might run into situations where floats were written in
//! a local format with another decimal point like ",".
//! Best solution is usually to fix those cases by converting the input.
//! But if you don't have that choice you can set this to ".,".
//! WARNING: This is not thread-safe, so don't change while there's a chance
//! of another thread using fast_atof functions at the same time.
// TODO: This should probably also be used in irr::core::string, but
// the float-to-string code used there has to be rewritten first.
IRRLICHT_API extern irr::core::stringc LOCALE_DECIMAL_POINTS;

@ -231,6 +231,40 @@ public:
free_when_destroyed=_free_when_destroyed;
}
//! Set (copy) data from given memory block
/** \param newData data to set, must have newSize elements
\param newSize Amount of elements in newData
\param canShrink When true we reallocate the array even it can shrink.
May reduce memory usage, but call is more whenever size changes.
\param newDataIsSorted Info if you pass sorted/unsorted data
*/
void set_data(const T* newData, u32 newSize, bool newDataIsSorted=false, bool canShrink=false)
{
reallocate(newSize, canShrink);
set_used(newSize);
for ( u32 i=0; i<newSize; ++i)
{
data[i] = newData[i];
}
is_sorted = newDataIsSorted;
}
//! Compare if given data block is identical to the data in our array
/** Like operator ==, but without the need to create the array
\param otherData Address to data against which we compare, must contain size elements
\param size Amount of elements in otherData */
bool equals(const T* otherData, u32 size) const
{
if (used != size)
return false;
for (u32 i=0; i<size; ++i)
if (data[i] != otherData[i])
return false;
return true;
}
//! Sets if the array should delete the memory it uses upon destruction.
/** Also clear and set_pointer will only delete the (original) memory
@ -258,7 +292,6 @@ public:
used = usedNow;
}
//! Assignment operator
const array<T, TAlloc>& operator=(const array<T, TAlloc>& other)
{
@ -290,13 +323,7 @@ public:
//! Equality operator
bool operator == (const array<T, TAlloc>& other) const
{
if (used != other.used)
return false;
for (u32 i=0; i<other.used; ++i)
if (data[i] != other[i])
return false;
return true;
return equals(other.const_pointer(), other.size());
}

@ -2,7 +2,8 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __LEAK_HUNTER_INCLUDEED__
#ifndef __LEAK_HUNTER_INCLUDED__
#define __LEAK_HUNTER_INCLUDED__
#include "IrrCompileConfig.h"

@ -297,7 +297,8 @@ class line2d
}
//! Get the closest point on this line to a point
/** \param checkOnlySegments: Default (true) is to return a point on the line-segment (between begin and end) of the line.
/** \param point: Starting search at this point
\param checkOnlySegments: Default (true) is to return a point on the line-segment (between begin and end) of the line.
When set to false the function will check for the first the closest point on the the line even when outside the segment. */
vector2d<T> getClosestPoint(const vector2d<T>& point, bool checkOnlySegments=true) const
{

@ -13,7 +13,9 @@ namespace io
{
//! Type used for all file system related strings.
/** This type will transparently handle different file system encodings. */
/** This type will transparently handle different file system encodings.
NOTE: For historical reasons the tool-functions using io::path are all in coreutil.h
*/
typedef core::string<fschar_t> path;
//! Used in places where we identify objects by a filename, but don't actually work with the real filename

@ -1482,7 +1482,9 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED =
PREDEFINED = _IRR_COMPILE_WITH_PROFILING_
PREDEFINED += _IRR_COMPILE_WITH_LEAK_HUNTER_
PREDEFINED += _IRR_COMPILE_WITH_SDL_DEVICE_
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.

File diff suppressed because it is too large Load Diff

@ -1,3 +1,5 @@
mkdir -p ../../../doctemp/html
rm tut.txt || true;
mkdir ../../../doctemp
@ -8,4 +10,11 @@ for i in ../../../examples/[012]*/main.cpp; do
sed -f tutorials.sed $i >>tut.txt;
done
# Enable for latex docs
#doxygen doxygen-pdf.cfg
# Enable for html docs
doxygen doxygen.cfg
#cp doxygen.css ../../../doctemp/html
cp irrlicht.png logobig.png ../../../doctemp/html

@ -1,5 +1,7 @@
1,+18 d
s/src="/src="images\/tutorials\//
s/href="/href="docu\//g
s/\(.*\) <hr.*$/\1/
/<addr/,$ d
# run on single_tut.txt which is created in maketutorial.sh (or .bat)
# replace image links as we don't copy the images into example folders but keep them below media folder
# most images should be in media
s/img src="/img src="..\/..\/media\//g
# ???shots.jpg files are in media/example_screenshots another subfolder (earlier replacement already moved them to ../../media/)
s/img src="..\/..\/media\/\([0-9]\{3\}shot\)/img src="..\/..\/media\/example_screenshots\/\1/

@ -1,4 +1,4 @@
type tut_head.html >%2
..\sed.exe -f maketut.sed %1 >>%2
type tut_end.html >>%2
REM OUTDATED - don't use this anymore. For now only maketutorial.sh works, this one still has to be updated.
REM type tut_head.html >%2
REM ..\sed.exe -f maketut.sed %1 >>%2
REM type tut_end.html >>%2

@ -1,4 +1,34 @@
cat tut_head.html >$2
sed -f maketut.sed $1 >>$2
cat tut_end.html >>$2
# Create the tutorial.html files in each example folder
# for every folder below examples
for i in ../../../examples/[0123]*; do
#for i in ../../../examples/01.*; do # if you want to run/update a single example use this loop
echo NOW doing $i
if ! [ -f "$i/main.cpp" ]; then
continue
fi
# uses the main.cpp files to create some file to use as doxygen input
sed -f tutorials.sed $i/main.cpp >single_tut.txt
# echo tutorials.sed has run
# create the html file
doxygen doxygen_tutorial.cfg
# echo doxygen has run
# Fix the image links
sed -f maketut.sed html/example???.html >tutorial.html
# echo maketut.sed has run
#move to example folder
mv tutorial.html $i/tutorial.html
# echo copied
#cleanup
rm -r html
# echo cleaned
done
#cleanup
rm single_tut.txt

@ -1,14 +1,5 @@
</td>
</tr>
</table>
<p>&nbsp;</p></td>
</tr>
</table>
<div align="right"><br />
<a href="http://validator.w3.org/check?uri=referer" target="_blank"><img src="images/general/valid-xhtml10.png" alt="Valid XHTML 1.0!" width="88" height="31" border="0" /></a>
<a href="http://jigsaw.w3.org/css-validator/" target="_blank"><img src="images/general/vcss.gif" alt="Valid CSS!" width="88" height="31" border="0" /></a></div>
</div>
<p class="copyrighttext"><br />
Irrlicht Engine and Irrlicht Engine webpage &copy; 2003-2010 by Nikolaus Gebhardt</p>
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<p>&nbsp;</p>
</body>
</html>

@ -1,52 +1,228 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>Irrlicht Engine - A free open source 3d engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" href="doxygen.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<!-- (c) 2005-2010 by N.Gebhardt -->
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Wanted to avoid copying .css to each folder, so copied default .css from doxyen in here, kicked out most stuff we don't need for examples and modified some a little bit.
Target was having a single html in each example folder which is created from the main.cpp files and needs no files besides some images below media folder.
Feel free to improve :)
-->
<style>
body, table, div, p, dl {
font: 400 14px/22px;
}
body {
background-color: #F0F0F0;
color: black;
margin-left: 5%;
margin-right: 5%;
}
p.reference, p.definition {
font: 400 14px/22px;
}
.title {
font: 400 14px/28px;
font-size: 150%;
font-weight: bold;
margin: 10px 2px;
}
h1, h2, h3, h4, h5, h6 {
-webkit-transition: text-shadow 0.5s linear;
-moz-transition: text-shadow 0.5s linear;
-ms-transition: text-shadow 0.5s linear;
-o-transition: text-shadow 0.5s linear;
transition: text-shadow 0.5s linear;
margin-right: 15px;
}
caption {
font-weight: bold;
}
h3.version {
font-size: 90%;
text-align: center;
}
a {
color: #3D578C;
font-weight: normal;
text-decoration: none;
}
.contents a:visited {
color: #4665A2;
}
a:hover {
text-decoration: underline;
}
a.el {
font-weight: bold;
}
a.code, a.code:visited, a.line, a.line:visited {
color: #4665A2;
}
a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
color: #4665A2;
}
pre.fragment {
border: 1px solid #C4CFE5;
background-color: #FBFCFD;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
overflow: auto;
word-wrap: break-word;
font-size: 9pt;
line-height: 125%;
font-family: monospace, fixed;
font-size: 105%;
}
div.fragment {
padding: 0px;
margin: 4px 8px 4px 2px;
background-color: #FBFCFD;
border: 1px solid #C4CFE5;
}
div.line {
font-family: monospace, fixed;
font-size: 13px;
min-height: 13px;
line-height: 1.0;
text-wrap: unrestricted;
white-space: -moz-pre-wrap; /* Moz */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 */
word-wrap: break-word; /* IE 5.5+ */
text-indent: -53px;
padding-left: 53px;
padding-bottom: 0px;
margin: 0px;
-webkit-transition-property: background-color, box-shadow;
-webkit-transition-duration: 0.5s;
-moz-transition-property: background-color, box-shadow;
-moz-transition-duration: 0.5s;
-ms-transition-property: background-color, box-shadow;
-ms-transition-duration: 0.5s;
-o-transition-property: background-color, box-shadow;
-o-transition-duration: 0.5s;
transition-property: background-color, box-shadow;
transition-duration: 0.5s;
}
div.contents {
margin-top: 10px;
margin-left: 12px;
margin-right: 8px;
}
div.center {
text-align: center;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
}
div.center img {
border: 0px;
}
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
blockquote {
background-color: #F7F8FB;
border-left: 2px solid #9CAFD4;
margin: 0 24px 0 4px;
padding: 0 12px 0 16px;
}
hr {
height: 0px;
border: none;
border-top: 1px solid #4A6AAA;
}
address {
font-style: normal;
color: #2A3D61;
}
div.header {
background-image:url('nav_h.png');
background-repeat:repeat-x;
background-color: #F9FAFC;
margin: 0px;
border-bottom: 1px solid #C4CFE5;
}
div.headertitle {
padding: 5px 5px 5px 10px;
}
.image {
text-align: center;
}
.caption {
font-weight: bold;
}
div.zoom {
border: 1px solid #90A5CE;
}
tr.heading h2 {
margin-top: 12px;
margin-bottom: 4px;
}
</style>
</head>
<body>
<div align="center"><br/>
<table cellspacing="0" class="main" >
<tr>
<td colspan="2" class="logobar" ><img alt="Irrlicht Engine logo" src="images/general/irrlichtlogo.gif" width="233" height="60" /></td>
</tr>
<tr>
<td colspan="2" class="linkbar" ><a href="index.html">Home</a> | <a href="phpBB2/index.php">Forum</a>
| <a href="docu/index.html" target="_blank">API</a> | <a href="http://www.google.com/custom?domains=irrlicht.sourceforge.net&amp;sitesearch=irrlicht.sourceforge.net" target="_blank">Search</a></td>
</tr>
<tr>
<td class="sidebar"> <div class="sidebarentry">
<p class="sideBarTitle">Engine</p>
<a href="index.html">News</a> <a href="features.html">Features</a> <a href="screenshots.html">Screenshots</a>
<a href="downloads.html">Downloads</a>
<a href="development.html">Development</a>
<a href="toolset.html">Toolset</a>
</div>
<div class="sidebarentry">
<p class="sideBarTitle">Documentation</p>
<a href="faq.html">FAQ</a> <a href="docu/index.html" target="_blank">API</a>
<a href="docu.net/index.html" target="_blank">API.NET</a> <a href="tutorials.html">Tutorials</a>
<a href="license.html">License</a> <a href="newsarchive.html">News-Archive</a>
<a href="http://www.irrlicht3d.org/wiki" target="_blank">Wiki</a> </div>
<div class="sidebarentry">
<p class="sideBarTitle">Sourceforge</p>
<a href="http://sourceforge.net/projects/irrlicht/">Project Page</a>
<a href="phpBB2/index.php">Forums</a>
<a href="shirts.html">Shirts</a> </div>
<div class="sidebarentry">
<p class="sideBarTitle">Contact</p>
<a href="links.html">Links</a> <a href="author.html">Author</a> <a href="impressum.html">Impressum</a> </div>
<p><a href="http://irrlicht.sourceforge.net"><br />
<img alt="Irrlicht Engine logo button" src="images/general/irrlicht.png" width="88" height="31" border="0" /></a></p>
<p><a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=74339&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a></p>
<p> <a href="http://opensource.org/" target="_blank"><img alt="OSI Certified logo" src="images/general/osi-certified-72x60-t.png" width="72" height="60" border="0" /></a>
</p>
<p>&nbsp; </p></td>
<td class="mainframe" > <table class="newsbox" >
<tr>
<td class="newscontent">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--END TITLEAREA-->
<!-- end header part -->

@ -698,12 +698,6 @@ bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
if (CurrentTexture[stage] == texture)
return true;
if (texture && texture->getDriverType() != EDT_DIRECT3D9)
{
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
return false;
}
CurrentTexture[stage] = texture;
if (!texture)
@ -711,13 +705,20 @@ bool CD3D9Driver::setActiveTexture(u32 stage, const video::ITexture* texture)
pID3DDevice->SetTexture(stage, 0);
pID3DDevice->SetTextureStageState( stage, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
}
else
else if (texture->getDriverType() == EDT_DIRECT3D9)
{
pID3DDevice->SetTexture(stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
if (stage <= 4)
if (((const CD3D9Texture*)texture)->HasVertexTextureSupport() && stage < 4 )
pID3DDevice->SetTexture(D3DVERTEXTEXTURESAMPLER0 + stage, ((const CD3D9Texture*)texture)->getDX9BaseTexture());
}
else
{
os::Printer::log("Fatal Error: Tried to set a texture not owned by this driver.", ELL_ERROR);
setActiveTexture(stage, 0);
return false;
}
return true;
}
@ -909,13 +910,6 @@ void CD3D9Driver::setViewPort(const core::rect<s32>& area)
}
//! gets the area of the current viewport
const core::rect<s32>& CD3D9Driver::getViewPort() const
{
return ViewPort;
}
bool CD3D9Driver::updateVertexHardwareBuffer(SHWBufferLink_d3d9 *hwBuffer)
{
if (!hwBuffer)

@ -64,9 +64,6 @@ namespace video
//! sets a viewport
virtual void setViewPort(const core::rect<s32>& area) _IRR_OVERRIDE_;
//! gets the area of the current viewport
virtual const core::rect<s32>& getViewPort() const _IRR_OVERRIDE_;
struct SHWBufferLink_d3d9 : public SHWBufferLink
{
SHWBufferLink_d3d9(const scene::IMeshBuffer *_MeshBuffer):

@ -30,36 +30,36 @@ namespace irr
CD3D9RenderTarget::~CD3D9RenderTarget()
{
for (u32 i = 0; i < Surface.size(); ++i)
for (u32 i = 0; i < Surfaces.size(); ++i)
{
if (Surface[i])
Surface[i]->Release();
if (Surfaces[i])
Surfaces[i]->Release();
}
if (DepthStencilSurface)
DepthStencilSurface->Release();
for (u32 i = 0; i < Texture.size(); ++i)
for (u32 i = 0; i < Textures.size(); ++i)
{
if (Texture[i])
Texture[i]->drop();
if (Textures[i])
Textures[i]->drop();
}
if (DepthStencil)
DepthStencil->drop();
}
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
void CD3D9RenderTarget::setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces)
{
bool needSizeUpdate = false;
// Set color attachments.
if ((Texture != texture) || (CubeSurfaces != cubeSurfaces))
if (!Textures.equals(textures, numTextures) || !CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))
{
needSizeUpdate = true;
CubeSurfaces = cubeSurfaces; // TODO: we can probably avoid some memory allocating/de-allocating if _only_ CubeSurfaces change.
CubeSurfaces.set_data(cubeSurfaces, numCubeSurfaces); // TODO: we can probably avoid some memory allocating/de-allocating if _only_ CubeSurfaces change.
if (texture.size() > Driver->ActiveRenderTarget.size())
if (numTextures > Driver->ActiveRenderTarget.size())
{
core::stringc message = "This GPU supports up to ";
message += Driver->ActiveRenderTarget.size();
@ -68,23 +68,23 @@ namespace irr
os::Printer::log(message.c_str(), ELL_WARNING);
}
const u32 size = core::min_(texture.size(), static_cast<u32>(Driver->ActiveRenderTarget.size()));
const u32 size = core::min_(numTextures, static_cast<u32>(Driver->ActiveRenderTarget.size()));
for (u32 i = 0; i < Surface.size(); ++i)
for (u32 i = 0; i < Surfaces.size(); ++i)
{
if (Surface[i])
Surface[i]->Release();
if (Surfaces[i])
Surfaces[i]->Release();
}
Surface.set_used(size);
Surfaces.set_used(size);
core::array<ITexture*> prevTextures(Texture);
core::array<ITexture*> prevTextures(Textures);
Texture.set_used(size);
Textures.set_used(size);
for (u32 i = 0; i < size; ++i)
{
CD3D9Texture* currentTexture = (texture[i] && texture[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(texture[i]) : 0;
CD3D9Texture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(textures[i]) : 0;
IDirect3DTexture9* textureID = 0;
IDirect3DCubeTexture9* cubeTextureId = 0;
@ -100,29 +100,29 @@ namespace irr
if (textureID)
{
Texture[i] = texture[i];
Texture[i]->grab();
Textures[i] = textures[i];
Textures[i]->grab();
IDirect3DSurface9* currentSurface = 0;
textureID->GetSurfaceLevel(level, &currentSurface);
Surface[i] = currentSurface;
Surfaces[i] = currentSurface;
}
else if ( cubeTextureId )
{
Texture[i] = texture[i];
Texture[i]->grab();
Textures[i] = textures[i];
Textures[i]->grab();
IDirect3DSurface9* currentSurface = 0;
D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES)CubeSurfaces[i]; // we use same numbering
cubeTextureId->GetCubeMapSurface(face, level, &currentSurface);
Surface[i] = currentSurface;
Surfaces[i] = currentSurface;
}
else
{
Surface[i] = 0;
Texture[i] = 0;
Surfaces[i] = 0;
Textures[i] = 0;
}
}
@ -189,11 +189,11 @@ namespace irr
bool sizeDetected = false;
for (u32 i = 0; i < Texture.size(); ++i)
for (u32 i = 0; i < Textures.size(); ++i)
{
if (Texture[i])
if (Textures[i])
{
Size = Texture[i]->getSize();
Size = Textures[i]->getSize();
sizeDetected = true;
break;
@ -217,12 +217,12 @@ namespace irr
IDirect3DSurface9* CD3D9RenderTarget::getSurface(u32 id) const
{
return (id < Surface.size()) ? Surface[id] : 0;
return (id < Surfaces.size()) ? Surfaces[id] : 0;
}
u32 CD3D9RenderTarget::getSurfaceCount() const
{
return Surface.size();
return Surfaces.size();
}
IDirect3DSurface9* CD3D9RenderTarget::getDepthStencilSurface() const
@ -232,12 +232,12 @@ namespace irr
void CD3D9RenderTarget::releaseSurfaces()
{
for (u32 i = 0; i < Surface.size(); ++i)
for (u32 i = 0; i < Surfaces.size(); ++i)
{
if (Surface[i])
if (Surfaces[i])
{
Surface[i]->Release();
Surface[i] = 0;
Surfaces[i]->Release();
Surfaces[i] = 0;
}
}
@ -250,16 +250,16 @@ namespace irr
void CD3D9RenderTarget::generateSurfaces()
{
for (u32 i = 0; i < Surface.size(); ++i)
for (u32 i = 0; i < Surfaces.size(); ++i)
{
if (!Surface[i] && Texture[i])
if (!Surfaces[i] && Textures[i])
{
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Texture[i])->getDX9Texture();
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Textures[i])->getDX9Texture();
if ( currentTexture )
{
IDirect3DSurface9* currentSurface = 0;
currentTexture->GetSurfaceLevel(0, &currentSurface);
Surface[i] = currentSurface;
Surfaces[i] = currentSurface;
}
}
}

@ -29,7 +29,7 @@ namespace irr
CD3D9RenderTarget(CD3D9Driver* driver);
virtual ~CD3D9RenderTarget();
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) _IRR_OVERRIDE_;
const core::dimension2d<u32>& getSize() const;
@ -46,7 +46,7 @@ namespace irr
protected:
core::dimension2d<u32> Size;
core::array<IDirect3DSurface9*> Surface;
core::array<IDirect3DSurface9*> Surfaces;
IDirect3DSurface9* DepthStencilSurface;

@ -38,18 +38,20 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
DWORD flags = 0;
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
D3DDISPLAYMODE d3ddm;
intf->GetAdapterDisplayMode(Driver->Params.DisplayAdapter, &d3ddm);
if (HasMipMaps && HardwareMipMaps)
{
LPDIRECT3D9 intf = Driver->getExposedVideoData().D3D9.D3D9;
D3DDISPLAYMODE d3ddm;
intf->GetAdapterDisplayMode(Driver->Params.DisplayAdapter, &d3ddm);
if (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_AUTOGENMIPMAP, D3DRTYPE_TEXTURE, InternalFormat))
flags = D3DUSAGE_AUTOGENMIPMAP;
else
HardwareMipMaps = false;
}
VertexTextureSupport = Driver->getTextureCreationFlag(ETCF_SUPPORT_VERTEXT_TEXTURE)
&& (D3D_OK == intf->CheckDeviceFormat(Driver->Params.DisplayAdapter, D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, InternalFormat));
HRESULT hr = 0;
switch (Type)

@ -42,6 +42,11 @@ public:
IDirect3DTexture9* getDX9Texture() const;
IDirect3DCubeTexture9* getDX9CubeTexture() const;
inline bool HasVertexTextureSupport() const
{
return VertexTextureSupport;
}
private:
friend class CD3D9Driver;
@ -77,6 +82,7 @@ private:
u32 MipLevelLocked;
bool HardwareMipMaps;
bool VertexTextureSupport;
IDirect3DDevice9* Device;
IDirect3DTexture9* Texture;

@ -280,7 +280,7 @@ bool CGLXManager::initialize(const SIrrlichtCreationParameters& params, const SE
void CGLXManager::terminate()
{
memset(&CurrentContext, 0, sizeof(CurrentContext));
memset((void*)&CurrentContext, 0, sizeof(CurrentContext));
}
bool CGLXManager::generateSurface()

@ -642,8 +642,8 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
// For keys we handle the event before changing focus to give elements the chance for catching the TAB
// Send focus changing event
// CAREFUL when changing - there's an identical check in CGUIModalScreen::OnEvent
if (FocusFlags & EFF_SET_ON_TAB &&
event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.PressedDown &&
event.KeyInput.Key == KEY_TAB)
{
@ -1073,11 +1073,12 @@ IGUIWindow* CGUIEnvironment::addWindow(const core::rect<s32>& rectangle, bool mo
//! adds a modal screen. The returned pointer must not be dropped.
IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent)
IGUIElement* CGUIEnvironment::addModalScreen(IGUIElement* parent, int blinkMode)
{
parent = parent ? parent : this;
IGUIElement *win = new CGUIModalScreen(this, parent, -1);
CGUIModalScreen *win = new CGUIModalScreen(this, parent, -1);
win->setBlinkMode(blinkMode);
win->drop();
return win;

@ -97,7 +97,7 @@ public:
const wchar_t* text=0, IGUIElement* parent=0, s32 id=-1) _IRR_OVERRIDE_;
//! adds a modal screen. The returned pointer must not be dropped.
virtual IGUIElement* addModalScreen(IGUIElement* parent) _IRR_OVERRIDE_;
virtual IGUIElement* addModalScreen(IGUIElement* parent, int blinkMode) _IRR_OVERRIDE_;
//! Adds a message box.
virtual IGUIWindow* addMessageBox(const wchar_t* caption, const wchar_t* text=0,

@ -720,6 +720,7 @@ void CGUIListBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWr
}
}
}
out->addInt("Selected", Selected);
}
@ -759,6 +760,8 @@ void CGUIListBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadW
}
}
}
Selected = in->getAttributeAsInt("Selected", Selected);
recalculateScrollPos();
}

@ -18,6 +18,7 @@ namespace gui
//! constructor
CGUIModalScreen::CGUIModalScreen(IGUIEnvironment* environment, IGUIElement* parent, s32 id)
: IGUIElement(EGUIET_MODAL_SCREEN, environment, parent, id, core::recti(0, 0, parent->getAbsolutePosition().getWidth(), parent->getAbsolutePosition().getHeight()) ),
BlinkMode(3),
MouseDownTime(0)
{
#ifdef _DEBUG
@ -90,7 +91,8 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
{
Environment->removeFocus(0); // can't setFocus otherwise at it still has focus here
Environment->setFocus(event.GUIEvent.Element);
MouseDownTime = os::Timer::getTime();
if ( BlinkMode&1 )
MouseDownTime = os::Timer::getTime();
return true;
}
if ( !canTakeFocus(event.GUIEvent.Caller))
@ -112,7 +114,7 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
else
Environment->setFocus(this);
}
else
else if ( BlinkMode&1 )
{
MouseDownTime = os::Timer::getTime();
}
@ -130,10 +132,24 @@ bool CGUIModalScreen::OnEvent(const SEvent& event)
}
break;
case EET_MOUSE_INPUT_EVENT:
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN && (BlinkMode & 2))
{
MouseDownTime = os::Timer::getTime();
}
break;
case EET_KEY_INPUT_EVENT:
// CAREFUL when changing - there's an identical check in CGUIEnvironment::postEventFromUser
if (Environment->getFocusBehavior() & EFF_SET_ON_TAB &&
event.KeyInput.PressedDown &&
event.KeyInput.Key == KEY_TAB)
{
IGUIElement* next = Environment->getNextElement(event.KeyInput.Shift, event.KeyInput.Control);
if ( next && isMyChild(next) )
{
// Pass on the TAB-key, otherwise focus-tabbing inside modal screens breaks
return false;
}
}
default:
break;
}
@ -153,7 +169,7 @@ void CGUIModalScreen::draw()
return;
u32 now = os::Timer::getTime();
if (now - MouseDownTime < 300 && (now / 70)%2)
if (BlinkMode && now - MouseDownTime < 300 && (now / 70)%2)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
core::rect<s32> r;
@ -219,12 +235,16 @@ void CGUIModalScreen::updateAbsolutePosition()
void CGUIModalScreen::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
IGUIElement::serializeAttributes(out,options);
out->addInt("BlinkMode", BlinkMode );
}
//! Reads attributes of the element
void CGUIModalScreen::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
IGUIElement::deserializeAttributes(in, options);
BlinkMode = in->getAttributeAsInt("BlinkMode", BlinkMode);
}

@ -52,11 +52,27 @@ namespace gui
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
//! Set when to blink.
//! Bitset of following values (can be combined)
//! 0 = never
//! 1 = focus changes
//! 2 = Left mouse button pressed down
void setBlinkMode(u32 blink)
{
BlinkMode = blink;
}
u32 getBlinkMode() const
{
return BlinkMode;
}
protected:
virtual bool canTakeFocus(IGUIElement* target) const;
private:
u32 BlinkMode;
u32 MouseDownTime;
};

@ -378,7 +378,7 @@ IMesh* CGeometryCreator::createTerrainMesh(video::IImage* texture,
blockSize.Height = hMapSize.Height - processed.Y;
SMeshBuffer* buffer = new SMeshBuffer();
buffer->setHardwareMappingHint(scene::EHM_STATIC);
buffer->setHardwareMappingHint(EHM_STATIC);
buffer->Vertices.reallocate(blockSize.getArea());
// add vertices of vertex block
u32 y;
@ -500,7 +500,7 @@ IMesh* CGeometryCreator::createArrowMesh(const u32 tesselationCylinder,
IMesh* mesh2 = createConeMesh(width1, height-cylinderHeight, tesselationCone, vtxColor1, vtxColor0);
for (u32 i=0; i<mesh2->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* buffer = mesh2->getMeshBuffer(i);
IMeshBuffer* buffer = mesh2->getMeshBuffer(i);
for (u32 j=0; j<buffer->getVertexCount(); ++j)
buffer->getPosition(j).Y += cylinderHeight;
buffer->setDirty(EBT_VERTEX);
@ -925,6 +925,138 @@ IMesh* CGeometryCreator::createConeMesh(f32 radius, f32 length, u32 tesselation,
return mesh;
}
irr::scene::IMesh* CGeometryCreator::createTorusMesh(irr::f32 majorRadius, irr::f32 minorRadius, irr::u32 majorSegments, irr::u32 minorSegments, f32 angleStart, f32 angleEnd, int capEnds) const
{
if ( majorRadius == 0.f || minorRadius == 0.f )
return 0;
if ( majorSegments < 3 )
majorSegments = 3;
if ( minorSegments < 3 )
minorSegments = 3;
// Note: first/last vertices of major and minor lines are on same position, but not shared to allow for independent uv's.
// prevent 16-bit vertex buffer overflow
const u32 numCapVertices = (capEnds & 1 ? 1 : 0) + (capEnds & 2 ? 1 : 0);
u32 numVertices = (majorSegments+1)*(minorSegments+1)+numCapVertices;
while (numVertices > 65536)
{
if ( majorSegments > 2*minorSegments )
majorSegments /= 2;
else if ( minorSegments > 2*majorSegments )
minorSegments /= 2;
else
{
majorSegments /= 2;
minorSegments /= 2;
}
numVertices = (majorSegments+1)*(minorSegments+1)+numCapVertices;
}
const u32 majorLines = majorSegments+1;
const u32 minorLines = minorSegments+1;
const video::SColor color(255,255,255,255);
SMeshBuffer* buffer = new SMeshBuffer();
buffer->Indices.reallocate(majorSegments*minorSegments*6);
buffer->Vertices.reallocate(numVertices);
if ( angleStart > angleEnd )
core::swap(angleStart, angleEnd);
const f32 radStart = angleStart * core::DEGTORAD;
const f32 radEnd = angleEnd * core::DEGTORAD;
const f32 radMajor = radEnd-radStart;
const f32 radStepMajor = radMajor / majorSegments;
const f32 TWO_PI = 2.f*core::PI;
const f32 radStepMinor = TWO_PI / minorSegments;
// vertices
for ( irr::u32 major = 0; major < majorLines; ++major)
{
const f32 radMajor = radStart + major*radStepMajor;
const f32 cosMajor = cosf(radMajor);
const f32 sinMajor = sinf(radMajor);
// points of major circle
const core::vector3df pm(majorRadius*cosMajor, 0.f, majorRadius * sinMajor);
for ( irr::u32 minor = 0; minor < minorLines; ++minor)
{
const f32 radMinor = minor*radStepMinor;
const f32 cosMinor = cosf(radMinor);
const core::vector3df n(cosMinor * cosMajor, sinf(radMinor), cosMinor * sinMajor);
const core::vector2df uv(radMajor/TWO_PI, radMinor/TWO_PI);
buffer->Vertices.push_back( video::S3DVertex(pm+n*minorRadius, n, color, uv) );
}
}
// indices
for ( irr::u32 major = 0; major < majorSegments; ++major)
{
for ( irr::u32 minor = 0; minor < minorSegments; ++minor)
{
const irr::u16 i = major*minorLines+minor;
buffer->Indices.push_back(i+1);
buffer->Indices.push_back(i+minorLines);
buffer->Indices.push_back(i);
buffer->Indices.push_back(i+1);
buffer->Indices.push_back(i+minorLines+1);
buffer->Indices.push_back(i+minorLines);
}
}
// add start caps
if ( capEnds & 1 )
{
const core::vector3df p(cosf(radStart), 0.f, sinf(radStart));
const core::vector3df n( p.crossProduct(core::vector3df(0,-1,0)) );
const core::vector2df uv(radStart/TWO_PI, 0.5f);
buffer->Vertices.push_back( video::S3DVertex(p*majorRadius, n, color, uv) );
const irr::u16 i=buffer->Vertices.size()-1;
for ( irr::u32 minor = 0; minor < minorSegments; ++minor)
{
buffer->Indices.push_back(minor+1);
buffer->Indices.push_back(minor);
buffer->Indices.push_back(i);
}
}
// add end caps
if ( capEnds & 2 )
{
const core::vector3df p(cosf(radEnd), 0.f, sinf(radEnd));
const core::vector3df n( p.crossProduct(core::vector3df(0,1,0)) );
const core::vector2df uv(radEnd/TWO_PI, 0.5f);
buffer->Vertices.push_back( video::S3DVertex(p*majorRadius, n, color, uv) );
const irr::u16 i=buffer->Vertices.size()-1;
const irr::u16 k=i-numCapVertices;
for ( irr::u32 minor = 0; minor < minorSegments; ++minor)
{
buffer->Indices.push_back(k-minor-1);
buffer->Indices.push_back(k-minor);
buffer->Indices.push_back(i);
}
}
// recalculate bounding box
buffer->BoundingBox.MaxEdge.X = core::abs_(majorRadius)+core::abs_(minorRadius);
buffer->BoundingBox.MaxEdge.Z = buffer->BoundingBox.MaxEdge.X;
buffer->BoundingBox.MaxEdge.Y = core::abs_(minorRadius);
buffer->BoundingBox.MinEdge = buffer->BoundingBox.MaxEdge*-1.f;
SMesh* mesh = new SMesh();
mesh->addMeshBuffer(buffer);
buffer->drop();
mesh->setHardwareMappingHint(EHM_STATIC);
mesh->recalculateBoundingBox();
return mesh;
}
void CGeometryCreator::addToBuffer(const video::S3DVertex& v, SMeshBuffer* Buffer) const
{

@ -51,6 +51,10 @@ public:
const video::SColor& colorBottom=0xffffffff,
f32 oblique=0.f) const _IRR_OVERRIDE_;
virtual IMesh* createTorusMesh(f32 majorRadius, f32 minorRadius,
u32 majorSegments, u32 minorSegments,
f32 angleStart, f32 angleEnd, int capEnds) const _IRR_OVERRIDE_;
virtual IMesh* createVolumeLightMesh(
const u32 subdivideU=32, const u32 subdivideV=32,
const video::SColor footColor=0xffffffff,

@ -16,11 +16,6 @@ namespace irr
namespace video
{
#ifdef _IRR_COMPILE_WITH_LIBJPEG_
// Static members
io::path CImageLoaderJPG::Filename;
#endif
//! constructor
CImageLoaderJPG::CImageLoaderJPG()
{
@ -56,6 +51,9 @@ bool CImageLoaderJPG::isALoadableFileExtension(const io::path& filename) const
// for longjmp, to return to caller on a fatal error
jmp_buf setjmp_buffer;
// for having access to the filename when printing the error messages
core::stringc* filename;
};
void CImageLoaderJPG::init_source (j_decompress_ptr cinfo)
@ -113,7 +111,9 @@ void CImageLoaderJPG::output_message(j_common_ptr cinfo)
c8 temp1[JMSG_LENGTH_MAX];
(*cinfo->err->format_message)(cinfo, temp1);
core::stringc errMsg("JPEG FATAL ERROR in ");
errMsg += core::stringc(Filename);
irr_jpeg_error_mgr* myerr = (irr_jpeg_error_mgr*)cinfo->err;
errMsg += *myerr->filename;
os::Printer::log(errMsg.c_str(),temp1, ELL_ERROR);
}
#endif // _IRR_COMPILE_WITH_LIBJPEG_
@ -144,7 +144,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
if (!file)
return 0;
Filename = file->getFileName();
core::stringc filename = file->getFileName();
u8 **rowPtr=0;
u8* input = new u8[file->getSize()];
@ -162,6 +162,7 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
cinfo.err = jpeg_std_error(&jerr.pub);
cinfo.err->error_exit = error_exit;
cinfo.err->output_message = output_message;
jerr.filename = &filename;
// compatibility fudge:
// we need to use setjmp/longjmp for error handling as gcc-linux

@ -100,9 +100,6 @@ private:
data has been read. Often a no-op. */
static void term_source (j_decompress_ptr cinfo);
// Copy filename to have it around for error-messages
static io::path Filename;
#endif // _IRR_COMPILE_WITH_LIBJPEG_
};

@ -95,7 +95,7 @@ namespace irr
//! Get the device type
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
{
return EIDT_CONSOLE;
return EIDT_CONSOLE;
}
void addPostPresentText(s16 X, s16 Y, const wchar_t *text);

@ -146,7 +146,8 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
// create the window, only if we do not use the null device
if (!createWindow())
return;
setResizable(param.WindowResizable);
if (param.WindowResizable < 2 )
setResizable(param.WindowResizable == 1 ? true : false);
}
// create cursor control
@ -521,12 +522,25 @@ bool CIrrDeviceLinux::createWindow()
XWindow = (Window)CreationParams.WindowId;
if (!CreationParams.IgnoreInput)
{
XCreateWindow(XDisplay,
// Note: This might be further improved by using a InputOnly window instead of InputOutput.
// I think then it should be possible to render into the given parent window instead of
// creating a child-window.
// That could also be a third option for IgnoreInput in the CreationParams.
// But we need another window variable then and have to split input/output in
// the rest of the device code.
// Also... this does possibly leak.
Window child_window = XCreateWindow(XDisplay,
XWindow,
0, 0, Width, Height, 0, VisualInfo->depth,
InputOutput, VisualInfo->visual,
CWBorderPixel | CWColormap | CWEventMask,
&WndAttributes);
// do not forget to map new window
XMapWindow(XDisplay, child_window);
// overwrite device window id
XWindow = child_window;
}
XWindowAttributes wa;
XGetWindowAttributes(XDisplay, XWindow, &wa);
@ -2201,6 +2215,9 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
: Device(dev)
#ifdef _IRR_COMPILE_WITH_X11_
, PlatformBehavior(gui::ECPB_NONE), LastQuery(0)
#ifdef _IRR_LINUX_X11_XINPUT2_
, DeviceId(0)
#endif
#endif
, IsVisible(true), Null(null), UseReferenceRect(false)
, ActiveIcon(gui::ECI_NORMAL), ActiveIconStartTime(0)
@ -2208,6 +2225,10 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
#ifdef _IRR_COMPILE_WITH_X11_
if (!Null)
{
#ifdef _IRR_LINUX_X11_XINPUT2_
XIGetClientPointer(Device->XDisplay, Device->XWindow, &DeviceId);
#endif
XGCValues values;
unsigned long valuemask = 0;

@ -28,6 +28,10 @@
#endif
#include <X11/keysym.h>
#ifdef _IRR_LINUX_X11_XINPUT2_
#include <X11/extensions/XInput2.h>
#endif
#else
#define KeySym s32
#endif
@ -121,7 +125,7 @@ namespace irr
//! Get the device type
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
{
return EIDT_X11;
return EIDT_X11;
}
#ifdef _IRR_COMPILE_WITH_X11_
@ -215,22 +219,54 @@ namespace irr
{
if (UseReferenceRect)
{
XWarpPointer(Device->XDisplay,
None,
Device->XWindow, 0, 0,
Device->Width,
Device->Height,
ReferenceRect.UpperLeftCorner.X + x,
ReferenceRect.UpperLeftCorner.Y + y);
// NOTE: XIWarpPointer works when X11 has set a coordinate transformation matrix for the mouse unlike XWarpPointer
// which runs into a bug mentioned here: https://gitlab.freedesktop.org/xorg/xserver/-/issues/600
// So also workaround for Irrlicht bug #450
#ifdef _IRR_LINUX_X11_XINPUT2_
if ( DeviceId != 0)
{
XIWarpPointer(Device->XDisplay,
DeviceId,
None,
Device->XWindow, 0, 0,
Device->Width,
Device->Height,
ReferenceRect.UpperLeftCorner.X + x,
ReferenceRect.UpperLeftCorner.Y + y);
}
else
#endif
{
XWarpPointer(Device->XDisplay,
None,
Device->XWindow, 0, 0,
Device->Width,
Device->Height,
ReferenceRect.UpperLeftCorner.X + x,
ReferenceRect.UpperLeftCorner.Y + y);
}
}
else
{
XWarpPointer(Device->XDisplay,
None,
Device->XWindow, 0, 0,
Device->Width,
Device->Height, x, y);
#ifdef _IRR_LINUX_X11_XINPUT2_
if ( DeviceId != 0)
{
XIWarpPointer(Device->XDisplay,
DeviceId,
None,
Device->XWindow, 0, 0,
Device->Width,
Device->Height, x, y);
}
else
#endif
{
XWarpPointer(Device->XDisplay,
None,
Device->XWindow, 0, 0,
Device->Width,
Device->Height, x, y);
}
}
XFlush(Device->XDisplay);
}
@ -344,6 +380,10 @@ namespace irr
u32 LastQuery;
Cursor InvisCursor;
#ifdef _IRR_LINUX_X11_XINPUT2_
int DeviceId;
#endif
struct CursorFrameX11
{
CursorFrameX11() : IconHW(0) {}

@ -187,7 +187,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
Screen((SDL_Surface*)param.WindowId), SDL_Flags(SDL_ANYFORMAT),
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
Resizable(param.WindowResizable), WindowMinimized(false)
Resizable(param.WindowResizable == 1 ? true : false), WindowMinimized(false)
{
#ifdef _DEBUG
setDebugName("CIrrDeviceSDL");

@ -100,7 +100,7 @@ namespace irr
//! Get the device type
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
{
return EIDT_SDL;
return EIDT_SDL;
}
//! Implementation of the linux cursor control

@ -1050,7 +1050,7 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
clientSize.right = CreationParams.WindowSize.Width;
clientSize.bottom = CreationParams.WindowSize.Height;
DWORD style = getWindowStyle(CreationParams.Fullscreen, CreationParams.WindowResizable);
DWORD style = getWindowStyle(CreationParams.Fullscreen, CreationParams.WindowResizable > 0 ? true : false);
AdjustWindowRect(&clientSize, style, FALSE);
const s32 realWidth = clientSize.right - clientSize.left;

@ -107,7 +107,7 @@ namespace irr
//! Get the device type
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_
{
return EIDT_WIN32;
return EIDT_WIN32;
}
//! Compares to the last call of this function to return double and triple clicks.

@ -31,22 +31,22 @@ namespace video
~CNSOGLManager();
// Initialize
bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data);
bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) _IRR_OVERRIDE_;
// Terminate
void terminate();
void terminate() _IRR_OVERRIDE_;
// Create surface.
bool generateSurface();
bool generateSurface() _IRR_OVERRIDE_;
// Destroy surface.
void destroySurface();
void destroySurface() _IRR_OVERRIDE_;
// Create context.
bool generateContext();
bool generateContext() _IRR_OVERRIDE_;
// Destroy EGL context.
void destroyContext();
void destroyContext() _IRR_OVERRIDE_;
//! Get current context
const SExposedVideoData& getContext() const;
@ -55,7 +55,7 @@ namespace video
bool activateContext(const SExposedVideoData& videoData, bool restorePrimaryOnZero) _IRR_OVERRIDE_;
// Swap buffers.
bool swapBuffers();
bool swapBuffers() _IRR_OVERRIDE_;
private:
SIrrlichtCreationParameters Params;

@ -190,7 +190,7 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
// set ExposedData to 0
memset(&ExposedData, 0, sizeof(ExposedData));
memset((void*)&ExposedData, 0, sizeof(ExposedData));
for (u32 i=0; i<video::EVDF_COUNT; ++i)
FeatureEnabled[i]=true;
@ -1603,7 +1603,9 @@ core::array<IImage*> CNullDriver::createImagesFromFile(io::IReadFile* file, E_TE
{
// dito
file->seek(0);
if (SurfaceLoader[i]->isALoadableFileFormat(file))
if (SurfaceLoader[i]->isALoadableFileFormat(file)
&& !SurfaceLoader[i]->isALoadableFileExtension(file->getFileName()) // extension was tried above already
)
{
file->seek(0);
imageArray = SurfaceLoader[i]->loadImages(file, type);

@ -711,11 +711,11 @@ const c8* COBJMeshFileLoader::readColor(const c8* bufPtr, video::SColor& color,
c8 colStr[COLOR_BUFFER_LENGTH];
bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd);
color.setRed((s32)(core::fast_atof(colStr) * 255.0f));
color.setRed((u32)core::round32(core::fast_atof(colStr)*255.f));
bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd);
color.setGreen((s32)(core::fast_atof(colStr) * 255.0f));
color.setGreen((u32)core::round32(core::fast_atof(colStr)*255.f));
bufPtr = goAndCopyNextWord(colStr, bufPtr, COLOR_BUFFER_LENGTH, bufEnd);
color.setBlue((s32)(core::fast_atof(colStr) * 255.0f));
color.setBlue((u32)core::round32(core::fast_atof(colStr)*255.f));
return bufPtr;
}

@ -244,34 +244,25 @@ bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
void COBJMeshWriter::getVectorAsStringLine(const core::vector3df& v, core::stringc& s) const
{
s = core::stringc(-v.X);
s += " ";
s += core::stringc(v.Y);
s += " ";
s += core::stringc(v.Z);
s += "\n";
c8 tmpbuf[255];
snprintf_irr(tmpbuf, 255, "%f %f %f\n", -v.X, v.Y, v.Z);
s = tmpbuf;
}
void COBJMeshWriter::getVectorAsStringLine(const core::vector2df& v, core::stringc& s) const
{
s = core::stringc(v.X);
s += " ";
s += core::stringc(1-v.Y);
s += "\n";
c8 tmpbuf[255];
snprintf_irr(tmpbuf, 255, "%f %f\n", v.X, 1.f-v.Y);
s = tmpbuf;
}
void COBJMeshWriter::getColorAsStringLine(const video::SColor& color, const c8* const prefix, core::stringc& s) const
{
s = prefix;
s += " ";
s += core::stringc((double)(color.getRed()/255.f));
s += " ";
s += core::stringc((double)(color.getGreen()/255.f));
s += " ";
s += core::stringc((double)(color.getBlue()/255.f));
s += "\n";
c8 tmpbuf[255];
snprintf_irr(tmpbuf, 255, "%s %f %f %f\n", prefix, (float)(color.getRed()/255.f), (float)(color.getGreen()/255.f), (float)(color.getBlue()/255.f));
s = tmpbuf;
}

@ -37,10 +37,10 @@ public:
if (ColorAttachment > 0)
Driver->irrGlGenFramebuffers(1, &BufferID);
AssignedTexture.set_used(static_cast<u32>(ColorAttachment));
AssignedTextures.set_used(static_cast<u32>(ColorAttachment));
for (u32 i = 0; i < AssignedTexture.size(); ++i)
AssignedTexture[i] = GL_NONE;
for (u32 i = 0; i < AssignedTextures.size(); ++i)
AssignedTextures[i] = GL_NONE;
}
virtual ~COpenGLCoreRenderTarget()
@ -48,28 +48,28 @@ public:
if (ColorAttachment > 0 && BufferID != 0)
Driver->irrGlDeleteFramebuffers(1, &BufferID);
for (u32 i = 0; i < Texture.size(); ++i)
for (u32 i = 0; i < Textures.size(); ++i)
{
if (Texture[i])
Texture[i]->drop();
if (Textures[i])
Textures[i]->drop();
}
if (DepthStencil)
DepthStencil->drop();
}
virtual void setTexture(const core::array<ITexture*>& textures, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) _IRR_OVERRIDE_
{
bool needSizeUpdate = false;
// Set color attachments.
if ((Texture != textures) || (CubeSurfaces != cubeSurfaces))
if (!Textures.equals(textures, numTextures) || !CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))
{
needSizeUpdate = true;
core::array<ITexture*> prevTextures(Texture);
core::array<ITexture*> prevTextures(Textures);
if (textures.size() > static_cast<u32>(ColorAttachment))
if (numTextures > static_cast<u32>(ColorAttachment))
{
core::stringc message = "This GPU supports up to ";
message += static_cast<u32>(ColorAttachment);
@ -78,9 +78,9 @@ public:
os::Printer::log(message.c_str(), ELL_WARNING);
}
Texture.set_used(core::min_(textures.size(), static_cast<u32>(ColorAttachment)));
Textures.set_used(core::min_(numTextures, static_cast<u32>(ColorAttachment)));
for (u32 i = 0; i < Texture.size(); ++i)
for (u32 i = 0; i < Textures.size(); ++i)
{
TOpenGLTexture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(textures[i]) : 0;
@ -93,12 +93,12 @@ public:
if (textureID != 0)
{
Texture[i] = textures[i];
Texture[i]->grab();
Textures[i] = textures[i];
Textures[i]->grab();
}
else
{
Texture[i] = 0;
Textures[i] = 0;
}
}
@ -111,9 +111,9 @@ public:
RequestTextureUpdate = true;
}
if (CubeSurfaces != cubeSurfaces)
if (!CubeSurfaces.equals(cubeSurfaces, numCubeSurfaces))
{
CubeSurfaces = cubeSurfaces;
CubeSurfaces.set_data(cubeSurfaces, numCubeSurfaces);
RequestTextureUpdate = true;
}
@ -183,26 +183,26 @@ public:
{
// Set new color textures.
const u32 textureSize = core::min_(Texture.size(), AssignedTexture.size());
const u32 textureSize = core::min_(Textures.size(), AssignedTextures.size());
for (u32 i = 0; i < textureSize; ++i)
{
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Texture[i]);
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Textures[i]);
GLuint textureID = currentTexture ? currentTexture->getOpenGLTextureName() : 0;
if (textureID != 0)
{
AssignedTexture[i] = GL_COLOR_ATTACHMENT0 + i;
AssignedTextures[i] = GL_COLOR_ATTACHMENT0 + i;
GLenum textarget = currentTexture->getType() == ETT_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_POSITIVE_X + (int)CubeSurfaces[i];
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], textarget, textureID, 0);
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], textarget, textureID, 0);
#ifdef _DEBUG
Driver->testGLError(__LINE__);
#endif
}
else if (AssignedTexture[i] != GL_NONE)
else if (AssignedTextures[i] != GL_NONE)
{
AssignedTexture[i] = GL_NONE;
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);
AssignedTextures[i] = GL_NONE;
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
os::Printer::log("Error: Could not set render target.", ELL_ERROR);
}
@ -210,12 +210,12 @@ public:
// Reset other render target channels.
for (u32 i = textureSize; i < AssignedTexture.size(); ++i)
for (u32 i = textureSize; i < AssignedTextures.size(); ++i)
{
if (AssignedTexture[i] != GL_NONE)
if (AssignedTextures[i] != GL_NONE)
{
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);
AssignedTexture[i] = GL_NONE;
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
AssignedTextures[i] = GL_NONE;
}
}
@ -285,7 +285,7 @@ public:
if (ColorAttachment > 0 && BufferID != 0)
{
const u32 textureSize = Texture.size();
const u32 textureSize = Textures.size();
if (textureSize == 0)
Driver->irrGlDrawBuffer(GL_NONE);
@ -293,9 +293,9 @@ public:
Driver->irrGlDrawBuffer(GL_COLOR_ATTACHMENT0);
else
{
const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTexture.size()));
const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTextures.size()));
Driver->irrGlDrawBuffers(bufferCount, AssignedTexture.pointer());
Driver->irrGlDrawBuffers(bufferCount, AssignedTextures.pointer());
}
#ifdef _DEBUG
@ -322,10 +322,10 @@ public:
ITexture* getTexture() const
{
for (u32 i = 0; i < Texture.size(); ++i)
for (u32 i = 0; i < Textures.size(); ++i)
{
if (Texture[i])
return Texture[i];
if (Textures[i])
return Textures[i];
}
return 0;
@ -372,7 +372,7 @@ protected:
return false;
}
core::array<GLenum> AssignedTexture;
core::array<GLenum> AssignedTextures;
bool AssignedDepth;
bool AssignedStencil;

@ -22,7 +22,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0), MaxIndices(65535),
MaxTextureSize(1), MaxGeometryVerticesOut(0),
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0),
OcclusionQuerySupport(false)
OcclusionQuerySupport(false), IsAtiRadeonX(false)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
,pGlActiveTexture(0)
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
@ -387,6 +387,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
TextureCompressionExtension = FeatureAvailable[IRR_ARB_texture_compression];
StencilBuffer=stencilBuffer;
const char* renderer = (const char*)glGetString(GL_RENDERER);
if ( renderer )
{
IsAtiRadeonX = (strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0);
}
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
#ifdef _IRR_WINDOWS_API_
#define IRR_OGL_LOAD_EXTENSION(x) wglGetProcAddress(reinterpret_cast<const char*>(x))
@ -827,7 +833,7 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
case EVDF_MIP_MAP:
return true;
case EVDF_MIP_MAP_AUTO_UPDATE:
return FeatureAvailable[IRR_SGIS_generate_mipmap] || FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object];
return !IsAtiRadeonX && (FeatureAvailable[IRR_SGIS_generate_mipmap] || FeatureAvailable[IRR_EXT_framebuffer_object] || FeatureAvailable[IRR_ARB_framebuffer_object]);
case EVDF_STENCIL_BUFFER:
return StencilBuffer;
case EVDF_VERTEX_SHADER_1_1:

@ -1052,6 +1052,9 @@ class COpenGLExtensionHandler
bool OcclusionQuerySupport;
// Info needed for workarounds.
bool IsAtiRadeonX;
//! Workaround until direct state access with framebuffers is stable enough in drivers
// https://devtalk.nvidia.com/default/topic/1030494/opengl/bug-amp-amp-spec-violation-checknamedframebufferstatus-returns-gl_framebuffer_incomplete_dimensions_ext-under-gl-4-5-core/
// https://stackoverflow.com/questions/51304706/problems-with-attaching-textures-of-different-sizes-to-fbo

@ -1872,10 +1872,10 @@ ISceneNodeAnimatorCollisionResponse* CSceneManager::createCollisionResponseAnima
//! Creates a follow spline animator.
ISceneNodeAnimator* CSceneManager::createFollowSplineAnimator(s32 startTime,
const core::array< core::vector3df >& points,
f32 speed, f32 tightness, bool loop, bool pingpong)
f32 speed, f32 tightness, bool loop, bool pingpong, bool steer)
{
ISceneNodeAnimator* a = new CSceneNodeAnimatorFollowSpline(startTime, points,
speed, tightness, loop, pingpong);
speed, tightness, loop, pingpong, steer);
return a;
}

@ -341,7 +341,7 @@ namespace scene
//! Creates a follow spline animator.
virtual ISceneNodeAnimator* createFollowSplineAnimator(s32 startTime,
const core::array< core::vector3df >& points,
f32 speed, f32 tightness, bool loop, bool pingpong) _IRR_OVERRIDE_;
f32 speed, f32 tightness, bool loop, bool pingpong, bool steer) _IRR_OVERRIDE_;
//! Creates a simple ITriangleSelector, based on a mesh.

@ -13,9 +13,9 @@ namespace scene
//! constructor
CSceneNodeAnimatorFollowSpline::CSceneNodeAnimatorFollowSpline(u32 time,
const core::array<core::vector3df>& points, f32 speed,
f32 tightness, bool loop, bool pingpong)
f32 tightness, bool loop, bool pingpong, bool steer)
: ISceneNodeAnimatorFinishing(0), Points(points), Speed(speed), Tightness(tightness)
, Loop(loop), PingPong(pingpong)
, Loop(loop), PingPong(pingpong), Steer(steer)
{
#ifdef _DEBUG
setDebugName("CSceneNodeAnimatorFollowSpline");
@ -86,7 +86,17 @@ void CSceneNodeAnimatorFollowSpline::animateNode(ISceneNode* node, u32 timeMs)
const core::vector3df t2 = ( p3 - p1 ) * Tightness;
// interpolated point
node->setPosition(p1 * h1 + p2 * h2 + t1 * h3 + t2 * h4);
const core::vector3df lastPos(node->getPosition());
const core::vector3df pos(p1 * h1 + p2 * h2 + t1 * h3 + t2 * h4);
node->setPosition(pos);
// steering (rotate in direction of movement)
if (Steer && !pos.equals(lastPos)) // equality check fixes glitches due to very high frame rates
{
const core::vector3df toTarget(pos - lastPos);
const core::vector3df requiredRotation = toTarget.getHorizontalAngle();
node->setRotation(requiredRotation);
}
}
@ -99,6 +109,7 @@ void CSceneNodeAnimatorFollowSpline::serializeAttributes(io::IAttributes* out, i
out->addFloat("Tightness", Tightness);
out->addBool("Loop", Loop);
out->addBool("PingPong", PingPong);
out->addBool("Steer", Steer);
u32 count = Points.size();
@ -124,10 +135,11 @@ void CSceneNodeAnimatorFollowSpline::deserializeAttributes(io::IAttributes* in,
{
ISceneNodeAnimatorFinishing::deserializeAttributes(in, options);
Speed = in->getAttributeAsFloat("Speed");
Tightness = in->getAttributeAsFloat("Tightness");
Loop = in->getAttributeAsBool("Loop");
PingPong = in->getAttributeAsBool("PingPong");
Speed = in->getAttributeAsFloat("Speed", Speed);
Tightness = in->getAttributeAsFloat("Tightness", Tightness);
Loop = in->getAttributeAsBool("Loop", Loop);
PingPong = in->getAttributeAsBool("PingPong", PingPong);
Steer = in->getAttributeAsBool("Steer", Steer);
Points.clear();
for(u32 i=1; true; ++i)

@ -22,7 +22,7 @@ namespace scene
//! constructor
CSceneNodeAnimatorFollowSpline(u32 startTime,
const core::array< core::vector3df >& points,
f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false);
f32 speed = 1.0f, f32 tightness = 0.5f, bool loop=true, bool pingpong=false, bool steer=false);
//! animates a scene node
virtual void animateNode(ISceneNode* node, u32 timeMs) _IRR_OVERRIDE_;
@ -52,6 +52,7 @@ namespace scene
f32 Tightness;
bool Loop;
bool PingPong;
bool Steer; // rotate depending on current movement
};

@ -173,7 +173,7 @@ static inline float powf_limit(const float a, const float b)
}
//! clamp(value,0,1)
static inline const float clampf01(const float v)
static inline float clampf01(const float v)
{
return v < 0.f ? 0.f : v > 1.f ? 1.f : v;
}
@ -748,9 +748,11 @@ bool CBurningVideoDriver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag
return true;
}
/*
static inline f32 map_value(f32 x, f32 in_min, f32 in_max, f32 out_min, f32 out_max) {
return (x - in_min) * (out_max - out_min) / (f32)(in_max - in_min) + out_min;
}
*/
//! sets a render target
void CBurningVideoDriver::setRenderTargetImage2(video::IImage* color, video::IImage* depth, video::IImage* stencil)
@ -2166,8 +2168,8 @@ void CBurningVideoDriver::drawVertexPrimitiveList(const void* vertices, u32 vert
{
// if primitive fully outside or outside on same side
continue;
vOut = 0;
vertex_from_clipper = 0;
//vOut = 0;
//vertex_from_clipper = 0;
}
else if (clipMask_o == VERTEX4D_INSIDE)
{

Some files were not shown because too many files have changed in this diff Show More