puso1990
21-03-2012 16:29:50
Hi there!
Has anyone tried to port this glow shader to Mogre? http://www.ogre3d.org/tikiwiki/Glow&structure=Cookbook
I have tried it, and I get stuck at MaterialManager.Listener.
The original code from Ogre:
I have ported to Mogre this way:
... and I got stuck at HandleSchemeNotFound technique. I get error "U3DT.Engine.Engine_Objects.GlowMaterialListener' does not implement inherited abstract member 'Mogre.MaterialManager.Listener.HandleSchemeNotFound(ushort, string, Mogre.Material, ushort, Mogre.IRenderable)"
I have noticed, that in Mogre this technique is different. The MaterialManager.Listener is public abstract class and so the HandleSchemeNotFound is public abstract method. And in Ogre this technique is virtual. I have no idea, how this technique works, so I am desperate for help here. What do I have to do, to get this thing going.
Thanks for your help.
Cheers!
Has anyone tried to port this glow shader to Mogre? http://www.ogre3d.org/tikiwiki/Glow&structure=Cookbook
I have tried it, and I get stuck at MaterialManager.Listener.
The original code from Ogre:
#ifndef GLOWMATERIALLISTENER_H__
#define GLOWMATERIALLISTENER_H__
#include <Ogre.h>
#include <OgreMaterialManager.h>
class GlowMaterialListener : public Ogre::MaterialManager::Listener
{
protected:
Ogre::MaterialPtr mBlackMat;
public:
GlowMaterialListener()
{
mBlackMat = Ogre::MaterialManager::getSingleton().create("mGlowBlack", "Internal");
mBlackMat->getTechnique(0)->getPass(0)->setDiffuse(0,0,0,0);
mBlackMat->getTechnique(0)->getPass(0)->setSpecular(0,0,0,0);
mBlackMat->getTechnique(0)->getPass(0)->setAmbient(0,0,0);
mBlackMat->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,0);
}
Ogre::Technique *handleSchemeNotFound(unsigned short, const Ogre::String& schemeName, Ogre::Material*mat, unsigned short, const Ogre::Renderable*)
{
if (schemeName == "glow")
{
//LogManager::getSingleton().logMessage(">> adding glow to material: "+mat->getName());
return mBlackMat->getTechnique(0);
}
return NULL;
}
};
#endif //GLOWMATERIALLISTENER_H__I have ported to Mogre this way:
using System;
using Mogre;
namespace U3DT.Engine.Engine_Objects
{
class GlowMaterialListener : MaterialManager.Listener
{
protected Mogre.MaterialPtr mBlackMat;
public GlowMaterialListener()
{
mBlackMat = MaterialManager.Singleton.Create("mGlowBlack", "Internal");
mBlackMat.GetTechnique(0).GetPass(0).SetDiffuse(0,0,0,0);
mBlackMat.GetTechnique(0).GetPass(0).SetSpecular(0,0,0,0);
mBlackMat.GetTechnique(0).GetPass(0).SetAmbient(0,0,0);
mBlackMat.GetTechnique(0).GetPass(0).SetSelfIllumination(0,0,0);
}
Technique HandleSchemeNotFound(ushort schemeIndex, string schemeName, Material originalMaterial, ushort lod, Renderable rend)
{
if (schemeName == "glow")
{
//LogManager::getSingleton().logMessage(">> adding glow to material: "+mat->getName());
return mBlackMat.GetTechnique(0);
}
return null;
}
}
}
... and I got stuck at HandleSchemeNotFound technique. I get error "U3DT.Engine.Engine_Objects.GlowMaterialListener' does not implement inherited abstract member 'Mogre.MaterialManager.Listener.HandleSchemeNotFound(ushort, string, Mogre.Material, ushort, Mogre.IRenderable)"
I have noticed, that in Mogre this technique is different. The MaterialManager.Listener is public abstract class and so the HandleSchemeNotFound is public abstract method. And in Ogre this technique is virtual. I have no idea, how this technique works, so I am desperate for help here. What do I have to do, to get this thing going.
Thanks for your help.
Cheers!