BufferAttribute.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <!DOCTYPE html>
  2. <html lang="ko">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. 이 클래스에는 [page:BufferGeometry]와 연관된 속성 데이터(꼭짓점 위치, 면 순서, 법선, 색깔,
  13. UV, 모든 커스텀 속성들 등)를 저장하고 있으며, GPU에 보다 효율적으로 데이터를 전송할 수 있게 합니다.
  14. 세부사항 및 활용 예제를 확인해보세요.<br /><br />
  15. 데이터는 모든 길이가 벡터로 저장되며 ([page:BufferAttribute.itemSize itemSize]로 정의된 값),
  16. 일반적으로 인덱스 값으로 전달될 경우 메서드 내에서 밑줄이 쳐지며 자동으로 벡터 길이에 곱해집니다.
  17. When working with vector-like data, the <i>.fromBufferAttribute( attribute, index )</i>
  18. helper methods on [page:Vector2.fromBufferAttribute Vector2],
  19. [page:Vector3.fromBufferAttribute Vector3],
  20. [page:Vector4.fromBufferAttribute Vector4], and
  21. [page:Color.fromBufferAttribute Color] classes may be helpful.
  22. </p>
  23. <h2>생성자</h2>
  24. <h3>[name]( [param:TypedArray array], [param:Integer itemSize], [param:Boolean normalized] )</h3>
  25. <p>
  26. [page:TypedArray array] -- 반드시 [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/TypedArray TypedArray]여야 합니다.
  27. 버퍼를 시작하는데에 사용됩니다. <br />
  28. 배열에는
  29. <code>itemSize * numVertices</code>
  30. 엘레먼트가 있어야 하며, numVertices는 [page:BufferGeometry BufferGeometry]와 연관된 꼭짓점의 갯수입니다.<br /><br />
  31. [page:Integer itemSize] -- 특정 꼭짓점과 연관된 배열의 값의 수입니다.
  32. 예를 들어 이 속성에서 3개의 벡터(위치, 법선, 색 처럼)를 저장하고 있다면, itemSize는 3이 됩니다.
  33. <br /><br />
  34. [page:Boolean normalized] -- (생략가능) 정수 데이터에만 적용됩니다. 버퍼에 있는 기저 데이터가 GLSL 코드에서 값으로 맵핑되는 방식입니다.
  35. 예를 들어 [page:TypedArray array]가 UInt16Array의 인스턴스이고, [page:Boolean normalized]가 true면 배열에 있는 0 - +65535 값들은
  36. GLSL 속성에서 0.0f - +1.0f로 매핑될 것입니다. Int16Array (기호 있는)는 -32768 - +32767 가 -1.0f - +1.0f 로 매핑될 것입니다.
  37. [page:Boolean normalized]가 false라면, 값은 수정 없이 floats로 변환될 것입니다. 예) 32767은 32767.0f로 변환.
  38. </p>
  39. <h2>프로퍼티</h2>
  40. <h3>[property:TypedArray array]</h3>
  41. <p>
  42. 버퍼에 저장되어 있는 데이터를 담고 있는 [page:TypedArray array].
  43. </p>
  44. <h3>[property:Integer count]</h3>
  45. <p>
  46. [page:BufferAttribute.itemSize itemSize]로 나눈 [page:BufferAttribute.array array]의 길이를 저장. Read-only property.<br /><br />
  47. 버퍼가 3개의 컴포넌트를 저장한 벡터(위치, 법선, 색 등)
  48. 저장된 벡터들의 수를 계산합니다.
  49. </p>
  50. <h3>[property:Number gpuType]</h3>
  51. <p>
  52. Configures the bound GPU type for use in shaders. Either [page:BufferAttribute THREE.FloatType] or [page:BufferAttribute THREE.IntType], default is [page:BufferAttribute THREE.FloatType].
  53. Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision float types, see [page:BufferAttributeTypes THREE.Float16BufferAttribute].
  54. </p>
  55. <h3>[property:Boolean isBufferAttribute]</h3>
  56. <p>
  57. Read-only flag to check if a given object is of type [name].
  58. </p>
  59. <h3>[property:Integer itemSize]</h3>
  60. <p>[page:BufferAttribute.array array]에 저장되는 벡터의 길이.</p>
  61. <h3>[property:String name]</h3>
  62. <p>
  63. 이 속성 인스턴스의 임시 이름. 기본값은 빈 문자열입니다.
  64. </p>
  65. <h3>[property:Boolean needsUpdate]</h3>
  66. <p>
  67. 이 속성이 변했는지와 GPU에 다시 전송해야하는지에 대한 표시입니다.
  68. 배열의 값을 수정했다면 이 값을 true로 설정하세요.<br /><br />
  69. 이 값을 true로 설정하면 [page:BufferAttribute.version version] 값도 높입니다.
  70. </p>
  71. <h3>[property:Boolean normalized]</h3>
  72. <p>
  73. 버퍼에 있는 기저 데이터가 GLSL 코드에서 값으로 맵핑되는 방식입니다.
  74. 자세한 내용은 위의 생성자 부분을 참고하세요.
  75. </p>
  76. <h3>[property:Function onUploadCallback]</h3>
  77. <p>
  78. 렌더러가 속성 배열 데이터를 GPU에 전달한 후에 실행되는 함수입니다.
  79. </p>
  80. <h3>[property:Object updateRange]</h3>
  81. <p>포함 객체:<br />
  82. [page:Integer offset]: 기본값은 *0*입니다. 업데이트를 시작할 위치입니다.<br />
  83. [page:Integer count]: 기본값은 *-1*이고, 업데이트 번위를 사용하지 않는다는 의미입니다.<br /><br />
  84. 저장된 벡터의 몇몇 컴포넌트들을 업데이트 할 때만 사용됩니다 (예를 들면, 색과 관련된 컴포넌트만 업데이트할 때).
  85. </p>
  86. <h3>[property:Usage usage]</h3>
  87. <p>
  88. 최적화를 목적으로 특정 데이터 저장 패턴 사용을 정의합니다.
  89. [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bufferData WebGLRenderingContext.bufferData]()의 *usage* 파라미터에 대응됩니다.
  90. 기본값은 *THREE.StaticDrawUsage*입니다.
  91. </p>
  92. <h3>[property:Integer version]</h3>
  93. <p>버전값으로, [page:BufferAttribute.needsUpdate needsUpdate] 속성이 true로 설정될 때 증가합니다.</p>
  94. <h2>메서드</h2>
  95. <h3>[method:this applyMatrix3]( [param:Matrix3 m] )</h3>
  96. <p>현재 BufferAttribute의 모든 Vector3 엘레먼트에 matrix [page:Matrix3 m]를 적용합니다.</p>
  97. <h3>[method:this applyMatrix4]( [param:Matrix4 m] )</h3>
  98. <p>현재 BufferAttribute의 모든 Vector3 엘레먼트에 matrix [page:Matrix4 m]를 적용합니다.</p>
  99. <h3>[method:this applyNormalMatrix]( [param:Matrix3 m] )</h3>
  100. <p>현재 BufferAttribute의 모든 Vector3 엘레먼트에 일반 matrix [page:Matrix3 m]를 적용합니다.</p>
  101. <h3>[method:this transformDirection]( [param:Matrix4 m] )</h3>
  102. <p>현재 BufferAttribute의 모든 Vector3 엘레먼트에 matrix [page:Matrix4 m]를 적용하고, 엘레먼트를 방향 벡터로 이동합니다.</p>
  103. <h3>[method:BufferAttribute clone]() </h3>
  104. <p>bufferAttribute 사본을 리턴합니다.</p>
  105. <h3>[method:this copy]( [param:BufferAttribute bufferAttribute] )</h3>
  106. <p>현재의 BufferAttribute에 다른 BufferAttribute를 붙여 넣습니다.</p>
  107. <h3>[method:this copyArray]( array ) </h3>
  108. <p>[page:BufferAttribute.array array]에 해당 배열(일반 배열 혹은 TypedArray)을 복사합니다.<br /><br />
  109. TypedArray를 복사할 때의 조건에 대한 주의사항은 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]
  110. 를 참고해 주세요.
  111. </p>
  112. <h3>[method:this copyAt] ( [param:Integer index1], [param:BufferAttribute bufferAttribute], [param:Integer index2] ) </h3>
  113. <p>bufferAttribute[index2]의 벡터를 [page:BufferAttribute.array array][index1]에 복사합니다.</p>
  114. <h3>[method:Number getComponent]( [param:Integer index], [param:Integer component] ) </h3>
  115. <p>Returns the given component of the vector at the given index.</p>
  116. <h3>[method:Number getX]( [param:Integer index] ) </h3>
  117. <p>해당 index의 벡터의 x 컴포넌트 값을 리턴합니다.</p>
  118. <h3>[method:Number getY]( [param:Integer index] ) </h3>
  119. <p>해당 index의 벡터의 y 컴포넌트 값을 리턴합니다.</p>
  120. <h3>[method:Number getZ]( [param:Integer index] ) </h3>
  121. <p>해당 index의 벡터의 z 컴포넌트 값을 리턴합니다.</p>
  122. <h3>[method:Number getW]( [param:Integer index] ) </h3>
  123. <p>해당 index의 벡터의 w 컴포넌트 값을 리턴합니다.</p>
  124. <h3>[method:this onUpload]( [param:Function callback] ) </h3>
  125. <p>
  126. onUploadCallback 속성의 값을 설정합니다.<br /><br />
  127. 이 값은 [example:webgl_buffergeometry WebGL / Buffergeometry]에서 버퍼가 GPU로 전송된 후에 자유 메모리로 사용됩니다.
  128. </p>
  129. <h3>[method:this set] ( [param:Array value], [param:Integer offset] ) </h3>
  130. <p>
  131. value -- 복사할 [page:Array] 혹은 [page:TypedArray] 값입니다. <br />
  132. offset -- (생략가능) 복사를 시작할 [page:BufferAttribute.array array] 의 인덱스값입니다.<br /><br />
  133. [page:BufferAttribute.array array]에서 [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set TypedArray.set]( [page:Array value], [page:Integer offset] )
  134. 를 호출합니다.<br /><br />
  135. [page:Array value]가 [page:TypedArray]로 되는 조건에 대해서는 해당 페이지를 참고하세요.
  136. </p>
  137. <h3>[method:this setUsage] ( [param:Usage value] ) </h3>
  138. <p>[page:BufferAttribute.usage usage]를 value로 설정합니다.</p>
  139. <h3>[method:Number setComponent]( [param:Integer index], [param:Integer component], [param:Float value] ) </h3>
  140. <p>Sets the given component of the vector at the given index.</p>
  141. <h3>[method:this setX]( [param:Integer index], [param:Float x] ) </h3>
  142. <p> x 컴포넌트 값을 설정합니다.</p>
  143. <h3>[method:this setY]( [param:Integer index], [param:Float y] ) </h3>
  144. <p> y 컴포넌트 값을 설정합니다.</p>
  145. <h3>[method:this setZ]( [param:Integer index], [param:Float z] ) </h3>
  146. <p> z 컴포넌트 값을 설정합니다.</p>
  147. <h3>[method:this setW]( [param:Integer index], [param:Float w] ) </h3>
  148. <p> w 컴포넌트 값을 설정합니다.</p>
  149. <h3>[method:this setXY]( [param:Integer index], [param:Float x], [param:Float y] ) </h3>
  150. <p>index의 벡터의 x 및 y 컴포넌트를 설정합니다.</p>
  151. <h3>[method:this setXYZ]( [param:Integer index], [param:Float x], [param:Float y], [param:Float z] ) </h3>
  152. <p> x, y 및 z 컴포넌트를 설정합니다. </p>
  153. <h3>[method:this setXYZW]( [param:Integer index], [param:Float x], [param:Float y], [param:Float z], [param:Float w] ) </h3>
  154. <p> x, y, z 및 w 컴포넌트를 설정합니다. </p>
  155. <h2>소스코드</h2>
  156. <p>
  157. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  158. </p>
  159. </body>
  160. </html>