提交 436259ab 编写于 作者: O OpenShift guest

This is the implementation of buffergeometry with lines:...

This is the implementation of buffergeometry with lines: f53b2753 in webglrenderer2
上级 77ada922
......@@ -829,6 +829,35 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
}
} else if ( object instanceof THREE.Line ) {
if ( updateBuffers ) {
// vertices
var position = geometry.attributes[ "position" ];
var positionSize = position.itemSize;
renderer.setFloatAttribute(attributes.position , position.buffer, positionSize, 0);
// colors
var color = geometry.attributes[ "color" ];
if ( attributes.color >= 0 && color ) {
var colorSize = color.itemSize;
renderer.setFloatAttribute(attributes.color , color.buffer, colorSize, 0);
}
// render lines
renderer.drawLineStrip(position.numItems / 3);
_this.info.render.calls ++;
_this.info.render.points += position.numItems;
}
}
};
......@@ -1770,10 +1799,13 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
} else if ( object instanceof THREE.Line ) {
geometry = object.geometry;
if ( ! geometry.__webglVertexBuffer ) {
if ( geometry instanceof THREE.Geometry ) {
lineRenderer.createBuffers( geometry );
lineRenderer.initBuffers( geometry, object );
......@@ -1781,6 +1813,12 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
geometry.colorsNeedUpdate = true;
geometry.lineDistancesNeedUpdate = true;
} else if ( geometry instanceof THREE.BufferGeometry ) {
initDirectBuffers( geometry );
}
}
} else if ( object instanceof THREE.ParticleSystem ) {
......@@ -1972,6 +2010,19 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
} else if ( object instanceof THREE.Line ) {
if ( geometry instanceof THREE.BufferGeometry ) {
if ( geometry.verticesNeedUpdate || geometry.colorsNeedUpdate ) {
setDirectBuffers( geometry, !geometry.dynamic );
}
geometry.verticesNeedUpdate = false;
geometry.colorsNeedUpdate = false;
} else {
material = getBufferMaterial( object, geometry );
customAttributesDirty = material.attributes && areCustomAttributesDirty( material );
......@@ -1988,6 +2039,8 @@ THREE.WebGLRenderer = THREE.WebGLRenderer2 = function ( parameters ) {
material.attributes && clearCustomAttributes( material );
}
} else if ( object instanceof THREE.ParticleSystem ) {
if ( geometry instanceof THREE.BufferGeometry ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册