是否可以在THREE.BufferGeometry中使用Float64Array而不是Float32Array

时间:2016-07-21 03:28:13

标签: three.js typed-arrays buffer-geometry

我在使用BufferGeometry时遇到了一些麻烦,因为它使用Float32Array来指定位置。我需要绘制的值(使用THREE.Points)是大数字,例如" 2732124.760877"当我使用Float32Array时,我放弃了大部分精度,当我尝试使用Float64Array时,情节会变得混乱。有没有办法可以使用Float64Array而不是Float32Array。

如果您想查看从Float32Array更改为Float64Array时发生的情况,请尝试将Float32Array更改为以下jsfiddle中的Float64Array(第43行)

buffer_geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float64Array(lines * 3), 3 ));

buffer_geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array(lines * 3), 3 ));

http://jsfiddle.net/pulasthi/sr3r92hy/1/

1 个答案:

答案 0 :(得分:2)

不,请看WebGLRenderer implementation

解析几何属性时,它会检查此条件

        <c:forEach items="${userNameAndPasswordList}" var="userdetails">

                <c:out value="${userdetails.userName}" />
                <c:out value="${userdetails.userPassword}"/>

        </c:forEach>

WebGL没有提供传递双精度64位数字数组的方法。 如果你真的需要那么精确,你的GPU支持双精度数

你可以以某种方式传递你一点一点地创建的2个32位数字,并在着色器中将它们转换为双,但我从来没有尝试过这样的东西..

相关问题