Page 1 of 1

Source hacking

Posted: Sun Jun 27, 2004 5:59 am
by Guest
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

Posted: Sun Jun 27, 2004 7:38 am
by bal
Go and try, then send the working code to niko and he'll maybe add it to the next version :)

Posted: Sun Jun 27, 2004 7:47 am
by r2d2
look into the news niko is already working on an improved material system

Posted: Sun Jun 27, 2004 2:29 pm
by Guest
Yeah, I noticed that -- but on the dev page, the "Refactoring" task is at 0%, which is what I would think the new material system would be under. So I figure I'd take a stab at it.

-- John

Posted: Sun Jun 27, 2004 2:45 pm
by Tyn
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.

Posted: Sun Jun 27, 2004 2:57 pm
by Guest
Hmmmm, so I'm looking through the CVS on SF and I don't see any of the Irrlicht source in it. Is there a development branch I should be using somewhere, or should I just make changes to 0.6?

-- John

Posted: Sun Jun 27, 2004 3:00 pm
by Guest
Ah, nevermind. The FAQ says that there is no CVS. I'll work with 0.6. It sounds like Niko wants to develop this by himself until 1.0. Do you think it's likely he'd accept my patch?

-- John

Posted: Sun Jun 27, 2004 6:15 pm
by Hoff
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

Posted: Sun Jun 27, 2004 6:43 pm
by VeneX
Do ATI videocards support Cg shading?

Posted: Sun Jun 27, 2004 7:00 pm
by Hoff
They do -- it's actually kinda cool what NVidia did with Cg. You can compile Cg code to different GPU assembly types, including ARB types, which ATI supports.

-- John

Posted: Sun Jun 27, 2004 7:21 pm
by Tyn
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.

Posted: Sun Jun 27, 2004 8:00 pm
by Hoff
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

Posted: Tue Jun 29, 2004 12:55 pm
by Electron
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.

Posted: Tue Jun 29, 2004 9:06 pm
by Guest
Yeah, you're right. I'll post diffs (and comment more) in the future. I actually made more of an anouncement post in the Howto forum, as opposed to the 'maybe it would work' post in this forum, so I'll throw them there.

-- John