提交 1ea94ad7 编写于 作者: T Tristan VALCKE

Apply style

上级 696c849f
......@@ -2,7 +2,7 @@
* @author sunag / http://www.sunag.com.br/
*/
THREE.CameraNode = function( scope, camera ) {
THREE.CameraNode = function ( scope, camera ) {
THREE.TempNode.call( this, 'v3' );
......@@ -12,14 +12,14 @@ THREE.CameraNode = function( scope, camera ) {
};
THREE.CameraNode.fDepthColor = new THREE.FunctionNode( [
"float depthColor( float mNear, float mFar ) {",
" #ifdef USE_LOGDEPTHBUF_EXT",
" float depth = gl_FragDepthEXT / gl_FragCoord.w;",
" #else",
" float depth = gl_FragCoord.z / gl_FragCoord.w;",
" #endif",
" return 1.0 - smoothstep( mNear, mFar, depth );",
"}"
"float depthColor( float mNear, float mFar ) {",
" #ifdef USE_LOGDEPTHBUF_EXT",
" float depth = gl_FragDepthEXT / gl_FragCoord.w;",
" #else",
" float depth = gl_FragCoord.z / gl_FragCoord.w;",
" #endif",
" return 1.0 - smoothstep( mNear, mFar, depth );",
"}"
].join( "\n" ) );
THREE.CameraNode.POSITION = 'position';
......@@ -29,14 +29,14 @@ THREE.CameraNode.TO_VERTEX = 'toVertex';
THREE.CameraNode.prototype = Object.create( THREE.TempNode.prototype );
THREE.CameraNode.prototype.constructor = THREE.CameraNode;
THREE.CameraNode.prototype.setCamera = function( camera ) {
THREE.CameraNode.prototype.setCamera = function ( camera ) {
this.camera = camera;
this.requestUpdate = camera !== undefined;
};
THREE.CameraNode.prototype.setScope = function( scope ) {
THREE.CameraNode.prototype.setScope = function ( scope ) {
switch ( this.scope ) {
......@@ -55,7 +55,7 @@ THREE.CameraNode.prototype.setScope = function( scope ) {
case THREE.CameraNode.DEPTH:
var camera = this.camera
var camera = this.camera;
this.near = new THREE.FloatNode( camera ? camera.near : 1 );
this.far = new THREE.FloatNode( camera ? camera.far : 1200 );
......@@ -65,41 +65,47 @@ THREE.CameraNode.prototype.setScope = function( scope ) {
};
THREE.CameraNode.prototype.getType = function( builder ) {
THREE.CameraNode.prototype.getType = function ( builder ) {
switch ( this.scope ) {
case THREE.CameraNode.DEPTH:
return 'fv1';
}
return this.type;
};
THREE.CameraNode.prototype.isUnique = function( builder ) {
THREE.CameraNode.prototype.isUnique = function ( builder ) {
switch ( this.scope ) {
case THREE.CameraNode.DEPTH:
case THREE.CameraNode.TO_VERTEX:
return true;
}
return false;
};
THREE.CameraNode.prototype.isShared = function( builder ) {
THREE.CameraNode.prototype.isShared = function ( builder ) {
switch ( this.scope ) {
case THREE.CameraNode.POSITION:
return false;
}
return true;
};
THREE.CameraNode.prototype.generate = function( builder, output ) {
THREE.CameraNode.prototype.generate = function ( builder, output ) {
var material = builder.material;
var result;
......@@ -134,13 +140,13 @@ THREE.CameraNode.prototype.generate = function( builder, output ) {
};
THREE.CameraNode.prototype.updateFrame = function( delta ) {
THREE.CameraNode.prototype.updateFrame = function ( delta ) {
switch ( this.scope ) {
case THREE.CameraNode.DEPTH:
var camera = this.camera
var camera = this.camera;
this.near.number = camera.near;
this.far.number = camera.far;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册