|
@@ -9,6 +9,7 @@ import { NodeMaterialSystemValues } from '../../Enums/nodeMaterialSystemValues';
|
|
import { InputBlock } from '../Input/inputBlock';
|
|
import { InputBlock } from '../Input/inputBlock';
|
|
import { _TypeStore } from '../../../../Misc/typeStore';
|
|
import { _TypeStore } from '../../../../Misc/typeStore';
|
|
import { SubMesh } from '../../../../Meshes/subMesh';
|
|
import { SubMesh } from '../../../../Meshes/subMesh';
|
|
|
|
+import { Engine } from "../../../../Engines";
|
|
|
|
|
|
/**
|
|
/**
|
|
* Block used to add support for instances
|
|
* Block used to add support for instances
|
|
@@ -175,7 +176,11 @@ export class InstancesBlock extends NodeMaterialBlock {
|
|
state.compilationString += `#ifdef THIN_INSTANCES\r\n`;
|
|
state.compilationString += `#ifdef THIN_INSTANCES\r\n`;
|
|
state.compilationString += `${output.associatedVariableName} = ${this.world.associatedVariableName} * ${output.associatedVariableName};\r\n`;
|
|
state.compilationString += `${output.associatedVariableName} = ${this.world.associatedVariableName} * ${output.associatedVariableName};\r\n`;
|
|
state.compilationString += `#endif\r\n`;
|
|
state.compilationString += `#endif\r\n`;
|
|
- state.compilationString += this._declareOutput(instanceID, state) + ` = float(gl_InstanceID);\r\n`;
|
|
|
|
|
|
+ if (Engine.LastCreatedEngine && !Engine.LastCreatedEngine._caps.canUseGLInstanceID) {
|
|
|
|
+ state.compilationString += this._declareOutput(instanceID, state) + ` = 0.0;\r\n`;
|
|
|
|
+ } else {
|
|
|
|
+ state.compilationString += this._declareOutput(instanceID, state) + ` = float(gl_InstanceID);\r\n`;
|
|
|
|
+ }
|
|
state.compilationString += `#else\r\n`;
|
|
state.compilationString += `#else\r\n`;
|
|
state.compilationString += this._declareOutput(output, state) + ` = ${this.world.associatedVariableName};\r\n`;
|
|
state.compilationString += this._declareOutput(output, state) + ` = ${this.world.associatedVariableName};\r\n`;
|
|
state.compilationString += this._declareOutput(instanceID, state) + ` = 0.0;\r\n`;
|
|
state.compilationString += this._declareOutput(instanceID, state) + ` = 0.0;\r\n`;
|