• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

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

Révisionc15a3088a2d548f8c178f407a1afe2ab834627fb (tree)
l'heure2013-05-04 03:15:07
Auteurremy.bouquet@gmail.com <remy.bouquet@gmai...>
Commiterremy.bouquet@gmail.com

Message de Log

AlphaDiscardTreshold is now supported by the Unshaded material.

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

Change Summary

Modification

--- a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.frag
+++ b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.frag
@@ -2,6 +2,10 @@
22 #define NEED_TEXCOORD1
33 #endif
44
5+#if defined(DISCARD_ALPHA)
6+ uniform float m_AlphaDiscardThreshold;
7+#endif
8+
59 uniform vec4 m_Color;
610 uniform sampler2D m_ColorMap;
711 uniform sampler2D m_LightMap;
@@ -15,7 +19,7 @@ void main(){
1519 vec4 color = vec4(1.0);
1620
1721 #ifdef HAS_COLORMAP
18- color *= texture2D(m_ColorMap, texCoord1);
22+ color *= texture2D(m_ColorMap, texCoord1);
1923 #endif
2024
2125 #ifdef HAS_VERTEXCOLOR
@@ -34,5 +38,11 @@ void main(){
3438 #endif
3539 #endif
3640
41+ #if defined(DISCARD_ALPHA)
42+ if(color.a < m_AlphaDiscardThreshold){
43+ discard;
44+ }
45+ #endif
46+
3747 gl_FragColor = color;
3848 }
\ No newline at end of file
--- a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
+++ b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
@@ -16,6 +16,9 @@ MaterialDef Unshaded {
1616 Int NumberOfBones
1717 Matrix4Array BoneMatrices
1818
19+ // Apha threshold for fragment discarding
20+ Float AlphaDiscardThreshold (AlphaTestFallOff)
21+
1922 //Shadows
2023 Int FilterMode
2124 Boolean HardwareShadows
@@ -61,6 +64,7 @@ MaterialDef Unshaded {
6164 HAS_VERTEXCOLOR : VertexColor
6265 HAS_COLOR : Color
6366 NUM_BONES : NumberOfBones
67+ DISCARD_ALPHA : AlphaDiscardThreshold
6468 }
6569 }
6670