• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

修訂6df71aae069fc6075e8eb78f97f7309f0de711a0 (tree)
時間2013-06-13 04:11:21
作者remy.bouquet@gmail.com <remy.bouquet@gmai...>
Commiterremy.bouquet@gmail.com

Log Message

SpotLigth: the cosine of the inner and outer angle of a spotlight are packed in the same float to send it to the shader (to save some varryings). This imples that their precision is no more than 0.001. This was producing wrong lighting for very close angles because the cosine were equals.
There is now a check that ensure that the outer cos is lower than the inner cos.

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10648 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Change Summary

差異

--- a/engine/src/core/com/jme3/light/SpotLight.java
+++ b/engine/src/core/com/jme3/light/SpotLight.java
@@ -71,7 +71,13 @@ public class SpotLight extends Light implements Savable {
7171 float innerCos=FastMath.cos(spotInnerAngle);
7272 float outerCos=FastMath.cos(spotOuterAngle);
7373 packedAngleCos=(int)(innerCos*1000);
74+ //due to approximations, very close angles can give the same cos
75+ //here we make sure outer cos is bellow inner cos.
76+ if(((int)packedAngleCos)== ((int)(outerCos*1000)) ){
77+ outerCos -= 0.001f;
78+ }
7479 packedAngleCos+=outerCos;
80+ System.out.println("anfle"+ packedAngleCos);
7581 }
7682
7783 @Override