1 |
- {"ast":null,"code":"import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { FlowGraphInteger } from \"./flowGraphInteger.js\";\n/**\n * A rich type represents extra information about a type,\n * such as its name and a default value constructor.\n * @experimental\n */\nexport class RichType {\n constructor(\n /**\n * The name given to the type.\n */\n typeName,\n /**\n * The default value of the type.\n */\n defaultValue) {\n this.typeName = typeName;\n this.defaultValue = defaultValue;\n }\n /**\n * Serializes this rich type into a serialization object.\n * @param serializationObject the object to serialize to\n */\n serialize(serializationObject) {\n serializationObject.typeName = this.typeName;\n serializationObject.defaultValue = this.defaultValue;\n }\n /**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\n static Parse(serializationObject) {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n }\n}\nexport const RichTypeAny = new RichType(\"any\", undefined);\nexport const RichTypeString = new RichType(\"string\", \"\");\nexport const RichTypeNumber = new RichType(\"number\", 0);\nexport const RichTypeBoolean = new RichType(\"boolean\", false);\nexport const RichTypeVector2 = new RichType(\"Vector2\", Vector2.Zero());\nexport const RichTypeVector3 = new RichType(\"Vector3\", Vector3.Zero());\nexport const RichTypeVector4 = new RichType(\"Vector4\", Vector4.Zero());\nexport const RichTypeMatrix = new RichType(\"Matrix\", Matrix.Identity());\nexport const RichTypeColor3 = new RichType(\"Color3\", Color3.Black());\nexport const RichTypeColor4 = new RichType(\"Color4\", new Color4(0, 0, 0, 0));\nexport const RichTypeQuaternion = new RichType(\"Quaternion\", Quaternion.Identity());\nexport const RichTypeFlowGraphInteger = new RichType(\"FlowGraphInteger\", new FlowGraphInteger(0));\n/**\n * Given a value, try to deduce its rich type.\n * @param value the value to deduce the rich type from\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\n */\nexport function getRichTypeFromValue(value) {\n switch (typeof value) {\n case \"string\":\n return RichTypeString;\n case \"number\":\n return RichTypeNumber;\n case \"boolean\":\n return RichTypeBoolean;\n case \"object\":\n if (value instanceof Vector2) {\n return RichTypeVector2;\n } else if (value instanceof Vector3) {\n return RichTypeVector3;\n } else if (value instanceof Vector4) {\n return RichTypeVector4;\n } else if (value instanceof Color3) {\n return RichTypeColor3;\n } else if (value instanceof Color4) {\n return RichTypeColor4;\n } else if (value instanceof Quaternion) {\n return RichTypeQuaternion;\n } else if (value instanceof FlowGraphInteger) {\n return RichTypeFlowGraphInteger;\n } else {\n return RichTypeAny;\n }\n default:\n return RichTypeAny;\n }\n}","map":{"version":3,"names":["Vector2","Vector3","Vector4","Matrix","Quaternion","Color3","Color4","FlowGraphInteger","RichType","constructor","typeName","defaultValue","serialize","serializationObject","Parse","RichTypeAny","undefined","RichTypeString","RichTypeNumber","RichTypeBoolean","RichTypeVector2","Zero","RichTypeVector3","RichTypeVector4","RichTypeMatrix","Identity","RichTypeColor3","Black","RichTypeColor4","RichTypeQuaternion","RichTypeFlowGraphInteger","getRichTypeFromValue","value"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FlowGraph/flowGraphRichTypes.js"],"sourcesContent":["import { Vector2, Vector3, Vector4, Matrix, Quaternion } from \"../Maths/math.vector.js\";\nimport { Color3, Color4 } from \"../Maths/math.color.js\";\nimport { FlowGraphInteger } from \"./flowGraphInteger.js\";\n/**\n * A rich type represents extra information about a type,\n * such as its name and a default value constructor.\n * @experimental\n */\nexport class RichType {\n constructor(\n /**\n * The name given to the type.\n */\n typeName, \n /**\n * The default value of the type.\n */\n defaultValue) {\n this.typeName = typeName;\n this.defaultValue = defaultValue;\n }\n /**\n * Serializes this rich type into a serialization object.\n * @param serializationObject the object to serialize to\n */\n serialize(serializationObject) {\n serializationObject.typeName = this.typeName;\n serializationObject.defaultValue = this.defaultValue;\n }\n /**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\n static Parse(serializationObject) {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n }\n}\nexport const RichTypeAny = new RichType(\"any\", undefined);\nexport const RichTypeString = new RichType(\"string\", \"\");\nexport const RichTypeNumber = new RichType(\"number\", 0);\nexport const RichTypeBoolean = new RichType(\"boolean\", false);\nexport const RichTypeVector2 = new RichType(\"Vector2\", Vector2.Zero());\nexport const RichTypeVector3 = new RichType(\"Vector3\", Vector3.Zero());\nexport const RichTypeVector4 = new RichType(\"Vector4\", Vector4.Zero());\nexport const RichTypeMatrix = new RichType(\"Matrix\", Matrix.Identity());\nexport const RichTypeColor3 = new RichType(\"Color3\", Color3.Black());\nexport const RichTypeColor4 = new RichType(\"Color4\", new Color4(0, 0, 0, 0));\nexport const RichTypeQuaternion = new RichType(\"Quaternion\", Quaternion.Identity());\nexport const RichTypeFlowGraphInteger = new RichType(\"FlowGraphInteger\", new FlowGraphInteger(0));\n/**\n * Given a value, try to deduce its rich type.\n * @param value the value to deduce the rich type from\n * @returns the value's rich type, or RichTypeAny if the type could not be deduced.\n */\nexport function getRichTypeFromValue(value) {\n switch (typeof value) {\n case \"string\":\n return RichTypeString;\n case \"number\":\n return RichTypeNumber;\n case \"boolean\":\n return RichTypeBoolean;\n case \"object\":\n if (value instanceof Vector2) {\n return RichTypeVector2;\n }\n else if (value instanceof Vector3) {\n return RichTypeVector3;\n }\n else if (value instanceof Vector4) {\n return RichTypeVector4;\n }\n else if (value instanceof Color3) {\n return RichTypeColor3;\n }\n else if (value instanceof Color4) {\n return RichTypeColor4;\n }\n else if (value instanceof Quaternion) {\n return RichTypeQuaternion;\n }\n else if (value instanceof FlowGraphInteger) {\n return RichTypeFlowGraphInteger;\n }\n else {\n return RichTypeAny;\n }\n default:\n return RichTypeAny;\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAEC,MAAM,EAAEC,UAAU,QAAQ,yBAAyB;AACvF,SAASC,MAAM,EAAEC,MAAM,QAAQ,wBAAwB;AACvD,SAASC,gBAAgB,QAAQ,uBAAuB;A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