diff --git a/Source/blockly/patches/GEN_GLSL.js b/Source/blockly/patches/GEN_GLSL.js index cd02a3f..3062aad 100644 --- a/Source/blockly/patches/GEN_GLSL.js +++ b/Source/blockly/patches/GEN_GLSL.js @@ -118,6 +118,7 @@ function updateGLSL(event) { if (type == "matrix_2x") type = "mat2"; if (type == "matrix_3x") type = "mat3"; if (type == "matrix_4x") type = "mat4"; + if (type == "texture3d") type = "sampler3D"; let appendance = ""; @@ -147,7 +148,6 @@ function updateGLSL(event) { penPlus.Generated_GLSL = penPlus.monacoEditor.getValue(); penPlus.dispatchEvent("onMainScriptCompiled"); } - penPlus.Generated_Frag = ""; penPlus.Generated_Vert = ""; diff --git a/Source/blockly/patches/extensionFormat.js b/Source/blockly/patches/extensionFormat.js index 31c2791..3ce3d3b 100644 --- a/Source/blockly/patches/extensionFormat.js +++ b/Source/blockly/patches/extensionFormat.js @@ -258,6 +258,7 @@ penPlus.penPlusExtension = class { if (type == "matrix_2x") type = "mat2"; if (type == "matrix_3x") type = "mat3"; if (type == "matrix_4x") type = "mat4"; + if (type == "texture3d") type = "sampler3D"; let scope = variable.name.split(" ")[0]; if (scope != "hat") return; @@ -265,7 +266,7 @@ penPlus.penPlusExtension = class { if (!variable.name.split(" ")[1]) return; //Types that don't have precision - if (variable.type == "texture" || variable.type == "cubemap" || variable.type == "int") returnedGLSL += `${type} ${variable.name.split(" ")[1]} = ${type}(1);\n`; + if (variable.type == "texture" || variable.type == "cubemap" || variable.type == "int" || variable.type == "sampler3D") returnedGLSL += `${type} ${variable.name.split(" ")[1]} = ${type}(1);\n`; else returnedGLSL += `highp ${type} ${variable.name.split(" ")[1]} = ${type}(1);\n`; }); diff --git a/Source/blocks/looks.js b/Source/blocks/looks.js index 5665d3a..690e9ba 100644 --- a/Source/blocks/looks.js +++ b/Source/blocks/looks.js @@ -5,7 +5,7 @@ getInfo() { penPlus.addBlockColorSet("texture_blocks", "#b464e7", "#a755cf", "#9a48c4"); penPlus.addBlockColorSet("cubemap_blocks", "#8672ff", "#7465d6", "#6657cb"); - penPlus.addBlockColorSet("3DTexture_blocks", "#967FD7", "#8771C4", "#7760B5"); + penPlus.addBlockColorSet("texture3d_blocks", "#967FD7", "#8771C4", "#7760B5"); return { name: "Looks", id: "looks", diff --git a/Source/blocks/variables.js b/Source/blocks/variables.js index 61ded5f..47a36c5 100644 --- a/Source/blocks/variables.js +++ b/Source/blocks/variables.js @@ -417,11 +417,7 @@ const variable = block.getFieldValue("VAR"); const variableName = variable.split(" ")[1]; - const variableType = variable.split(" ")[2]; - - if (variableType == "matrix_2x") variableType = "mat2"; - if (variableType == "matrix_3x") variableType = "mat3"; - if (variableType == "matrix_4x") variableType = "mat4"; + let variableType = variable.split(" ")[2]; const value = generator.valueToCode(block, "VALUE", Order.ATOMIC); @@ -431,6 +427,10 @@ block.setStyle(__colorVariableBlock(variableType)); + if (variableType == "matrix_2x") variableType = "mat2"; + if (variableType == "matrix_3x") variableType = "mat3"; + if (variableType == "matrix_4x") variableType = "mat4"; + return `${variableName} = ${variableType}(${value});\n` + nextBlockToCode(block, generator); } @@ -641,8 +641,8 @@ ${(penPlus.is300Version && penPlus.experimental) ? ` -
3D Texture
@@ -780,9 +780,9 @@ }; if ((penPlus.is300Version && penPlus.experimental)) { - variableTypeChangers.texture3D = document.getElementById("texture3D"); - variableTypeChangers.texture3D.onclick = () => { - cycleVariable("texture3D"); + variableTypeChangers.texture3d = document.getElementById("texture3d"); + variableTypeChangers.texture3d.onclick = () => { + cycleVariable("texture3d"); setScopeVisibilities(false, true, false, false, false); } } diff --git a/Source/css/syntaxHighlighting.css b/Source/css/syntaxHighlighting.css index f3f45f6..9571c49 100644 --- a/Source/css/syntaxHighlighting.css +++ b/Source/css/syntaxHighlighting.css @@ -30,6 +30,10 @@ color: var(--texture_blocks); } +.texture3d_Highlight { + color: var(--texture3d_blocks); +} + .cubemap_Highlight { color: var(--cubemap_blocks); } diff --git a/Source/editor/buttons/settings.js b/Source/editor/buttons/settings.js index b63cbc5..91b68c7 100644 --- a/Source/editor/buttons/settings.js +++ b/Source/editor/buttons/settings.js @@ -313,6 +313,14 @@