From 744e09c14123fbe80d78e8090d0f55e98af9bef4 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Sun, 28 Sep 2014 11:03:18 +0800 Subject: [PATCH] reset change to getDirectionInWorld --- cocos/3d/CCLight3D.cpp | 8 ++++---- cocos/3d/CCLight3D.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos/3d/CCLight3D.cpp b/cocos/3d/CCLight3D.cpp index ac77b3a50e..beb6e38cd1 100644 --- a/cocos/3d/CCLight3D.cpp +++ b/cocos/3d/CCLight3D.cpp @@ -76,9 +76,9 @@ const Vec3& DirectionLight3D::getDirection() const dir.set(-mat.m[8], -mat.m[9], -mat.m[10]); return dir; } -Vec3 DirectionLight3D::getDirectionInWorld() const +const Vec3& DirectionLight3D::getDirectionInWorld() const { - Vec3 dir; + static Vec3 dir; Mat4 mat = getNodeToWorldTransform(); dir.set(-mat.m[8], -mat.m[9], -mat.m[10]); return dir; @@ -139,9 +139,9 @@ const Vec3& SpotLight3D::getDirection() const return dir; } -Vec3 SpotLight3D::getDirectionInWorld() const +const Vec3& SpotLight3D::getDirectionInWorld() const { - Vec3 dir; + static Vec3 dir; Mat4 mat = getNodeToWorldTransform(); dir.set(-mat.m[8], -mat.m[9], -mat.m[10]); return dir; diff --git a/cocos/3d/CCLight3D.h b/cocos/3d/CCLight3D.h index 717d17f2af..a964085798 100644 --- a/cocos/3d/CCLight3D.h +++ b/cocos/3d/CCLight3D.h @@ -126,7 +126,7 @@ public: /** * Returns direction in world. */ - Vec3 getDirectionInWorld() const; + const Vec3& getDirectionInWorld() const; CC_CONSTRUCTOR_ACCESS: DirectionLight3D(); @@ -196,7 +196,7 @@ public: /** * Returns direction in world. */ - Vec3 getDirectionInWorld() const; + const Vec3& getDirectionInWorld() const; /** * Sets the range of point or spot light.