You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Improve shader editor templates to be more descriptive
This commit is contained in:
@@ -164,37 +164,64 @@ void ShaderCreateDialog::_create_new() {
|
|||||||
code += vformat("shader_type %s;\n", mode_menu->get_text().to_snake_case());
|
code += vformat("shader_type %s;\n", mode_menu->get_text().to_snake_case());
|
||||||
|
|
||||||
if (current_template == 0) { // Default template.
|
if (current_template == 0) { // Default template.
|
||||||
code += "\n";
|
|
||||||
switch (current_mode) {
|
switch (current_mode) {
|
||||||
case Shader::MODE_SPATIAL:
|
case Shader::MODE_SPATIAL:
|
||||||
code += "void fragment() {\n";
|
code += R"(
|
||||||
code += "\t// Place fragment code here.\n";
|
void vertex() {
|
||||||
code += "}\n";
|
// Called for every vertex the material is visible on.
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
// Called for every pixel the material is visible on.
|
||||||
|
}
|
||||||
|
|
||||||
|
void light() {
|
||||||
|
// Called for every pixel for every light affecting the material.
|
||||||
|
}
|
||||||
|
)";
|
||||||
break;
|
break;
|
||||||
case Shader::MODE_CANVAS_ITEM:
|
case Shader::MODE_CANVAS_ITEM:
|
||||||
code += "void fragment() {\n";
|
code += R"(
|
||||||
code += "\t// Place fragment code here.\n";
|
void vertex() {
|
||||||
code += "}\n";
|
// Called for every vertex the material is visible on.
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
// Called for every pixel the material is visible on.
|
||||||
|
}
|
||||||
|
|
||||||
|
void light() {
|
||||||
|
// Called for every pixel for every light affecting the CanvasItem.
|
||||||
|
}
|
||||||
|
)";
|
||||||
break;
|
break;
|
||||||
case Shader::MODE_PARTICLES:
|
case Shader::MODE_PARTICLES:
|
||||||
code += "void start() {\n";
|
code += R"(
|
||||||
code += "\t// Place start code here.\n";
|
void start() {
|
||||||
code += "}\n";
|
// Called when a particle is spawned.
|
||||||
code += "\n";
|
}
|
||||||
code += "void process() {\n";
|
|
||||||
code += "\t// Place process code here.\n";
|
void process() {
|
||||||
code += "}\n";
|
// Called every frame on existing particles (according to the Fixed FPS property).
|
||||||
|
}
|
||||||
|
)";
|
||||||
break;
|
break;
|
||||||
case Shader::MODE_SKY:
|
case Shader::MODE_SKY:
|
||||||
code += "void sky() {\n";
|
code += R"(
|
||||||
code += "\t// Place sky code here.\n";
|
void sky() {
|
||||||
code += "}\n";
|
// Called for every visible pixel in the sky background, as well as all pixels
|
||||||
|
// in the radiance cubemap.
|
||||||
|
}
|
||||||
|
)";
|
||||||
break;
|
break;
|
||||||
case Shader::MODE_FOG:
|
case Shader::MODE_FOG:
|
||||||
code += "void fog() {\n";
|
code += R"(
|
||||||
code += "\t// Place fog code here.\n";
|
void fog() {
|
||||||
code += "}\n";
|
// Called once for every froxel that is touched by an axis-aligned bounding box
|
||||||
break;
|
// of the associated FogVolume. This means that froxels that just barely touch
|
||||||
|
// a given FogVolume will still be used.
|
||||||
|
}
|
||||||
|
)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text_shader->set_code(code.as_string());
|
text_shader->set_code(code.as_string());
|
||||||
|
|||||||
Reference in New Issue
Block a user