mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 16:36:43 +00:00
Fix node mask being reset
This commit is contained in:
parent
c1fe9f2a89
commit
4c9bbce1e2
1 changed files with 6 additions and 4 deletions
|
@ -428,10 +428,12 @@ private:
|
||||||
class CelestialBody
|
class CelestialBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CelestialBody(osg::Group* parentNode, float scaleFactor, int numUvSets)
|
CelestialBody(osg::Group* parentNode, float scaleFactor, int numUvSets, unsigned int visibleMask=~0)
|
||||||
|
: mVisibleMask(visibleMask)
|
||||||
{
|
{
|
||||||
mGeom = createTexturedQuad(numUvSets);
|
mGeom = createTexturedQuad(numUvSets);
|
||||||
mTransform = new osg::PositionAttitudeTransform;
|
mTransform = new osg::PositionAttitudeTransform;
|
||||||
|
mTransform->setNodeMask(mVisibleMask);
|
||||||
mTransform->setScale(osg::Vec3f(450,450,450) * scaleFactor);
|
mTransform->setScale(osg::Vec3f(450,450,450) * scaleFactor);
|
||||||
mTransform->addChild(mGeom);
|
mTransform->addChild(mGeom);
|
||||||
|
|
||||||
|
@ -444,10 +446,11 @@ public:
|
||||||
|
|
||||||
void setVisible(bool visible)
|
void setVisible(bool visible)
|
||||||
{
|
{
|
||||||
mTransform->setNodeMask(visible ? ~0 : 0);
|
mTransform->setNodeMask(visible ? mVisibleMask : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
unsigned int mVisibleMask;
|
||||||
static const float mDistance;
|
static const float mDistance;
|
||||||
osg::ref_ptr<osg::PositionAttitudeTransform> mTransform;
|
osg::ref_ptr<osg::PositionAttitudeTransform> mTransform;
|
||||||
osg::ref_ptr<osg::Geometry> mGeom;
|
osg::ref_ptr<osg::Geometry> mGeom;
|
||||||
|
@ -459,11 +462,10 @@ class Sun : public CelestialBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sun(osg::Group* parentNode, Resource::ImageManager& imageManager)
|
Sun(osg::Group* parentNode, Resource::ImageManager& imageManager)
|
||||||
: CelestialBody(parentNode, 1.0f, 1)
|
: CelestialBody(parentNode, 1.0f, 1, Mask_Sun)
|
||||||
, mUpdater(new Updater)
|
, mUpdater(new Updater)
|
||||||
{
|
{
|
||||||
mTransform->addUpdateCallback(mUpdater);
|
mTransform->addUpdateCallback(mUpdater);
|
||||||
mTransform->setNodeMask(Mask_Sun);
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Texture2D> sunTex (new osg::Texture2D(imageManager.getImage("textures/tx_sun_05.dds")));
|
osg::ref_ptr<osg::Texture2D> sunTex (new osg::Texture2D(imageManager.getImage("textures/tx_sun_05.dds")));
|
||||||
sunTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
sunTex->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_EDGE);
|
||||||
|
|
Loading…
Reference in a new issue