浏览代码

Changed hardcoded uv scale to uniform in lava shader example.

alteredq 14 年之前
父节点
当前提交
55a3d8290d
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      examples/webgl_shader_lava.html

+ 3 - 1
examples/webgl_shader_lava.html

@@ -90,12 +90,13 @@
 
 		<script id="vertexShader" type="x-shader/x-vertex">
 
+			uniform vec2 uvScale;
 			varying vec2 vUv;
 
 			void main()
 			{
 
-				vUv = vec2( 3.0, 1.0 ) * uv;
+				vUv = uvScale * uv;
 				vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
 				gl_Position = projectionMatrix * mvPosition;
 
@@ -143,6 +144,7 @@
 					fogColor: 	{ type: "v3", value: new THREE.Vector3( 0, 0, 0 ) },
 					time: 		{ type: "f", value: 1.0 },
 					resolution: { type: "v2", value: new THREE.Vector2() },
+					uvScale: 	{ type: "v2", value: new THREE.Vector2( 3.0, 1.0 ) },
 					texture1: 	{ type: "t", value: 0, texture: ImageUtils.loadTexture( "textures/lava/cloud.png" ) },
 					texture2: 	{ type: "t", value: 1, texture: ImageUtils.loadTexture( "textures/lava/lavatile.jpg" ) }