Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
processCandidatePort() {
let pointB = this._candidateLink!.portA.connectionPoint;
let nodeB = this._candidateLink!.portA.node;
let pointA: NodeMaterialConnectionPoint;
let nodeA: GraphNode;
if (this._candidatePort) {
pointA = this._candidatePort.connectionPoint;
nodeA = this._candidatePort.node;
} else {
if (pointB.direction === NodeMaterialConnectionPointDirection.Output) {
return;
}
// No destination so let's spin a new input block
let inputBlock = new InputBlock("", undefined, this._candidateLink!.portA.connectionPoint.type);
pointA = inputBlock.output;
nodeA = this.appendBlock(inputBlock);
nodeA.x = this._dropPointX - 200;
nodeA.y = this._dropPointY - 50;
}
if (pointA.direction === NodeMaterialConnectionPointDirection.Input) {
let temp = pointB;
pointB = pointA;
pointA = temp;
let tempNode = nodeA;
nodeA = nodeB;
nodeB = tempNode;
}
addValueNode(type: string) {
let nodeType: NodeMaterialBlockConnectionPointTypes = BlockTools.GetConnectionNodeTypeFromString(type);
let newInputBlock = new InputBlock(type, undefined, nodeType);
var localNode = this.createNodeFromObject({ type: type, nodeMaterialBlock: newInputBlock })
return localNode;
}
let projectionMatrixBlock = new InputBlock("Projection");
projectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.Projection);
return projectionMatrixBlock;
}
case "CameraPositionBlock": {
let cameraPosition = new InputBlock("Camera position");
cameraPosition.setAsSystemValue(NodeMaterialSystemValues.CameraPosition);
return cameraPosition;
}
case "FogColorBlock": {
let FogColor = new InputBlock("Fog color");
FogColor.setAsSystemValue(NodeMaterialSystemValues.FogColor);
return FogColor;
}
case "PositionBlock": {
let meshPosition = new InputBlock("position");
meshPosition.setAsAttribute("position");
return meshPosition;
}
case "UVBlock": {
let meshUV = new InputBlock("uv");
meshUV.setAsAttribute("uv");
return meshUV;
}
case "ColorBlock": {
let meshColor = new InputBlock("color");
meshColor.setAsAttribute("color");
return meshColor;
}
case "NormalBlock": {
let meshNormal = new InputBlock("normal");
meshNormal.setAsAttribute("normal");
let viewProjectionMatrixBlock = new InputBlock("View x Projection");
viewProjectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.ViewProjection);
return viewProjectionMatrixBlock;
}
case "ProjectionMatrixBlock": {
let projectionMatrixBlock = new InputBlock("Projection");
projectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.Projection);
return projectionMatrixBlock;
}
case "CameraPositionBlock": {
let cameraPosition = new InputBlock("Camera position");
cameraPosition.setAsSystemValue(NodeMaterialSystemValues.CameraPosition);
return cameraPosition;
}
case "FogColorBlock": {
let FogColor = new InputBlock("Fog color");
FogColor.setAsSystemValue(NodeMaterialSystemValues.FogColor);
return FogColor;
}
case "PositionBlock": {
let meshPosition = new InputBlock("position");
meshPosition.setAsAttribute("position");
return meshPosition;
}
case "UVBlock": {
let meshUV = new InputBlock("uv");
meshUV.setAsAttribute("uv");
return meshUV;
}
case "ColorBlock": {
let meshColor = new InputBlock("color");
meshColor.setAsAttribute("color");
let ceilingBlock = new TrigonometryBlock("Ceiling");
ceilingBlock.operation = TrigonometryBlockOperations.Ceiling;
return ceilingBlock;
}
case "FloorBlock": {
let floorBlock = new TrigonometryBlock("Floor");
floorBlock.operation = TrigonometryBlockOperations.Floor;
return floorBlock;
}
case "WorldMatrixBlock": {
let worldMatrixBlock = new InputBlock("World");
worldMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.World);
return worldMatrixBlock;
}
case "WorldViewMatrixBlock": {
let worldViewMatrixBlock = new InputBlock("World x View");
worldViewMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.WorldView);
return worldViewMatrixBlock;
}
case "WorldViewProjectionMatrixBlock": {
let worldViewProjectionMatrixBlock = new InputBlock("World x View x Projection");
worldViewProjectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.WorldViewProjection);
return worldViewProjectionMatrixBlock;
}
case "ViewMatrixBlock": {
let viewMatrixBlock = new InputBlock("View");
viewMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.View);
return viewMatrixBlock;
}
case "ViewProjectionMatrixBlock": {
let viewProjectionMatrixBlock = new InputBlock("View x Projection");
viewProjectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.ViewProjection);
let floorBlock = new TrigonometryBlock("Floor");
floorBlock.operation = TrigonometryBlockOperations.Floor;
return floorBlock;
}
case "WorldMatrixBlock": {
let worldMatrixBlock = new InputBlock("World");
worldMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.World);
return worldMatrixBlock;
}
case "WorldViewMatrixBlock": {
let worldViewMatrixBlock = new InputBlock("World x View");
worldViewMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.WorldView);
return worldViewMatrixBlock;
}
case "WorldViewProjectionMatrixBlock": {
let worldViewProjectionMatrixBlock = new InputBlock("World x View x Projection");
worldViewProjectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.WorldViewProjection);
return worldViewProjectionMatrixBlock;
}
case "ViewMatrixBlock": {
let viewMatrixBlock = new InputBlock("View");
viewMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.View);
return viewMatrixBlock;
}
case "ViewProjectionMatrixBlock": {
let viewProjectionMatrixBlock = new InputBlock("View x Projection");
viewProjectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.ViewProjection);
return viewProjectionMatrixBlock;
}
case "ProjectionMatrixBlock": {
let projectionMatrixBlock = new InputBlock("Projection");
projectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.Projection);
let roundBlock = new TrigonometryBlock("Round");
roundBlock.operation = TrigonometryBlockOperations.Round;
return roundBlock;
}
case "CeilingBlock": {
let ceilingBlock = new TrigonometryBlock("Ceiling");
ceilingBlock.operation = TrigonometryBlockOperations.Ceiling;
return ceilingBlock;
}
case "FloorBlock": {
let floorBlock = new TrigonometryBlock("Floor");
floorBlock.operation = TrigonometryBlockOperations.Floor;
return floorBlock;
}
case "WorldMatrixBlock": {
let worldMatrixBlock = new InputBlock("World");
worldMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.World);
return worldMatrixBlock;
}
case "WorldViewMatrixBlock": {
let worldViewMatrixBlock = new InputBlock("World x View");
worldViewMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.WorldView);
return worldViewMatrixBlock;
}
case "WorldViewProjectionMatrixBlock": {
let worldViewProjectionMatrixBlock = new InputBlock("World x View x Projection");
worldViewProjectionMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.WorldViewProjection);
return worldViewProjectionMatrixBlock;
}
case "ViewMatrixBlock": {
let viewMatrixBlock = new InputBlock("View");
viewMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.View);