Basically, the app is a giant POINT_LIST viewer Each point representing a star. My original material "StarTypes/StarBaseWhiteNoLightingShader" is BaseWhiteNoLighting with a little shader code added.
My 1.10 -> 2.1 code is roughly
Code: Select all
#if OGRE_VERSION_MAJOR == 1
sMagnitudeObjName = "StarObj";
m_pvStarsInMagnitude = OGRE_NEW Ogre::ManualObject(sMagnitudeObjName);
#else
m_pvStarsInMagnitude = OGRE_NEW Ogre::ManualObject(Id::generateNewId<Ogre::ManualObject>(), &sm->_getEntityMemoryManager(Ogre::SCENE_STATIC), sm);
#endif
// Material name used here, and for my Unlit Datablock...
sMaterialName = "...";
Ogre::MaterialPtr spOrigMaterial = Ogre::MaterialManager::getSingleton().getByName("StarTypes/StarBaseWhiteNoLightingShader");
Ogre::MaterialPtr spDerivedMateral = spOrigMaterial->clone(sMaterialName);
#if OGRE_VERSION_MAJOR >= 2
// Ogre::HlmsUnlit *hlmsUnlit = OGRE_NEW Ogre::HlmsUnlit(archiveUnlit, &library);
Ogre::HlmsUnlit* hlmsUnlit = reinterpret_cast<HlmsUnlit*>(Ogre::Root::getSingleton().getHlmsManager()->getHlms(Ogre::HlmsTypes::HLMS_UNLIT));
bool visibleToManager = true;
HlmsUnlitDatablock *datablock = reinterpret_cast<HlmsUnlitDatablock*>(
hlmsUnlit->createDatablock(sMaterialName, sMaterialName,
HlmsMacroblock(), HlmsBlendblock(),
HlmsParamVec(), visibleToManager ) );
#endif
m_pvStarsInMagnitude->begin(sMaterialName, Ogre::v1::RenderOperation::OT_POINT_LIST);
m_pvStarsInMagnitude->position(...) ; // x N where N is >1e5
m_pvStarsInMagnitude->end();
1) I now MUST specify Indices "pvStarsInMagnitude->index(n);" which I didn't need before (I just wanted the vertices to be handled as they were ordered). This is completely unnecessary (for me)!
2) If I understand my code correctly I am overwriting my low-level material's datablock with a vanilla Unlit shader, correct? What would be a better way of doing this? I don't really need my low-level materials, and am aiming to just use Hlms. (Or HLSL?)
3) If I don't create this Unlit datablock, m_pvStarsInMagnitude->end() throws...
EDIT: I suppose I should say that this approach "works" in the sense that I do get a visible star field, but my impression is that it is showing "Unlit" rather than my low-level material. So the question is: Can I easily combine an Hlms datablock material (that includes my own shader code) with obj->begin(), obj->position(), obj->end(), and possibly without having to specify indices "->index(0)"? I assume I don't actually need low-level materials à la 1.x.
Thanks!