提交 0fe4a873 编写于 作者: M Mr.doob

Refactored CSS3D billboard implementation.

上级 36ecec28
...@@ -261,10 +261,9 @@ ...@@ -261,10 +261,9 @@
var atom = document.createElement( 'img' ); var atom = document.createElement( 'img' );
atom.src = colorSprite; atom.src = colorSprite;
var object = new THREE.CSS3DObject( atom ); var object = new THREE.CSS3DSprite( atom );
object.position.copy( position ); object.position.copy( position );
object.position.multiplyScalar( 50 ); object.position.multiplyScalar( 50 );
object.billboard = true;
root.add( object ); root.add( object );
objects.push( object ); objects.push( object );
......
...@@ -7,8 +7,6 @@ THREE.CSS3DObject = function ( element ) { ...@@ -7,8 +7,6 @@ THREE.CSS3DObject = function ( element ) {
THREE.Object3D.call( this ); THREE.Object3D.call( this );
this.billboard = false;
this.element = element; this.element = element;
this.element.style.position = "absolute"; this.element.style.position = "absolute";
this.element.style.WebkitTransformStyle = 'preserve-3d'; this.element.style.WebkitTransformStyle = 'preserve-3d';
...@@ -20,6 +18,14 @@ THREE.CSS3DObject = function ( element ) { ...@@ -20,6 +18,14 @@ THREE.CSS3DObject = function ( element ) {
THREE.CSS3DObject.prototype = Object.create( THREE.Object3D.prototype ); THREE.CSS3DObject.prototype = Object.create( THREE.Object3D.prototype );
THREE.CSS3DSprite = function ( element ) {
THREE.CSS3DObject.call( this, element );
};
THREE.CSS3DSprite.prototype = Object.create( THREE.CSS3DObject.prototype );
// //
THREE.CSS3DRenderer = function () { THREE.CSS3DRenderer = function () {
...@@ -157,7 +163,7 @@ THREE.CSS3DRenderer = function () { ...@@ -157,7 +163,7 @@ THREE.CSS3DRenderer = function () {
var element = object.element; var element = object.element;
if ( object.billboard ) { if ( object instanceof THREE.CSS3DSprite ) {
// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/ // http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册