Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
I just commited to 1.8 the CgFx script loader as part of the Cg program manager plugin.
This loader loads files with the extension cgfx from the OGRE resource pool and creates ogre material and cg programs as according to what exists in the cgfx file.
The name of the material that is created is similar to the name of the cgfx file - so for a file named "glass.cgfx" it will be "glass.cgfx".
I tested this code with exporting some of the samples that come with "mental mill (R) Artist Edition" (you get it free with FX Composer 2.5).
Most of the hard code is written - the main feature that is missing are:
1. All sort of pass state translations - like alpha blend and such.
2. More standard documentation.
3. Error logging and exception handling.
I really worked hard on this feature; I guess about 7 full days.
I will be really happy if the community will share nice cgfx shaders by posting the shaders and textures (and possibly the relevant source code).
This code is my gift to the community for the Jewish holyday season.
I'm checking it out now. Welcome gift indeed. Can you explain a little bit about item #1? What needs to be done. I might be poking around at it this week.
@Praetor: I created most of what it needed to convert cgfx states to ogre states - there are switch case statements for everything – and also “getValueâ€
This is one of the best gift to community - thanks Assaf. I am downloading 1.7 just to test this out.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
Ok, I see what's going on. Lots to fill in. I'm not sure how some of those options will map to materials. But, might as well just get started filling in what can be filled in. I imagine the most common options will be trivial to link up and should give us pretty decent coverage.
I have a question, how are the lights mapped to ogre?
Because i have loaded the examples provided by MentalMill (I have just exported it to cgfx) but the examples that have a light, don't run well in ogre.
I have created a point light and nothing.
Paralax example of mental mill into ogre:
With a simple phong shader:
The phong shader
[EDIT by AssafRaman]I changed the long code quote to a file link - I don't allow such long code pastes in my threads, upload to google pages and give a link to such code[/EDIT]
Note: the ogrehead is where i have the point light
Last edited by Brocan on Wed Sep 24, 2008 2:59 pm, edited 2 times in total.
I've been looking at the mappings and implementing a few (without really testing these mappings yet...)
The lights I don't think can be mapped to Ogre in any way. Basically CgFx is stepping into the scene management arena with lights being bound to shaders.
In your parallax example, can you try manually creating an Ogre light in the scene? It's guaranteed that some options and settings in CgFx simply won't have natural mappings into Ogre.
Praetor wrote:The lights I don't think can be mapped to Ogre in any way. Basically CgFx is stepping into the scene management arena with lights being bound to shaders.
Yeah, i'm sure of that.
In my photos i have a ogre light point created where the ogrehead is.
Edit: Ah, ok Assaf, i thought that was a problem in my computer
Edit2: I don't remember googlepages to upload the code, sorry
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1472: error: expected ‘,’ or ‘...’ before ‘ogreProgramType’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1472: error: ISO C++ forbids declaration of ‘GpuProgramType’ with no type
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1473: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1474: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1477: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1478: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1479: error: ‘GpuProgramParametersSharedPtr’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1480: error: ‘GpuProgramParameters’ has not been declared
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1480: error: expected ‘,’ or ‘...’ before ‘&’ token
OgreCgFxScriptLoader.cpp:2784: error: prototype for ‘void Ogre::CgFxScriptLoader::parseCgProgram(_CGpass*, Ogre::Pass*, Ogre::GpuProgramType)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1472: error: candidate is: void Ogre::CgFxScriptLoader::parseCgProgram(_CGpass*, Ogre::Pass*, int)
OgreCgFxScriptLoader.cpp:2881: error: prototype for ‘void Ogre::CgFxScriptLoader::parseCgProgramParameters(_CGpass*, Ogre::GpuProgramParametersSharedPtr)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1473: error: candidate is: void Ogre::CgFxScriptLoader::parseCgProgramParameters(_CGpass*, int)
OgreCgFxScriptLoader.cpp:2927: error: prototype for ‘void Ogre::CgFxScriptLoader::parseCgProgramParameter(_CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1474: error: candidate is: void Ogre::CgFxScriptLoader::parseCgProgramParameter(_CGparameter*, int, const Ogre::String&)
OgreCgFxScriptLoader.cpp:3360: error: prototype for ‘const bool Ogre::CgFxScriptLoader::cgSemanticToOgreAutoConstantType(const char*, Ogre::GpuProgramParameters::AutoConstantType&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1480: error: candidate is: const bool Ogre::CgFxScriptLoader::cgSemanticToOgreAutoConstantType(const char*, int)
OgreCgFxScriptLoader.cpp:3576: error: prototype for ‘bool Ogre::CgFxScriptLoader::parseAutoConstantParam(_CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1479: error: candidate is: bool Ogre::CgFxScriptLoader::parseAutoConstantParam(_CGparameter*, int, const Ogre::String&)
OgreCgFxScriptLoader.cpp:3601: error: prototype for ‘void Ogre::CgFxScriptLoader::parseFloatCgProgramParameter(CGtype, _CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1477: error: candidate is: void Ogre::CgFxScriptLoader::parseFloatCgProgramParameter(CGtype, _CGparameter*, int, const Ogre::String&)
OgreCgFxScriptLoader.cpp:3677: error: prototype for ‘void Ogre::CgFxScriptLoader::parseIntCgProgramParameter(CGtype, _CGparameter*, Ogre::GpuProgramParametersSharedPtr, const Ogre::String&)’ does not match any in class ‘Ogre::CgFxScriptLoader’
../../../PlugIns/CgProgramManager/include/OgreCgFxScriptLoader.h:1478: error: candidate is: void Ogre::CgFxScriptLoader::parseIntCgProgramParameter(CGtype, _CGparameter*, int, const Ogre::String&)
Maybe someone can fix this, as I don't feel very home in that region of OGRE .
Last time I tried to compile ogre under cygwin g++, the linker segfaulted. After some manual hackery, I got it to link but there were subtle bugs that I was tied up with for days before realising it was the compiler's fault. I definitely don't recommend using cygwin's g++ for serious dev work.
Assaf Raman wrote:How can I compile and get this type of errors on windows?
I can't tell you, as I'm currently compiling the HEAD under linux only, maxbe the error doesn't even occure under windows. My recommendation would be to set up a VM with OpenSuSE (The distribution I'm enforced to use on the computer I compiled it on) and try it there. That's the most easy way to reproduce it I can think of (beside the download, but I guess, you're well connected).