Darragh Burke 5 лет назад
Родитель
Сommit
01d0e3faf8

+ 0 - 9
inspector/src/lod.fragment.fx

@@ -1,9 +0,0 @@
-// Samplers
-varying vec2 vUV;
-uniform sampler2D textureSampler;
-uniform float lod;
-
-void main(void) 
-{
-	gl_FragColor = textureLod(textureSampler, vUV, lod);
-}

+ 15 - 0
inspector/src/lod.ts

@@ -0,0 +1,15 @@
+import { Effect } from "babylonjs/Materials/effect";
+
+let name = 'lodPixelShader';
+let shader = `
+varying vec2 vUV;
+uniform sampler2D textureSampler;
+uniform float lod;
+void main(void)
+{
+gl_FragColor=textureLod(textureSampler,vUV,lod);
+}`;
+
+Effect.ShadersStore[name] = shader;
+/** @hidden */
+export var lodPixelShader = { name, shader };

+ 0 - 28
inspector/src/lodCube.fragment.fx

@@ -1,28 +0,0 @@
-// Samplers
-varying vec2 vUV;
-uniform samplerCube textureSampler;
-uniform float lod;
-
-void main(void) 
-{
-	vec2 uv = vUV * 2.0 - 1.0;
-
-#ifdef POSITIVEX
-	gl_FragColor = textureCube(textureSampler, vec3(1.001, uv.y, uv.x), lod);
-#endif
-#ifdef NEGATIVEX
-	gl_FragColor = textureCube(textureSampler, vec3(-1.001, uv.y, uv.x), lod);
-#endif
-#ifdef POSITIVEY
-	gl_FragColor = textureCube(textureSampler, vec3(uv.y, 1.001, uv.x), lod);
-#endif
-#ifdef NEGATIVEY
-	gl_FragColor = textureCube(textureSampler, vec3(uv.y, -1.001, uv.x), lod);
-#endif
-#ifdef POSITIVEZ
-	gl_FragColor = textureCube(textureSampler, vec3(uv, 1.001), lod);
-#endif
-#ifdef NEGATIVEZ
-	gl_FragColor = textureCube(textureSampler, vec3(uv, -1.001), lod);
-#endif
-}

+ 33 - 0
inspector/src/lodCube.ts

@@ -0,0 +1,33 @@
+import { Effect } from "babylonjs/Materials/effect";
+
+let name = 'lodCubePixelShader';
+let shader = `
+varying vec2 vUV;
+uniform samplerCube textureSampler;
+uniform float lod;
+void main(void)
+{
+vec2 uv=vUV*2.0-1.0;
+#ifdef POSITIVEX
+gl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x),lod);
+#endif
+#ifdef NEGATIVEX
+gl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x),lod);
+#endif
+#ifdef POSITIVEY
+gl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x),lod);
+#endif
+#ifdef NEGATIVEY
+gl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x),lod);
+#endif
+#ifdef POSITIVEZ
+gl_FragColor=textureCube(textureSampler,vec3(uv,1.001),lod);
+#endif
+#ifdef NEGATIVEZ
+gl_FragColor=textureCube(textureSampler,vec3(uv,-1.001),lod);
+#endif
+}`;
+
+Effect.ShadersStore[name] = shader;
+/** @hidden */
+export var lodCubePixelShader = { name, shader };

+ 2 - 2
inspector/src/textureHelper.ts

@@ -5,8 +5,8 @@ import { RenderTargetTexture } from 'babylonjs/Materials/Textures/renderTargetTe
 import { BaseTexture } from 'babylonjs/Materials/Textures/baseTexture';
 import { Nullable } from 'babylonjs/types';
 
-import "./lod.fragment";
-import "./lodCube.fragment";
+import "./lod";
+import "./lodCube";
 
 
 export interface TextureChannelsToDisplay {