Skip to content

Commit

Permalink
rename .transform to .position ( .transform or .position = new Positi…
Browse files Browse the repository at this point in the history
…onNode() )
  • Loading branch information
sunag committed Jul 8, 2018
1 parent 232cb3f commit 231a8a6
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion examples/js/nodes/materials/PhongNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NodeUtils.addShortcuts( PhongNodeMaterial.prototype, 'fragment', [
'ao',
'environment',
'environmentAlpha',
'transform'
'position'
] );

export { PhongNodeMaterial };
2 changes: 1 addition & 1 deletion examples/js/nodes/materials/SpriteNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SpriteNodeMaterial.prototype.constructor = SpriteNodeMaterial;
NodeUtils.addShortcuts( SpriteNodeMaterial.prototype, 'fragment', [
'color',
'alpha',
'transform',
'position',
'spherical'
] );

Expand Down
2 changes: 1 addition & 1 deletion examples/js/nodes/materials/StandardNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NodeUtils.addShortcuts( StandardNodeMaterial.prototype, 'fragment', [
'shadow',
'ao',
'environment',
'transform'
'position'
] );

export { StandardNodeMaterial };
12 changes: 6 additions & 6 deletions examples/js/nodes/materials/nodes/PhongNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PhongNode.prototype.build = function ( builder ) {

if ( builder.isShader( 'vertex' ) ) {

var transform = this.transform ? this.transform.parseAndBuildCode( builder, 'v3', { cache: 'transform' } ) : undefined;
var position = this.position ? this.position.parseAndBuildCode( builder, 'v3', { cache: 'position' } ) : undefined;

builder.mergeUniform( THREE.UniformsUtils.merge( [

Expand Down Expand Up @@ -74,11 +74,11 @@ PhongNode.prototype.build = function ( builder ) {
"#include <begin_vertex>"
];

if ( transform ) {
if ( position ) {

output.push(
transform.code,
transform.result ? "transformed = " + transform.result + ";" : ''
position.code,
position.result ? "transformed = " + position.result + ";" : ''
);

}
Expand Down Expand Up @@ -325,7 +325,7 @@ PhongNode.prototype.copy = function ( source ) {

// vertex

if ( source.transform ) this.transform = source.transform;
if ( source.position ) this.position = source.position;

// fragment

Expand Down Expand Up @@ -360,7 +360,7 @@ PhongNode.prototype.toJSON = function ( meta ) {

// vertex

if ( this.transform ) data.transform = this.transform.toJSON( meta ).uuid;
if ( this.position ) data.position = this.position.toJSON( meta ).uuid;

// fragment

Expand Down
14 changes: 7 additions & 7 deletions examples/js/nodes/materials/nodes/SpriteNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SpriteNode.prototype.build = function ( builder ) {

if ( builder.isShader( 'vertex' ) ) {

var transform = this.transform ? this.transform.parseAndBuildCode( builder, 'v3', { cache: 'transform' } ) : undefined;
var position = this.position ? this.position.parseAndBuildCode( builder, 'v3', { cache: 'position' } ) : undefined;

builder.mergeUniform( THREE.UniformsUtils.merge( [
THREE.UniformsLib[ "fog" ]
Expand All @@ -43,11 +43,11 @@ SpriteNode.prototype.build = function ( builder ) {
"#include <begin_vertex>"
];

if ( transform ) {
if ( position ) {

output.push(
transform.code,
transform.result ? "transformed = " + transform.result + ";" : ''
position.code,
position.result ? "transformed = " + position.result + ";" : ''
);

}
Expand Down Expand Up @@ -148,13 +148,13 @@ SpriteNode.prototype.copy = function ( source ) {

// vertex

if ( source.transform ) this.transform = source.transform;
if ( source.position ) this.position = source.position;

// fragment

this.color = source.color;

if ( source.spherical !== undefined ) this.spherical = source.transform;
if ( source.spherical !== undefined ) this.spherical = source.position;

if ( source.alpha ) this.alpha = source.alpha;

Expand All @@ -170,7 +170,7 @@ SpriteNode.prototype.toJSON = function ( meta ) {

// vertex

if ( this.transform ) data.transform = this.transform.toJSON( meta ).uuid;
if ( this.position ) data.position = this.position.toJSON( meta ).uuid;

// fragment

Expand Down
12 changes: 6 additions & 6 deletions examples/js/nodes/materials/nodes/StandardNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ StandardNode.prototype.build = function ( builder ) {

if ( builder.isShader( 'vertex' ) ) {

var transform = this.transform ? this.transform.parseAndBuildCode( builder, 'v3', { cache: 'transform' } ) : undefined;
var position = this.position ? this.position.parseAndBuildCode( builder, 'v3', { cache: 'position' } ) : undefined;

builder.mergeUniform( THREE.UniformsUtils.merge( [

Expand Down Expand Up @@ -81,11 +81,11 @@ StandardNode.prototype.build = function ( builder ) {
"#include <begin_vertex>"
];

if ( transform ) {
if ( position ) {

output.push(
transform.code,
transform.result ? "transformed = " + transform.result + ";" : ''
position.code,
position.result ? "transformed = " + position.result + ";" : ''
);

}
Expand Down Expand Up @@ -396,7 +396,7 @@ StandardNode.prototype.copy = function ( source ) {

// vertex

if ( source.transform ) this.transform = source.transform;
if ( source.position ) this.position = source.position;

// fragment

Expand Down Expand Up @@ -435,7 +435,7 @@ StandardNode.prototype.toJSON = function ( meta ) {

// vertex

if ( this.transform ) data.transform = this.transform.toJSON( meta ).uuid;
if ( this.position ) data.position = this.position.toJSON( meta ).uuid;

// fragment

Expand Down
12 changes: 6 additions & 6 deletions examples/js/nodes/utils/UVTransformNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { ExpressionNode } from '../core/ExpressionNode.js';
import { Matrix3Node } from '../inputs/Matrix3Node.js';
import { UVNode } from '../accessors/UVNode.js';

function UVTransformNode( uv, transform ) {
function UVTransformNode( uv, position ) {

ExpressionNode.call( this, "( uvTransform * vec3( uvNode, 1 ) ).xy", "vec2" );

this.uv = uv || new UVNode();
this.transform = transform || new Matrix3Node();
this.position = position || new Matrix3Node();

};

Expand All @@ -22,7 +22,7 @@ UVTransformNode.prototype.nodeType = "UVTransform";
UVTransformNode.prototype.generate = function ( builder, output ) {

this.keywords[ "uvNode" ] = this.uv;
this.keywords[ "uvTransform" ] = this.transform;
this.keywords[ "uvTransform" ] = this.position;

return ExpressionNode.prototype.generate.call( this, builder, output );

Expand All @@ -33,7 +33,7 @@ UVTransformNode.prototype.setUvTransform = function ( tx, ty, sx, sy, rotation,
cx = cx !== undefined ? cx : .5;
cy = cy !== undefined ? cy : .5;

this.transform.value.setUvTransform( tx, ty, sx, sy, rotation, cx, cy );
this.position.value.setUvTransform( tx, ty, sx, sy, rotation, cx, cy );

};

Expand All @@ -42,7 +42,7 @@ UVTransformNode.prototype.copy = function ( source ) {
ExpressionNode.prototype.copy.call( this, source );

this.uv = source.uv;
this.transform = source.transform;
this.position = source.position;

};

Expand All @@ -55,7 +55,7 @@ UVTransformNode.prototype.toJSON = function ( meta ) {
data = this.createJSONNode( meta );

data.uv = this.uv.toJSON( meta ).uuid;
data.transform = this.transform.toJSON( meta ).uuid;
data.position = this.position.toJSON( meta ).uuid;

}

Expand Down
2 changes: 1 addition & 1 deletion examples/nodes/displace.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"nodes":{"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6":{"uuid":"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6","nodeType":"Phong","transform":"A298C150-1E98-425D-8552-CF4690C3238E","color":"DCD2B815-345D-4600-BAFD-BE26925C60E6","specular":"DCD2B815-345D-4600-BAFD-BE26925C60E6","shininess":"5E1EEAA6-F057-4D5F-8607-E9F8265D2B0A","emissive":"BF320EA1-F523-4314-9B87-07E33F39CC6C"},"A298C150-1E98-425D-8552-CF4690C3238E":{"uuid":"A298C150-1E98-425D-8552-CF4690C3238E","nodeType":"Operator","a":"6449FE7E-56E7-490E-9CA9-9F5E9A540AFD","b":"09ECA9C2-8B78-422B-B3DA-2194BCBC5FCA","op":"+"},"6449FE7E-56E7-490E-9CA9-9F5E9A540AFD":{"uuid":"6449FE7E-56E7-490E-9CA9-9F5E9A540AFD","nodeType":"Position","scope":"local"},"09ECA9C2-8B78-422B-B3DA-2194BCBC5FCA":{"uuid":"09ECA9C2-8B78-422B-B3DA-2194BCBC5FCA","nodeType":"Operator","a":"C4573235-0C78-460A-BB35-E41470304BD5","b":"1FF6B149-BCA7-4F37-91E9-8AFA8770F084","op":"*"},"C4573235-0C78-460A-BB35-E41470304BD5":{"uuid":"C4573235-0C78-460A-BB35-E41470304BD5","nodeType":"Operator","a":"0E355E3B-23AB-4225-9477-312295B18436","b":"ABD03824-B7F8-46A4-9006-03FBA06618A9","op":"*"},"0E355E3B-23AB-4225-9477-312295B18436":{"uuid":"0E355E3B-23AB-4225-9477-312295B18436","nodeType":"Normal","scope":"local"},"ABD03824-B7F8-46A4-9006-03FBA06618A9":{"uuid":"ABD03824-B7F8-46A4-9006-03FBA06618A9","nodeType":"Switch","node":"43D31AB8-1DD6-46BE-8969-0668FAB513E2","components":"w"},"43D31AB8-1DD6-46BE-8969-0668FAB513E2":{"uuid":"43D31AB8-1DD6-46BE-8969-0668FAB513E2","nodeType":"Texture","value":"cloud","uv":"273D729E-E18D-47AE-8299-F069FDB6C43A","project":false},"273D729E-E18D-47AE-8299-F069FDB6C43A":{"uuid":"273D729E-E18D-47AE-8299-F069FDB6C43A","nodeType":"Operator","a":"C46D2A54-57A8-4649-AF9B-09D011AF3BFD","b":"C43B8DA9-AFF5-4690-B2EA-3EED061C0662","op":"+"},"C46D2A54-57A8-4649-AF9B-09D011AF3BFD":{"uuid":"C46D2A54-57A8-4649-AF9B-09D011AF3BFD","nodeType":"Operator","a":"F81EC887-A160-455B-B1DE-A0FA2B7FAC36","b":"801913CD-EC7A-47BE-A54C-3D86020B0847","op":"*"},"F81EC887-A160-455B-B1DE-A0FA2B7FAC36":{"uuid":"F81EC887-A160-455B-B1DE-A0FA2B7FAC36","nodeType":"Timer","name":"time","scope":"global","scale":1,"useTimeScale":false},"801913CD-EC7A-47BE-A54C-3D86020B0847":{"uuid":"801913CD-EC7A-47BE-A54C-3D86020B0847","nodeType":"Float","name":"speed","value":0.2},"C43B8DA9-AFF5-4690-B2EA-3EED061C0662":{"uuid":"C43B8DA9-AFF5-4690-B2EA-3EED061C0662","nodeType":"UV","index":0},"1FF6B149-BCA7-4F37-91E9-8AFA8770F084":{"uuid":"1FF6B149-BCA7-4F37-91E9-8AFA8770F084","nodeType":"Float","value":2},"DCD2B815-345D-4600-BAFD-BE26925C60E6":{"uuid":"DCD2B815-345D-4600-BAFD-BE26925C60E6","nodeType":"Color","r":0,"g":0,"b":0},"5E1EEAA6-F057-4D5F-8607-E9F8265D2B0A":{"uuid":"5E1EEAA6-F057-4D5F-8607-E9F8265D2B0A","nodeType":"Float","value":30},"BF320EA1-F523-4314-9B87-07E33F39CC6C":{"uuid":"BF320EA1-F523-4314-9B87-07E33F39CC6C","nodeType":"Math3","a":"F9EA5DC0-2BC8-4C38-A480-1DA3D0680AAE","b":"65010573-EE24-42A3-B32C-3945F3CF2E93","c":"ABD03824-B7F8-46A4-9006-03FBA06618A9","method":"mix"},"F9EA5DC0-2BC8-4C38-A480-1DA3D0680AAE":{"uuid":"F9EA5DC0-2BC8-4C38-A480-1DA3D0680AAE","nodeType":"Color","r":0,"g":0.32941176470588235,"b":0.8745098039215686},"65010573-EE24-42A3-B32C-3945F3CF2E93":{"uuid":"65010573-EE24-42A3-B32C-3945F3CF2E93","nodeType":"Color","r":1,"g":1,"b":1}},"materials":{"BCB86F69-822F-4F9C-838B-70F657904D05":{"uuid":"BCB86F69-822F-4F9C-838B-70F657904D05","type":"PhongNodeMaterial","fog":false,"lights":true,"vertex":"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6","fragment":"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6"}},"material":"BCB86F69-822F-4F9C-838B-70F657904D05"}
{"nodes":{"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6":{"uuid":"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6","nodeType":"Phong","position":"A298C150-1E98-425D-8552-CF4690C3238E","color":"DCD2B815-345D-4600-BAFD-BE26925C60E6","specular":"DCD2B815-345D-4600-BAFD-BE26925C60E6","shininess":"5E1EEAA6-F057-4D5F-8607-E9F8265D2B0A","emissive":"BF320EA1-F523-4314-9B87-07E33F39CC6C"},"A298C150-1E98-425D-8552-CF4690C3238E":{"uuid":"A298C150-1E98-425D-8552-CF4690C3238E","nodeType":"Operator","a":"6449FE7E-56E7-490E-9CA9-9F5E9A540AFD","b":"09ECA9C2-8B78-422B-B3DA-2194BCBC5FCA","op":"+"},"6449FE7E-56E7-490E-9CA9-9F5E9A540AFD":{"uuid":"6449FE7E-56E7-490E-9CA9-9F5E9A540AFD","nodeType":"Position","scope":"local"},"09ECA9C2-8B78-422B-B3DA-2194BCBC5FCA":{"uuid":"09ECA9C2-8B78-422B-B3DA-2194BCBC5FCA","nodeType":"Operator","a":"C4573235-0C78-460A-BB35-E41470304BD5","b":"1FF6B149-BCA7-4F37-91E9-8AFA8770F084","op":"*"},"C4573235-0C78-460A-BB35-E41470304BD5":{"uuid":"C4573235-0C78-460A-BB35-E41470304BD5","nodeType":"Operator","a":"0E355E3B-23AB-4225-9477-312295B18436","b":"ABD03824-B7F8-46A4-9006-03FBA06618A9","op":"*"},"0E355E3B-23AB-4225-9477-312295B18436":{"uuid":"0E355E3B-23AB-4225-9477-312295B18436","nodeType":"Normal","scope":"local"},"ABD03824-B7F8-46A4-9006-03FBA06618A9":{"uuid":"ABD03824-B7F8-46A4-9006-03FBA06618A9","nodeType":"Switch","node":"43D31AB8-1DD6-46BE-8969-0668FAB513E2","components":"w"},"43D31AB8-1DD6-46BE-8969-0668FAB513E2":{"uuid":"43D31AB8-1DD6-46BE-8969-0668FAB513E2","nodeType":"Texture","value":"cloud","uv":"273D729E-E18D-47AE-8299-F069FDB6C43A","project":false},"273D729E-E18D-47AE-8299-F069FDB6C43A":{"uuid":"273D729E-E18D-47AE-8299-F069FDB6C43A","nodeType":"Operator","a":"C46D2A54-57A8-4649-AF9B-09D011AF3BFD","b":"C43B8DA9-AFF5-4690-B2EA-3EED061C0662","op":"+"},"C46D2A54-57A8-4649-AF9B-09D011AF3BFD":{"uuid":"C46D2A54-57A8-4649-AF9B-09D011AF3BFD","nodeType":"Operator","a":"F81EC887-A160-455B-B1DE-A0FA2B7FAC36","b":"801913CD-EC7A-47BE-A54C-3D86020B0847","op":"*"},"F81EC887-A160-455B-B1DE-A0FA2B7FAC36":{"uuid":"F81EC887-A160-455B-B1DE-A0FA2B7FAC36","nodeType":"Timer","name":"time","scope":"global","scale":1,"useTimeScale":false},"801913CD-EC7A-47BE-A54C-3D86020B0847":{"uuid":"801913CD-EC7A-47BE-A54C-3D86020B0847","nodeType":"Float","name":"speed","value":0.2},"C43B8DA9-AFF5-4690-B2EA-3EED061C0662":{"uuid":"C43B8DA9-AFF5-4690-B2EA-3EED061C0662","nodeType":"UV","index":0},"1FF6B149-BCA7-4F37-91E9-8AFA8770F084":{"uuid":"1FF6B149-BCA7-4F37-91E9-8AFA8770F084","nodeType":"Float","value":2},"DCD2B815-345D-4600-BAFD-BE26925C60E6":{"uuid":"DCD2B815-345D-4600-BAFD-BE26925C60E6","nodeType":"Color","r":0,"g":0,"b":0},"5E1EEAA6-F057-4D5F-8607-E9F8265D2B0A":{"uuid":"5E1EEAA6-F057-4D5F-8607-E9F8265D2B0A","nodeType":"Float","value":30},"BF320EA1-F523-4314-9B87-07E33F39CC6C":{"uuid":"BF320EA1-F523-4314-9B87-07E33F39CC6C","nodeType":"Math3","a":"F9EA5DC0-2BC8-4C38-A480-1DA3D0680AAE","b":"65010573-EE24-42A3-B32C-3945F3CF2E93","c":"ABD03824-B7F8-46A4-9006-03FBA06618A9","method":"mix"},"F9EA5DC0-2BC8-4C38-A480-1DA3D0680AAE":{"uuid":"F9EA5DC0-2BC8-4C38-A480-1DA3D0680AAE","nodeType":"Color","r":0,"g":0.32941176470588235,"b":0.8745098039215686},"65010573-EE24-42A3-B32C-3945F3CF2E93":{"uuid":"65010573-EE24-42A3-B32C-3945F3CF2E93","nodeType":"Color","r":1,"g":1,"b":1}},"materials":{"BCB86F69-822F-4F9C-838B-70F657904D05":{"uuid":"BCB86F69-822F-4F9C-838B-70F657904D05","type":"PhongNodeMaterial","fog":false,"lights":true,"vertex":"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6","fragment":"A9543A4D-4036-4AB3-AEF1-0AE10CFDD4A6"}},"material":"BCB86F69-822F-4F9C-838B-70F657904D05"}
Loading

0 comments on commit 231a8a6

Please sign in to comment.