Hello Carsten,

Thanks for the hint. I manage to correct that error.
But i am not sure if the design concept is efficient enough.

So i am attaching the snippet and hope that you can suggest
something better.

    /*
     the following switch is for
     toggling between different light sources
     attached only the spot light here
     the rest of them used the same
     procedure.
    */
    switch(k)
    {
        //for spot light selection
        case 's':
        {

                if(pLightNode->findChild(utahTransformNode) >= 0)
                {
                    /*
                    utah is attached to point light
                    so detach it first
                    */
                    cout << "Point Light is attached " << endl;

                    beginEditCP(pLightNode, Node::ChildrenFieldMask);
                        pLightNode->subChild(utahTransformNode);
                    endEditCP(pLightNode, Node::ChildrenFieldMask);
                }
                else if(dLightNode->findChild(utahTransformNode) >= 0)
                {
                    cout << "Direct Light is attached " << endl;


                    beginEditCP(dLightNode, Node::ChildrenFieldMask);
                        dLightNode->subChild(utahTransformNode);
                    endEditCP(dLightNode, Node::ChildrenFieldMask);

                }


                if(sLightNode->findChild(utahTransformNode) < 0)
                {
                    //light is not attached
                    //so attach it
                    cout << "attaching" << endl;
                    beginEditCP(sLightNode, Node::ChildrenFieldMask);
                        sLightNode->addChild(utahTransformNode);
                    endEditCP(sLightNode, Node::ChildrenFieldMask);

                }


                beginEditCP(dLight, DirectionalLight::OnFieldMask);
                    dLight->setOn(false);
                endEditCP(dLight, DirectionalLight::OnFieldMask);


                beginEditCP(pLight, PointLight::OnFieldMask);
                    pLight->setOn(false);
                endEditCP(pLight,PointLight::OnFieldMask);

                beginEditCP(sLight,SpotLight::OnFieldMask);
                    sLight->setOn(true);
                endEditCP(sLight, SpotLight::OnFieldMask);
        }
        break;



Regards

Sajjad
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to