Browse Source

Playground: Revision mat*/bool color and json matrix* types (#28094)

* fix node type

* differentiates the color of a boolean from the material
sunag 1 year ago
parent
commit
c9576b8412
2 changed files with 13 additions and 10 deletions
  1. 7 6
      playground/DataTypeLib.js
  2. 6 4
      playground/Nodes.json

+ 7 - 6
playground/DataTypeLib.js

@@ -36,7 +36,7 @@ export function getLengthFromType( type ) {
 
 
 export function getLengthFromNode( value ) {
 export function getLengthFromNode( value ) {
 
 
-	let type = getTypeFromNode( value );
+	const type = getTypeFromNode( value );
 
 
 	return getLengthFromType( type );
 	return getLengthFromType( type );
 
 
@@ -46,10 +46,10 @@ export const typeToColorLib = {
 	// gpu
 	// gpu
 	string: '#ff0000',
 	string: '#ff0000',
 	float: '#eeeeee',
 	float: '#eeeeee',
-	bool: '#00dd00',
-	mat2: '#70d030',
-	mat3: '#70d030',
-	mat4: '#70d030',
+	bool: '#0060ff',
+	mat2: '#d0dc8b',
+	mat3: '#d0dc8b',
+	mat4: '#d0dc8b',
 	// cpu
 	// cpu
 	String: '#ff0000',
 	String: '#ff0000',
 	Number: '#eeeeee',
 	Number: '#eeeeee',
@@ -69,7 +69,7 @@ export function getColorFromType( type ) {
 
 
 export function getColorFromNode( value ) {
 export function getColorFromNode( value ) {
 
 
-	let type = getTypeFromNode( value );
+	const type = getTypeFromNode( value );
 
 
 	return getColorFromType( type );
 	return getColorFromType( type );
 
 
@@ -82,6 +82,7 @@ function getTypeFromNode( value ) {
 		if ( value.isMaterial ) return 'Material';
 		if ( value.isMaterial ) return 'Material';
 
 
 		return value.nodeType === 'ArrayBuffer' ? 'URL' : ( value.nodeType || getTypeFromValue( value.value ) );
 		return value.nodeType === 'ArrayBuffer' ? 'URL' : ( value.nodeType || getTypeFromValue( value.value ) );
+
 	}
 	}
 
 
 }
 }

+ 6 - 4
playground/Nodes.json

@@ -57,7 +57,7 @@
 						{
 						{
 							"name": "Camera Normal Matrix",
 							"name": "Camera Normal Matrix",
 							"icon": "video",
 							"icon": "video",
-							"nodeType": "mat4",
+							"nodeType": "mat3",
 							"shaderNode": "cameraNormalMatrix"
 							"shaderNode": "cameraNormalMatrix"
 						},
 						},
 						{
 						{
@@ -232,7 +232,7 @@
 						{
 						{
 							"name": "Model Normal Matrix",
 							"name": "Model Normal Matrix",
 							"icon": "box",
 							"icon": "box",
-							"nodeType": "vec3",
+							"nodeType": "mat3",
 							"shaderNode": "modelNormalMatrix"
 							"shaderNode": "modelNormalMatrix"
 						},
 						},
 						{
 						{
@@ -244,7 +244,7 @@
 						{
 						{
 							"name": "Model View Matrix",
 							"name": "Model View Matrix",
 							"icon": "box",
 							"icon": "box",
-							"nodeType": "vec3",
+							"nodeType": "mat4",
 							"shaderNode": "modelViewMatrix"
 							"shaderNode": "modelViewMatrix"
 						},
 						},
 						{
 						{
@@ -256,7 +256,7 @@
 						{
 						{
 							"name": "Model World Matrix",
 							"name": "Model World Matrix",
 							"icon": "box",
 							"icon": "box",
-							"nodeType": "vec3",
+							"nodeType": "mat4",
 							"shaderNode": "modelWorldMatrix"
 							"shaderNode": "modelWorldMatrix"
 						}
 						}
 					]
 					]
@@ -280,6 +280,7 @@
 							"name": "Object Normal Matrix",
 							"name": "Object Normal Matrix",
 							"icon": "3d-cube-sphere",
 							"icon": "3d-cube-sphere",
 							"shaderNode": "objectNormalMatrix",
 							"shaderNode": "objectNormalMatrix",
+							"nodeType": "mat3",
 							"properties": [
 							"properties": [
 								{
 								{
 									"name": "object3d",
 									"name": "object3d",
@@ -302,6 +303,7 @@
 							"name": "Object View Matrix",
 							"name": "Object View Matrix",
 							"icon": "3d-cube-sphere",
 							"icon": "3d-cube-sphere",
 							"shaderNode": "objectViewMatrix",
 							"shaderNode": "objectViewMatrix",
+							"nodeType": "mat4",
 							"properties": [
 							"properties": [
 								{
 								{
 									"name": "object3d",
 									"name": "object3d",