Files
three.js/src/materials/MeshDepthMaterial.js
T
alteredq 2ecbe2dec2 A lot of bugfixing and refactoring.
- getters/setters are no more in Vector3
  - object hierarchies thus don't use "isDirty"
  - this was completely killing performance for anything that was touching a lot of Vector3 like creation of meshes and dynamic buffers
  - even without this, performance of hierarchies went up (a lot)

- objects do not get passed renderer anymore
  - camera was almost also removed, but this is useful for LOD (though there may be some cleaner way to do this?)

- material ids are now unified, this makes "geometry.sortFacesByMaterial" faster (thus scene init / GUI blocking is shorter)

- all WebGL examples should work now (render-to-texture has weird lights and in some camera control feels different)

- CanvasRender still broken, despite many efforts :(
   - currently only points and lines work, faces don't show up. I think this may need assistance from mrdoob.
2011-02-18 00:31:08 +01:00

62 lines
1.5 KiB
JavaScript

/**
* @author mr.doob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
*
* parameters = {
* opacity: <float>,
* blending: THREE.NormalBlending,
* depth_test: <bool>,
* wireframe: <boolean>,
* wireframe_linewidth: <float>
* }
*/
THREE.MeshDepthMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.opacity = 1.0;
this.shading = THREE.SmoothShading; // doesn't really apply here, normals are not used
this.blending = THREE.NormalBlending;
this.depth_test = true;
this.wireframe = false;
this.wireframe_linewidth = 1.0;
if ( parameters ) {
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
}
};
THREE.MeshDepthMaterial.prototype = {
toString: function () {
return 'THREE.MeshDepthMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth + '<br/>' +
')';
}
};