- 전체
- HTML
- Web Design (웹디자인)
- XE 응용 개발
- wordpress plugin dev
- Javascript & JavaScript Application
- MEAN Stack : full stack javascript
- angular js & ionic framework
- bootstrap
- WebGL, Three.js and Babylon.js
- restful api design
- mobile web
- node.js 응용
- Cloud Service 응용
- 웹 어셈블리 개발 [WASM, WebAssembly]
- 마이크로서비스, MSA (microservice architecture)
- WebGL / WebGPU
- next.js 개발
- micro frontend (마이크로프론트앤드)
- 전자상거래/쇼핑몰
- 서버 클라우드 (aws, azure, google)
WebGL, Three.js and Babylon.js Uniforms types
2017.08.10 21:38
Uniforms types
Mr.doob edited this page on 23 Aug 2014 · 12 revisions
These mappings are also available since r68:
switch ( type ) {
case '1i':
_gl.uniform1i( location, value );
break;
case '1f':
_gl.uniform1f( location, value );
break;
case '2f':
_gl.uniform2f( location, value[ 0 ], value[ 1 ] );
break;
case '3f':
_gl.uniform3f( location, value[ 0 ], value[ 1 ], value[ 2 ] );
break;
case '4f':
_gl.uniform4f( location, value[ 0 ], value[ 1 ], value[ 2 ], value[ 3 ] );
break;
case '1iv':
_gl.uniform1iv( location, value );
break;
case '3iv':
_gl.uniform3iv( location, value );
break;
case '1fv':
_gl.uniform1fv( location, value );
break;
case '2fv':
_gl.uniform2fv( location, value );
break;
case '3fv':
_gl.uniform3fv( location, value );
break;
case '4fv':
_gl.uniform4fv( location, value );
break;
case 'Matrix3fv':
_gl.uniformMatrix3fv( location, false, value );
break;
case 'Matrix4fv':
_gl.uniformMatrix4fv( location, false, value );
break;
}
These still work:
var uniformsExample = {
"uInt" : { type: "i", value: 1 }, // single integer
"uFloat" : { type: "f", value: 3.14 }, // single float
"uVec2" : { type: "v2", value: new THREE.Vector2( 0, 1 ) }, // single Vector2
"uVec3" : { type: "v3", value: new THREE.Vector3( 0, 1, 2 ) }, // single Vector3
"uVec4" : { type: "v4", value: new THREE.Vector4( 0, 1, 2, 3 ) }, // single Vector4
"uCol" : { type: "c", value: new THREE.Color( 0xffaa00 ) }, // single Color
"uMat4" : { type: "m4", value: new THREE.Matrix4() }, // single Matrix4
/*
// till r50
"uTex" : { type: "t", value: 0, texture: THREE.ImageUtils.loadTexture( "texture.jpg" ) }, // regular texture
"uTexCube" : { type: "t", value: 1, texture: THREE.ImageUtils.loadTextureCube( [ "px.jpg", "nx.jpg", // cube texture
"py.jpg", "ny.jpg",
"pz.jpg", "nz.jpg" ] ) },
*/
// since r51
"uTex" : { type: "t", value: THREE.ImageUtils.loadTexture( "texture.jpg" ) }, // regular texture
"uTexCube" : { type: "t", value: THREE.ImageUtils.loadTextureCube( [ "px.jpg", "nx.jpg", // cube texture
"py.jpg", "ny.jpg",
"pz.jpg", "nz.jpg" ] ) },
"uIntArray" : { type: "iv1", value: [ 1, 2, 3, 4, 5 ] }, // integer array (plain)
"uIntArray3" : { type: "iv", value: [ 1, 2, 3, 4, 5, 6 ] }, // integer array (ivec3)
"uFloatArray" : { type: "fv1", value: [ 0.1, 0.2, 0.3, 0.4, 0.5 ] }, // float array (plain)
"uFloatArray3" : { type: "fv", value: [ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 ] }, // float array (vec3)
"uVec2Array" : { type: "v2v", value: [ new THREE.Vector2( 0.1, 0.2 ),
new THREE.Vector2( 0.4, 0.5 ) ] }, // Vector2 array
"uVec3Array" : { type: "v3v", value: [ new THREE.Vector3( 0.1, 0.2, 0.3 ),
new THREE.Vector3( 0.4, 0.5, 0.6 ) ] }, // Vector3 array
"uVec4Array" : { type: "v4v", value: [ new THREE.Vector4( 0.1, 0.2, 0.3, 0.4 ),
new THREE.Vector4( 0.4, 0.5, 0.6, 0.7 ) ] }, // Vector4 array
"uMat4Array" : { type: "m4v", value: [ new THREE.Matrix4(), new THREE.Matrix4() ] }, // Matrix4 array
"uTexArray" : { type: "tv", value: [ new THREE.Texture(), new THREE.Texture() ] } // texture array (regular)
// texture units start from value
};
Shader (GLSL)
uniform int uInt; uniform float uFloat; uniform vec2 uVec2; uniform vec3 uVec3; uniform vec4 uVec4; uniform vec3 uCol; uniform mat4 uMat4; uniform sampler2D uTex; uniform samplerCube uTexCube; uniform int uIntArray[ 5 ]; uniform ivec3 uIntArray3[ 2 ]; uniform float uFloatArray[ 5 ]; uniform vec3 uFloatArray3[ 2 ]; uniform vec2 uVec2Array[ 2 ]; uniform vec3 uVec3Array[ 2 ]; uniform vec4 uVec4Array[ 2 ]; uniform mat4 uMat4Array[ 2 ]; uniform sampler2D uTexArray[ 2 ];
[출처] https://github.com/mrdoob/three.js/wiki/Uniforms-types
본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 7 | Embedding Shiny Graphics into a WordPress Post | 졸리운_곰 | 2018.11.18 | 525 |
| 6 | 간단한 워드프레스 숏코드 만드는 방법 총정리 | 졸리운_곰 | 2018.09.01 | 718 |
| 5 |
워드프레스 숏코드: 완벽 가이드
| 졸리운_곰 | 2018.09.01 | 584 |
| 4 |
워드프레스 플러그인 만들기
| 졸리운_곰 | 2018.04.29 | 674 |
| 3 |
WP (워드프레스) 플러그인 만들기
| 졸리운_곰 | 2018.02.25 | 806 |
| 2 |
워드프레스 초보자를 위한 플러그인 만들기
| 졸리운_곰 | 2016.11.20 | 516 |
| 1 | 워드프레스 플러그인 개발 | 졸리운_곰 | 2016.11.20 | 794 |

