[Add] All in one shader

This commit is contained in:
2026-02-23 22:01:07 +07:00
parent ec0aa86ac2
commit 4f942cd7c0
806 changed files with 401510 additions and 33 deletions
@@ -0,0 +1,38 @@
using UnityEditor;
using UnityEngine;
namespace AllIn13DShader
{
public class Vector3Drawer : MaterialPropertyDrawer
{
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
{
AllIn1ShaderPropertyType propType = EditorUtils.GetShaderTypeByMaterialProperty(prop);
if (propType != AllIn1ShaderPropertyType.Vector) {
EditorGUI.LabelField(position, label, "Vector3Drawer only works with Vector properties.");
return;
}
EditorGUI.BeginChangeCheck();
// Get current vector4 value
Vector4 vec4Value = prop.vectorValue;
// Convert to Vector3 for editing
Vector3 vec3Value = new Vector3(vec4Value.x, vec4Value.y, vec4Value.z);
// Create property field for Vector3
vec3Value = EditorGUI.Vector3Field(position, label, vec3Value);
if(EditorGUI.EndChangeCheck()) {
// Convert back to Vector4, preserving the w component
prop.vectorValue = new Vector4(vec3Value.x, vec3Value.y, vec3Value.z, vec4Value.w);
}
}
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
{
return EditorGUIUtility.singleLineHeight;
}
}
}