[2.1+] Fake area light rotating+scaling problem

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
rujialiu
Goblin
Posts: 296
Joined: Mon May 09, 2016 8:21 am
x 35

[2.1+] Fake area light rotating+scaling problem

Post by rujialiu »

Hi!

I'm using Fake area light and it's working fine. However, when the parent node is scaling, the light recsize is incorret:

Code: Select all

Vector2 Light::getDerivedRectSize(void) const
    {
        Vector3 parentScale = mParentNode->_getDerivedScale();
        return mRectSize * Vector2( parentScale.x, parentScale.y );
    }
I have a fake area light that is attached to node who is rotated to be parallel to XOZ plane (because by default the fake area light is parallel to XOY plane). Then the node is scaled on XOZ plane (e.g. setScale(2, 1, 2)). However, the pareltScale in the code above does not take rotation into account so mRectSize is scaled only along X-axis. Is there an easy way to solve this problem?

Thanks!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

Re: [2.1+] Fake area light rotating+scaling problem

Post by dark_sylinc »

Is there a quick code snippet to reproduce the transforms? It will be easier with a simple setup of nodes the way you are describing.
rujialiu
Goblin
Posts: 296
Joined: Mon May 09, 2016 8:21 am
x 35

Re: [2.1+] Fake area light rotating+scaling problem

Post by rujialiu »

dark_sylinc wrote: Mon Sep 10, 2018 9:58 pm Is there a quick code snippet to reproduce the transforms? It will be easier with a simple setup of nodes the way you are describing.
Not yet... we've avoided this problem by placing these lights directly under the root node :-S
Post Reply