|
@@ -47,7 +47,7 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
|
|
public constructor(name: string) {
|
|
public constructor(name: string) {
|
|
super(name, NodeMaterialBlockTargets.VertexAndFragment);
|
|
super(name, NodeMaterialBlockTargets.VertexAndFragment);
|
|
|
|
|
|
- this._isUnique = true;
|
|
|
|
|
|
+ this._isUnique = false;
|
|
|
|
|
|
this.registerInput("uv", NodeMaterialBlockConnectionPointTypes.Vector2, false, NodeMaterialBlockTargets.VertexAndFragment);
|
|
this.registerInput("uv", NodeMaterialBlockConnectionPointTypes.Vector2, false, NodeMaterialBlockTargets.VertexAndFragment);
|
|
|
|
|
|
@@ -61,7 +61,7 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
|
|
this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector3);
|
|
this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector4);
|
|
this._inputs[0].acceptedConnectionPointTypes.push(NodeMaterialBlockConnectionPointTypes.Vector4);
|
|
|
|
|
|
- this._inputs[0]._prioritizeVertex = true;
|
|
|
|
|
|
+ this._inputs[0]._prioritizeVertex = false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -130,8 +130,6 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
|
|
}
|
|
}
|
|
|
|
|
|
public get target() {
|
|
public get target() {
|
|
- // TextureBlock has a special optimizations for uvs that come from the vertex shaders as they can be packed into a single varyings.
|
|
|
|
- // But we need to detect uvs coming from fragment then
|
|
|
|
if (!this.uv.isConnected) {
|
|
if (!this.uv.isConnected) {
|
|
return NodeMaterialBlockTargets.VertexAndFragment;
|
|
return NodeMaterialBlockTargets.VertexAndFragment;
|
|
}
|
|
}
|
|
@@ -140,32 +138,7 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
|
|
return NodeMaterialBlockTargets.VertexAndFragment;
|
|
return NodeMaterialBlockTargets.VertexAndFragment;
|
|
}
|
|
}
|
|
|
|
|
|
- let parent = this.uv.connectedPoint;
|
|
|
|
-
|
|
|
|
- while (parent) {
|
|
|
|
- if (parent.target === NodeMaterialBlockTargets.Fragment) {
|
|
|
|
- return NodeMaterialBlockTargets.Fragment;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (parent.target === NodeMaterialBlockTargets.Vertex) {
|
|
|
|
- return NodeMaterialBlockTargets.VertexAndFragment;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (parent.target === NodeMaterialBlockTargets.Neutral || parent.target === NodeMaterialBlockTargets.VertexAndFragment) {
|
|
|
|
- let parentBlock = parent.ownerBlock;
|
|
|
|
-
|
|
|
|
- parent = null;
|
|
|
|
- for (var input of parentBlock.inputs) {
|
|
|
|
- if (input.connectedPoint) {
|
|
|
|
- parent = input.connectedPoint;
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return NodeMaterialBlockTargets.VertexAndFragment;
|
|
|
|
|
|
+ return NodeMaterialBlockTargets.Fragment;
|
|
}
|
|
}
|
|
|
|
|
|
public prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {
|
|
public prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {
|
|
@@ -261,18 +234,21 @@ export class CurrentScreenBlock extends NodeMaterialBlock {
|
|
protected _buildBlock(state: NodeMaterialBuildState) {
|
|
protected _buildBlock(state: NodeMaterialBuildState) {
|
|
super._buildBlock(state);
|
|
super._buildBlock(state);
|
|
|
|
|
|
- if (state.target === NodeMaterialBlockTargets.Vertex) {
|
|
|
|
- this._tempTextureRead = state._getFreeVariableName("tempTextureRead");
|
|
|
|
-
|
|
|
|
- state._emit2DSampler(this._samplerName);
|
|
|
|
|
|
+ this._tempTextureRead = state._getFreeVariableName("tempTextureRead");
|
|
|
|
|
|
|
|
+ if (state.sharedData.blockingBlocks.indexOf(this) < 0) {
|
|
state.sharedData.blockingBlocks.push(this);
|
|
state.sharedData.blockingBlocks.push(this);
|
|
|
|
+ }
|
|
|
|
+ if (state.sharedData.textureBlocks.indexOf(this) < 0) {
|
|
state.sharedData.textureBlocks.push(this);
|
|
state.sharedData.textureBlocks.push(this);
|
|
|
|
+ }
|
|
|
|
+ if (state.sharedData.blocksWithDefines.indexOf(this) < 0) {
|
|
state.sharedData.blocksWithDefines.push(this);
|
|
state.sharedData.blocksWithDefines.push(this);
|
|
}
|
|
}
|
|
|
|
|
|
if (state.target !== NodeMaterialBlockTargets.Fragment) {
|
|
if (state.target !== NodeMaterialBlockTargets.Fragment) {
|
|
// Vertex
|
|
// Vertex
|
|
|
|
+ state._emit2DSampler(this._samplerName);
|
|
this._injectVertexCode(state);
|
|
this._injectVertexCode(state);
|
|
return;
|
|
return;
|
|
}
|
|
}
|