Commit Graph

3352 Commits (db89bbc2cec7d3d2926367acf73158dea961a43e)

Author SHA1 Message Date
cutealien db89bbc2ce Fixing SViewFrustum::recalculateBoundingBox once more.
Sorry, missed some points in last fix.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5775 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-25 14:44:36 +00:00
cutealien ba391682b0 Update opengl test-file.
The test which uses it is currently disabled as it has more problems (broken stencil), but this part is fine and probably just changed due to recent opengl fixes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5774 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-23 17:48:00 +00:00
cutealien d1bddcc1a2 Fixing SViewFrustum::recalculateBoundingBox and CMatrix4::transformPlane.
SViewFrustum::recalculateBoundingBox no longer includes camera position in the bounding-box. Only using frustum corners now. Thx @DevSH for bugreport & patch.
CMatrix4::transformPlane was calculating the wrong plane-normal before. It added the matrix translation and also didn't normalize the normal.
planeMatrix tests had been checking for wrong results (did check calculations by hand now, so hopefully I got it right, anyone double-checking it for me would certainly be cool...)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5773 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-22 18:03:34 +00:00
cutealien 7ebd410e0a Camera uses now OGL projection matrices with OpenGL driver.
Fixes wrong near-plane values with OpenGL (showed too much before).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5772 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-21 18:20:33 +00:00
cutealien 0a2ee246c3 Fix error in calculation in new opengl versions of matrix4::buildProjectionMatrixPerspective functions.
Sorry, forgot some brackets around addition earlier on :-(

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5771 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-21 17:36:42 +00:00
cutealien a96b81dd4a Adapted orthoCam test to use OpenGL projection matrices with driver.
It fails, but it failed before (test is outcommented since a long time, will have to check why)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5770 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-21 17:16:57 +00:00
cutealien 45be145f9a Add a flag to buildProjectionMatrixPerspective functions to allow creating OpenGL style matrices.
Can now have target range of -w to w instead of only 0 to w.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5769 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-21 16:39:51 +00:00
cutealien 49b2e6fee1 buildProjectionMatrixOrthoLH and buildProjectionMatrixOrthoRH have a new parameter to allow creating OGL style matrices.
Old projection matrices always projected z from 0 to 1. For OpenGL we want a -1 to 1 target instead.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5768 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-21 15:42:43 +00:00
cutealien c310a8d6ae Bugfix: CCameraSceneNode resets the IsOrthogonal flag to false now when it recalculates a projection matrix.
Note: It would likely be nicer if it wouldn't switch back to a projection matrix at all but stay with ortho-matrix. But until I get to that - this will at least return the correct flag.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5767 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-21 14:37:03 +00:00
cutealien 3283b96087 Fix SViewFrustum::setFrom for OGL projection matrices.
SViewFrustum::setFrom now sets the correct near clipping plane when the projection matrix doesn't use a target depth range of 0 to z, but for example -z to z.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5766 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-20 18:55:37 +00:00
cutealien fc2e1bcfd7 Remove code to read boundingbox element in Collada reader as it's not in Collada specification.
We also did just read that box and then dropped the info immediately, so it wasn't used anyway. Not sure what that code was about, I hope it was just accidental and not about support for some strange Collada files in the wild.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5759 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-11 22:02:21 +00:00
cutealien abee25857f .dae/Collade reader now converts from Collada's right-handed to Irrlicht's left handed coordinate system.
It already worked correct when Z_UP was set (we switched x/z in that case which also flips coordinate system)
But for the default (Y_UP) it had been wrong before (that one is still right-handed in Collada).
We do now convert all z to -z (so z coordinates do change, but it prevents objects from showing up mirrored).
Note: For readLookAtNode I also added code to regard Z_UP, but have no test-case yet.
Note: I have no test-case for readSkewNode, so not sure about that one.
Note: No fix for readBboxNode as I'm going to kick that out next.
I tested with Blender (which has no textures) and Collada (which needs manual adaptions in .dae files as Irrlicht can't read libraries order independent, but that's another problem).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5758 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-11 21:54:31 +00:00
cutealien 93c597a72d Remove the #undef's for standard functions.
isdigit, isspace and isupper had #undef's before them. But our own replacement implementations are in a namespace, so there shouldn't be any conflicts. And if there are compile conflicts they should show that the wrong implementation is used, so we would want to see them.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5728 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-02 16:52:29 +00:00
cutealien b5c99752aa Fix compiling on MinGW/gcc.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5727 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-02 16:25:20 +00:00
cutealien 47cebab98f Add IColladaMeshWriter::setUnit to allow exporting a unit-to-meter-ratio and name.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5723 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-02-01 15:52:29 +00:00
cutealien 6ef7f7c07f Collada writer no longer writes out trailing zeros in (most) float numbers.
Writing might be slightly slower, but has to write less on disk on the other hand. 
So loading the files later on will be faster.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5721 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-31 19:59:26 +00:00
cutealien 9f7be6e42d Fix compile warning.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5720 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-31 19:40:58 +00:00
cutealien 9a04806c45 Add irr::string::eraseTrailingFloatZeros to kick out trailing 0's for strings generated from floats.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5719 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-31 19:02:14 +00:00
cutealien ff54728feb Add some tests for string::findLastCharNotInList.
All worked out, was just checking ;-)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5718 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-31 18:08:34 +00:00
cutealien c504e7d598 Fix conversion to right-handed matrix in Collada writer.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5711 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-30 15:47:30 +00:00
cutealien 39bf558a78 Fix .dae/Collada writer to export a right-handed coordinate system as expected by Collada.
Note: Right now our Collada loader can no longer load the files we write correctly as it also has to be fixed.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5709 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-30 15:16:36 +00:00
cutealien 680d8f285d Simplify code in collada mesh writer.
(just making it easier to read to prepare for some other changes).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5703 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-29 16:34:52 +00:00
cutealien 8a5b18ac23 Spelling fix.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5701 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-29 15:35:08 +00:00
cutealien 17503ad305 Collada writer no longer handles first and second texture uv's different.
(first one is probably correct once we fix the rest of coordinates to a right-handed system)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5700 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-29 14:55:58 +00:00
cutealien 62aed60aa0 Reduce code in Collada writer by replacing some case-switches for types by casts.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5699 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-29 14:40:17 +00:00
cutealien 43f75cbd9f Add function IColladaMeshWriter::SetParamNamesUV.
A workaround for broken Collada importers which insist on specific names. 
Seems SketchUp insists on UV's being called "S" "T" or it won't show textures.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5695 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-28 16:05:39 +00:00
cutealien e4d2156531 Fix compile warnings caused by collada writer change to c8.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5694 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-26 10:41:23 +00:00
cutealien 2f127c2773 Switch Collada writer to utf8 xml's.
Reasons are that it's more typical to use utf8 for xml's and that it allows SketchUp (which doesn't support xml's with wide-chars) can import our Colladas now.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5693 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-25 20:57:39 +00:00
cutealien 391dd912bd Add IXMLWriterUTF8 to allow writing utf8/ansi XML's.
utf8 is usually the default for XML anyway.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5692 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-25 19:35:53 +00:00
cutealien f6da59daf3 IColladaMeshWriter::writeScene got an additional flag to decide if root should be written.
Default stays as it was - a roots is written when it's not the SceneManager root.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5691 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-24 15:39:45 +00:00
cutealien eb14f13b53 Fix compilation on OSX and prevent capturing mouse cursor when Window is not on top.
This is Patch#319 from Artem Shoobovych (https://sourceforge.net/p/irrlicht/patches/319/)
Untested on my side due to lack of testing system.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5689 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-23 12:42:10 +00:00
cutealien b93be7c49c Add some readme.txt's to folders which would otherwise be empty in source-control-systems.
Just making life a little easier for the hg & git crowd.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5688 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-18 15:17:34 +00:00
cutealien 957d34ff0e Switch Irrlicht to 8 textures per Material as default by increasing value of _IRR_MATERIAL_MAX_TEXTURES_.
Reason is that 4 haven't been enough anymore for even pretty common graphic pipelines for a while now. 
8 might still not be enough, but let's see first if people are happy with it.

This has some costs for people not needing more textures, as we have fatter Materials now. 
- Memory usage increases by 64 bytes per SMaterial.
- Serialization files for the irr-format are now larger. 
- Slight speed cost, thought mainly in debug

For people who don't need this and want to avoid some of the costs there is a new variable irr::video::MATERIAL_MAX_TEXTURES_USED which can be set to the maximal number of textures a project will need
before creating any device. This avoids pretty much all speed-costs involved with this change.

Software drivers are not much affected as they use their own texture-limits (2).

I did a few speed-comparison with varying numbers of _IRR_MATERIAL_MAX_TEXTURES_. The numbers displayed are FPS, so higher is better. I had 2 tests - one which forced many material changes and the other used a single material for all nodes. When there are 2 numbers in a result then I got different (generally lower) FPS when forcing material changes. The test used a simple model with 500 polygons and rendered it 4500 times.
OLD means - before working on all changes related to increasing texture-numbers and without changing materials (found a bunch of places to decrease the impact of this change which also sometimes did speed up Irrlicht generally). 1.8 refers to Irrlicht 1.8 with same test. All tests done on Windows/VisualStudio.

Max.textures    4       8       16      64      64 MATERIAL_MAX_TEXTURES_USED=4
GL/debug        50/68   44/58   35/45
GL/release      117     117     117     80/100  117	
D3D9/debug	51/56	45/49	37/39				
D3D9/release    168     168     152/168 90/87   168
OLD GL/debug    63
OLD GL/release  117
OLD D3D9/debug  44
OLD D3D9/rel    168
1.8 GL/debug    23/29
1.8 GL/release  94/117
1.8 D3D9/debug  59/63
1.8 D3D9/rel    142/152

Take all results with a grain of salt, it probably often is limited by fill-rate and doesn't even notice the texture-number changes (especially in release). 

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5682 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-17 15:34:57 +00:00
cutealien 60b295bcdb Can't avoid writing empty textures or SMaterial.
I changed that while fixing SMaterial serialization, but bad optimization. Editors needs the info even when it's empty or it can't offer options to user.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5681 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-17 14:32:03 +00:00
cutealien 6bf700d408 Remove compile warnings.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5680 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-17 14:24:11 +00:00
cutealien abd0fa9dec Fix several problems with SMaterial serialization.
SMaterial.ZWriteFineControl only using 1 bit now.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5679 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-17 14:19:18 +00:00
cutealien f34b03f4bd Add MATERIAL_MAX_TEXTURES_USED to allow setting a limit of used textures in materials.
CD3D9Driver::setTransform limits no longer to MATERIAL_MAX_TEXTURES, but to MaxTextureUnits.
COpenGLCoreFeature::TextureUnit renamed to COpenGLCoreFeature::MaxTextureUnits (same as Direc3D names it and slightly better description)
Limiting used texture numbers with MATERIAL_MAX_TEXTURES_USED is currently not making a big speed difference. But it has a more noticable effect when we increase _IRR_MATERIAL_MAX_TEXTURES_ soon. It allows software which doesn't need more textures to mostly keep old speed.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5678 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-16 21:18:43 +00:00
cutealien a70e6ce6e7 Create pdb file also in release.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5677 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-16 21:01:27 +00:00
cutealien b737b425ba Checking TextureMatrix pointer before de-allocating.
While possibly double-checking the pointer now (which would be slightly slower when it's non-0), it's generally increasing speed of SMaterialLayer as our allocator is still somewhat expensive when the pointer is 0 (which is generally the case). And the cost would increase further when we raise max texture numbers soon.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5676 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-16 20:53:37 +00:00
cutealien 91247910b8 No longer overwrite memory when compiling with _IRR_MATERIAL_MAX_TEXTURES_ set to a value > 8
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5675 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-16 18:22:04 +00:00
cutealien f16f173fcb setMaterial no longer changes texture-matrices in GL and D3D9 when no texture-pointer is set.
This increases speed slightly (mainly in debug and more so when we increase max-texture-limit soon).
Texture-matrices are only used together with textures in the fixed function pipeline and for shaders the users
have to to pass them anyway on their own.
So the main difference now is that after setMaterial calls with empty texture pointers we no longer get 
a changed texture matrix which can be checked with IVideoDriver::getTransform.
I suppose the main reason where we might want to still access that matrix without a textures is when it's abused to pass values for other stuff in shaders (which is still possible). 

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5674 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-11 18:26:04 +00:00
cutealien 07e458c643 OpenGL driver no longer changes active texture as often when it doesn't have to do anything with the texture.
Minor speed improvement, which also will make it less costly to increase max-textures in future.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5673 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-11 16:49:24 +00:00
cutealien c7a766c290 Get rid of compile warnings in CAnimatedMeshHalfLife.cpp
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5672 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-01-02 11:44:43 +00:00
cutealien 7f60d679cc Remove .aps file from source control.
It's a binary representation of the resource file which shouldn't be checked-in as VS can rebuild it.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5671 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-12-22 23:17:34 +00:00
cutealien 2c7871d2f4 Fix memory leak in OpenGL for automatic generated rendertarget depthbuffer textures.
Didn't release old one when switching between between rt's with different sizes.
Also some refactoring to make code easier to read.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5670 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-12-04 16:01:12 +00:00
cutealien f4cce65ab1 Reset blend and alphatest states in GL and GLSL shader materials.
Those resets got removed in the materialrenderer rewrite in r4979, so sometimes we got wrong states now (stuck to blend or alphatest enabled when switching back to other materials). At least that was the case for alphatest, not so certain about blend which is also set in COpenGLDriver::setBasicRenderStates. That one is likely enabled/disabled more than once right now when setting up some materials (shader materials which have a transparent base material but SMaterial.BlendOperation != EBO_NONE). So better state-handling there could likely allow some speed optimization in the future.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5669 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-12-04 13:46:09 +00:00
cutealien b3e9af5722 Add IMaterialRenderer::getShaderConstantSetCallBack to allow access to user provided shader callbacks.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5668 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-12-01 15:55:32 +00:00
cutealien 386cbffe9a No longer set world transform twice in CMeshSceneNode.
I suspect that was just some copy-paste error (some other nodes need this).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5667 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-12-01 15:01:03 +00:00
cutealien 8f2eb13099 Allow to create images with floating point formats.
While IGUIImage doesn't support those well yet, it at least allocates memory and that turns out to be useful sometimes. For example we can now lock() floating point textures and access the data on OpenGL, which wasn't possible before. If this turns out to cause any problems (shouldn't really) we can handle them case-by-case.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5666 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-11-29 16:04:39 +00:00
cutealien b584c39295 ITexture::lock interface changed.
- mipmapLevel is now the second parameter as it was in Irrlicht 1.8 (but currently not doing anything)
- layer moved to third parameter
- New parameter lockFlags which allows to disabled flipping the texture upside down for RTT's on OpenGL.
Sorry for any inconvenience this change causes, but as I had to break the interface now anyway I decided to make it backward compatible to Irrlicht 1.8. Anyone already using the new "layers" feature in trunk will have to move the layer parameter now. But the last interface change which replaced the mipmaplevel with another variable with very different meaning wasn't a solution.
Mipmap support can also likely be re-introduced. At least I still haven't seen a real reason why it shouldn't be possible to have that anymore.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5663 dfc29bdd-3216-0410-991c-e03cc46cb475
2018-11-22 19:13:59 +00:00