Source hacking
Source hacking
I was thinking about modifying the Irrlicht engine to support more than 2 texture layers and Cg vertex/fragment programs. What do people think about this?
-- John
-- John
look into the news niko is already working on an improved material system
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
If you really wanted to do something that people really want that isn't likely to be added in the next version then go for implementing the CG language and effects so that shaders can be used. That would be the most useful thing to be getting on with if you think you've got the knowldege, I know I haven't.
Okay, this is what I've got so far. Some feedback would be nice, so I know if I'm following the general style/code structure rules for Irrlicht before I do too much more.
Anyway, I added two source files: CCGProgram.cpp/h, and modified CVideoOpenGL, SMaterial.h, irrlicht.h and the Makefile. The only change to CVideoOpenGL was a little code in setRenderState3D (or something like that) to bind to the VertexShader. I added CGProgram * VertexShader and CGProgram FragmentShader to SMaterial. The makefile and irrlicht.h have the obvious stupid little changes needed when adding files to the project.
At the moment, my code only works for OpenGL, although it should be trivial to port it to DirectX (I'd do it right now, but I don't have a Windows box).
CCGProgram.cpp
CCGProgram.h
CVideoOpenGL.cpp
SMaterial.h
irrlicht.h
Makefile
-- John
Anyway, I added two source files: CCGProgram.cpp/h, and modified CVideoOpenGL, SMaterial.h, irrlicht.h and the Makefile. The only change to CVideoOpenGL was a little code in setRenderState3D (or something like that) to bind to the VertexShader. I added CGProgram * VertexShader and CGProgram FragmentShader to SMaterial. The makefile and irrlicht.h have the obvious stupid little changes needed when adding files to the project.
At the moment, my code only works for OpenGL, although it should be trivial to port it to DirectX (I'd do it right now, but I don't have a Windows box).
CCGProgram.cpp
CCGProgram.h
CVideoOpenGL.cpp
SMaterial.h
irrlicht.h
Makefile
-- John
Do ATI videocards support Cg shading?
Visit my website @ www.venex.be
Plethora project will be added to the site
AMD AthlonXP 2600+, 512MB DDR, Radeon M10 (mobile 9600) PRO 64MB, WinXP
Plethora project will be added to the site
AMD AthlonXP 2600+, 512MB DDR, Radeon M10 (mobile 9600) PRO 64MB, WinXP
Very nice, does it work? No time for a recompile here today, too busy with what I am doing Nice to see someone working on shaders, IMO that is one of the only reasons why OGRE would budge out Irrlicht ( apart from the odd bug or two ). I was more hoping than asking when I suggested working on shaders, never expected anyone to actually go out and do it, lol. I await with bated breath.
It does work, but it's not complete. There are a couple things that need to be added for it to be useful, like matrix tracking, but they're all a few lines of code. My main concern is that it fits into the infrastructure well. I think it does, but then again I've only looked at the few source files that I've worked with, so I really don't have any sense of what the Irrlicht architecture looks like on a larger scale.
-- John
-- John
One thing, if you're changing things in existing source files as well as adding new files, please document the changes instead of just replacing the file. This allows people to add the changes to future versions (if the changes don't get included in the official release) or to add the changes to files they themselves have already modified. I had this problem with an .md3 loader someone had made for 0.5. They replaced a bunch of files, and when I switched them into 0.6 it didn't compile right.