|
@@ -19,7 +19,8 @@ export class ColorMergerBlock extends NodeMaterialBlock {
|
|
|
this.registerInput("r", NodeMaterialBlockConnectionPointTypes.Float, true);
|
|
|
this.registerInput("g", NodeMaterialBlockConnectionPointTypes.Float, true);
|
|
|
this.registerInput("b", NodeMaterialBlockConnectionPointTypes.Float, true);
|
|
|
- this.registerInput("a", NodeMaterialBlockConnectionPointTypes.Float, true);
|
|
|
+ this.registerInput("a", NodeMaterialBlockConnectionPointTypes.Float, true);
|
|
|
+ this.registerInput("rgb ", NodeMaterialBlockConnectionPointTypes.Color3, true);
|
|
|
|
|
|
this.registerOutput("rgba", NodeMaterialBlockConnectionPointTypes.Color4);
|
|
|
this.registerOutput("rgb", NodeMaterialBlockConnectionPointTypes.Color3);
|
|
@@ -62,6 +63,13 @@ export class ColorMergerBlock extends NodeMaterialBlock {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Gets the rgb component (input)
|
|
|
+ */
|
|
|
+ public get rgbIn(): NodeMaterialConnectionPoint {
|
|
|
+ return this._inputs[4];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Gets the rgba component (output)
|
|
|
*/
|
|
|
public get rgba(): NodeMaterialConnectionPoint {
|
|
@@ -71,7 +79,7 @@ export class ColorMergerBlock extends NodeMaterialBlock {
|
|
|
/**
|
|
|
* Gets the rgb component (output)
|
|
|
*/
|
|
|
- public get rgb(): NodeMaterialConnectionPoint {
|
|
|
+ public get rgbOut(): NodeMaterialConnectionPoint {
|
|
|
return this._outputs[1];
|
|
|
}
|
|
|
|
|
@@ -82,14 +90,23 @@ export class ColorMergerBlock extends NodeMaterialBlock {
|
|
|
let gInput = this.g;
|
|
|
let bInput = this.b;
|
|
|
let aInput = this.a;
|
|
|
+ let rgbInput = this.rgbIn;
|
|
|
|
|
|
let color4Output = this._outputs[0];
|
|
|
let color3Output = this._outputs[1];
|
|
|
|
|
|
- if (color4Output.hasEndpoints) {
|
|
|
- state.compilationString += this._declareOutput(color4Output, state) + ` = vec4(${rInput.isConnected ? this._writeVariable(rInput) : "0.0"}, ${gInput.isConnected ? this._writeVariable(gInput) : "0.0"}, ${bInput.isConnected ? this._writeVariable(bInput) : "0.0"}, ${aInput.isConnected ? this._writeVariable(aInput) : "0.0"});\r\n`;
|
|
|
- } else if (color3Output.hasEndpoints) {
|
|
|
- state.compilationString += this._declareOutput(color3Output, state) + ` = vec3(${rInput.isConnected ? this._writeVariable(rInput) : "0.0"}, ${gInput.isConnected ? this._writeVariable(gInput) : "0.0"}, ${bInput.isConnected ? this._writeVariable(bInput) : "0.0"});\r\n`;
|
|
|
+ if (rgbInput.isConnected) {
|
|
|
+ if (color4Output.hasEndpoints) {
|
|
|
+ state.compilationString += this._declareOutput(color4Output, state) + ` = vec4(${rgbInput.associatedVariableName}, ${aInput.isConnected ? this._writeVariable(aInput) : "0.0"});\r\n`;
|
|
|
+ } else if (color3Output.hasEndpoints) {
|
|
|
+ state.compilationString += this._declareOutput(color3Output, state) + ` = ${rgbInput.associatedVariableName};\r\n`;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (color4Output.hasEndpoints) {
|
|
|
+ state.compilationString += this._declareOutput(color4Output, state) + ` = vec4(${rInput.isConnected ? this._writeVariable(rInput) : "0.0"}, ${gInput.isConnected ? this._writeVariable(gInput) : "0.0"}, ${bInput.isConnected ? this._writeVariable(bInput) : "0.0"}, ${aInput.isConnected ? this._writeVariable(aInput) : "0.0"});\r\n`;
|
|
|
+ } else if (color3Output.hasEndpoints) {
|
|
|
+ state.compilationString += this._declareOutput(color3Output, state) + ` = vec3(${rInput.isConnected ? this._writeVariable(rInput) : "0.0"}, ${gInput.isConnected ? this._writeVariable(gInput) : "0.0"}, ${bInput.isConnected ? this._writeVariable(bInput) : "0.0"});\r\n`;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return this;
|