Commit Graph

13 Commits

Author SHA1 Message Date
cutealien
16c960c5ed Add IShaderConstantSetCallBack::OnCreate to allow earlier access to IMaterialRendererServices
Accessing IMaterialRendererServices outside of OnSetConstants can be useful and Irrlicht made this a bit too hard to access.
Also OnCreate allows actually for nicer code where initialization and update of shader constants are strictly separated (see changed example).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6465 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-21 14:41:01 +00:00
cutealien
02165eccc8 CD3D9HLSLMaterialRenderer now implementing IMaterialRendererServices itself
Basically now the same as GLSL material renderer already worked.
Before it was using IMaterialRendererServices from CD3D9Driver, but there had been several problems with that:
- The d3d9 driver called functions through the CD3D9MaterialRenderer interface, but CD3D9HLSLMaterialRenderer is not (or maybe no longer?) derived from that class. Reason it still worked was accidental luck - the same functions had been in the same order and due to casts the compiler wasn't noticing it was calling the functions of an unrelated class.
- It was making calls to set shader constants depend on the currently set material in the driver. Which was not necessary and just prevents we can use the IMaterialRendererServices interface without setting the material first (how I found the bug).
Still some problems left for now:
- There's 2 ways to call shader constants. One seems to be only used by hi-level shaders which links constants to the shader. The the other only by low-level shaders which uses global (shader independent) registers.
So maybe this should be 2 interfaces? But not certain, glsl material renderer seems to prevent setting the global registers, but maybe those could be used additionally? I've still allowed it for now in HLSL, just in case it had it's uses.
- setBasicRenderStates probably should not be in IMaterialRendererServices. I'm not seeing any case where this isn't just passed on to the driver. And all classes using it have access to the driver unless I missed one. So probably can just avoid that additional indirection and kick that out of the IMaterialRendererServices interface.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6464 dfc29bdd-3216-0410-991c-e03cc46cb475
2023-04-21 14:04:57 +00:00
cutealien
7d2dbdd0c8 Unify & improve log messages
Lots of places where coders did not realize our Printer::log with hint adds a ": " string between message and hint
Which caused uglier messages in a few places (added documentation for that, maybe helps?)
Some added info in a few places
Some whitespace unification
Some spelling unification


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6414 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-06-30 16:23:48 +00:00
cutealien
f9e5ef76bd IVideoDriver::getOcclusionQueryResult works now with const node pointer.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6401 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-05-15 11:51:42 +00:00
cutealien
1dbab53e5a Prefer static_cast to reinterpret_cast where possible.
Just safer. Could probably do in a lot more places... another time.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6293 dfc29bdd-3216-0410-991c-e03cc46cb475
2022-01-08 18:22:20 +00:00
cutealien
ffd7b63af0 API BREAKER: Replacing defines in irrTypes.h which are conflicting with c++ reserved identifier rules.
C++ has undefined behavior for identifiers starting with __ or with _ followed by an uppercase letter.
We still have many more (in IrrCompileConfig.h and in all header-guards), will likely replace those later as well.
As a workaround for users which might use irrlicht defines in their code, I've added the header irrLegacyDefines.h
Including that allows to continue using old defines for a while - or make it easier to have code which compiles 
with old and new Irrlicht library versions.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6251 dfc29bdd-3216-0410-991c-e03cc46cb475
2021-08-27 12:55:10 +00:00
cutealien
224d7c5e2c Vertex texture sampling support in Direct3D 9 now controlled via texture-flag ETCF_SUPPORT_VERTEXT_TEXTURE
It's no longer enabled by default as it causes some costs to all texture switches.
Thanks @ edo9300 for reporting (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52721)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6219 dfc29bdd-3216-0410-991c-e03cc46cb475
2021-06-04 12:17:01 +00:00
cutealien
f31c1be792 Remove CD3D9Driver::getViewPort overload which did the exact same thing as base class.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6217 dfc29bdd-3216-0410-991c-e03cc46cb475
2021-05-31 13:36:25 +00:00
cutealien
7b1ee6468d Added 'uint' GLSL uniform support.
Thanks @devsh for the patch.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6073 dfc29bdd-3216-0410-991c-e03cc46cb475
2020-02-10 15:01:11 +00:00
cutealien
50f4bdecbe No longer try creating rtt's for compressed image formats
Those are not supported by any graphic card and we just end up with invalid textures.
Returning 0 now instead in addRenderTargetTexture for OpenGL and D3D9.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6047 dfc29bdd-3216-0410-991c-e03cc46cb475
2020-01-06 14:05:26 +00:00
cutealien
0b71328102 Use BlendFactor only when MaterialType != EMT_ONETEXTURE_BLEND
The way this was implemented BlendFactor and MaterialTypeParam could conflict otherwise as they both send the blend functions.

We could probably rewrite all places which use EMT_ONETEXTURE_BLEND+MaterialTypeParam to additionally check for BlendFactor, but it would still set the blend-functions twice. 
I'm not sure if BlendFactor works with 2D materials currently? (but we can't set those to shaders yet anyway except in the gles branch...).

I've also started documenting a few things about how I suppose it's working, I hope I got it all right.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6034 dfc29bdd-3216-0410-991c-e03cc46cb475
2020-01-03 14:58:46 +00:00
cutealien
473ab1ea58 Unify checks if materials should use transparent render pass with new IVideoDriver::needsTransparentRenderPass function.
Fix bug that AnimatedMeshSceneNode ignored ReadOnlyMaterials flag when checking materials for transparent render passes.
Make IVideoDriver::getMaterialRenderer const.
Fix bugs in COctreeSceneNode, CMeshSceneNode and CAnimatedMeshSceneNode where check for transparency in OnRegisterSceneNode() and in render() where no longer identical (those got added after Irrlicht 1.8).

Some notes for future:
- Maybe we should have a getRenderPass instead of just needsTransparentRenderPass, but this way the code didn't need so much changes and behaves (aside from fixes) pretty much as before.
- Still wondering if the default implementation in CNullDriver::needsTransparentRenderPass should always return false when SMaterial.ZWriteEnable is set to EZW_ON.
  This might be nicer with another material flag. Thought then we might want a material enum to choose the renderpass and that's more work.
  And we get some recursion as needsTransparentRenderPass might want to check result of getWriteZBuffer which calls needsTransparentRenderPass, so we might need a second function or an additional flag there.
  But return false when SMaterial.ZWriteEnable == EZW_ON could still be done as EZW_ON is a new flag so existing behavior shouldn't break. I just don't know right now if having an extra render pass for transparent nodes might still make sense even when zbuffer is not written or if that's really the only reason to do that. Any feedback anyone?



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6033 dfc29bdd-3216-0410-991c-e03cc46cb475
2020-01-03 11:13:57 +00:00
cutealien
8310a3fbad Avoid warning and make local variable lower-case.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6000 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-12-12 16:32:41 +00:00