2
0
Эх сурвалжийг харах

Fixed possible normal map Z reconstruction overflow.
Fixed font size inconsistencies in the editor node window. Increased attribute name font size.
Merged Light's cascade split attributes into one Vector4 attribute.
Show local ID's in the editor in a more readable way.

Lasse Öörni 14 жил өмнө
parent
commit
7c42215d98

+ 18 - 13
Bin/Data/Scripts/Editor/EditorNodeWindow.as

@@ -4,6 +4,8 @@ Window@ nodeWindow;
 
 const uint MIN_NODE_ATTRIBUTES = 4;
 const uint MAX_NODE_ATTRIBUTES = 8;
+const int ATTRNAME_WIDTH = 135;
+const int ATTR_HEIGHT = 19;
 
 class ResourcePicker
 {
@@ -118,10 +120,12 @@ void UpdateNodeWindow()
         nodeTitle.text = "No node";
     else
     {
-        String localText;
+        String idStr;
         if (selectedNode.id >= FIRST_LOCAL_ID)
-            localText = ", Local";
-        nodeTitle.text = selectedNode.typeName + " (ID " + String(selectedNode.id) + localText + ")";
+            idStr = "Local ID " + String(selectedNode.id - FIRST_LOCAL_ID);
+        else
+            idStr = "ID " + String(selectedNode.id);
+        nodeTitle.text = selectedNode.typeName + " (" + idStr + ")";
     }
 
     if (selectedComponent is null)
@@ -165,7 +169,7 @@ void UpdateAttributes(Serializable@ serializable, ListView@ list, bool fullUpdat
         if (list.name == "NodeAttributeList")
         {
             uint maxAttrs = Clamp(count, MIN_NODE_ATTRIBUTES, MAX_NODE_ATTRIBUTES);
-            list.SetFixedHeight(maxAttrs * 18 + 2);
+            list.SetFixedHeight(maxAttrs * ATTR_HEIGHT + 2);
         }
     }
 
@@ -258,7 +262,7 @@ UIElement@ CreateAttributeEditorParentTitle(ListView@ list, String name)
 {
     UIElement@ editorParent = UIElement();
     editorParent.SetLayout(LM_HORIZONTAL);
-    editorParent.SetFixedHeight(18);
+    editorParent.SetFixedHeight(ATTR_HEIGHT);
     list.AddItem(editorParent);
 
     Text@ attrNameText = Text();
@@ -275,7 +279,7 @@ UIElement@ CreateAttributeEditorParent(ListView@ list, String name, uint index,
     editorParent.vars["Index"] = index;
     editorParent.vars["SubIndex"] = subIndex;
     editorParent.SetLayout(LM_HORIZONTAL);
-    editorParent.SetFixedHeight(18);
+    editorParent.SetFixedHeight(ATTR_HEIGHT);
     list.AddItem(editorParent);
 
     if (!name.empty)
@@ -283,7 +287,7 @@ UIElement@ CreateAttributeEditorParent(ListView@ list, String name, uint index,
         Text@ attrNameText = Text();
         attrNameText.SetStyle(uiStyle, "EditorAttributeText");
         attrNameText.text = name;
-        attrNameText.SetFixedWidth(125);
+        attrNameText.SetFixedWidth(ATTRNAME_WIDTH);
         editorParent.AddChild(attrNameText);
     }
 
@@ -294,7 +298,7 @@ LineEdit@ CreateAttributeLineEdit(UIElement@ parent, Serializable@ serializable,
 {
     LineEdit@ attrEdit = LineEdit();
     attrEdit.SetStyle(uiStyle, "EditorAttributeEdit");
-    attrEdit.SetFixedHeight(16);
+    attrEdit.SetFixedHeight(ATTR_HEIGHT - 2);
     attrEdit.vars["Index"] = index;
     attrEdit.vars["SubIndex"] = subIndex;
     SetAttributeEditorID(attrEdit, serializable);
@@ -400,16 +404,17 @@ UIElement@ CreateAttributeEditor(ListView@ list, Serializable@ serializable, con
         {
             DropDownList@ attrEdit = DropDownList();
             attrEdit.style = uiStyle;
-            attrEdit.SetFixedHeight(16);
+            attrEdit.SetFixedHeight(ATTR_HEIGHT - 2);
             attrEdit.resizePopup = true;
             attrEdit.vars["Index"] = index;
             attrEdit.vars["SubIndex"] = subIndex;
+            attrEdit.SetLayout(LM_HORIZONTAL, 0, IntRect(4, 1, 4, 1));
             SetAttributeEditorID(attrEdit, serializable);
 
             for (uint i = 0; i < enumNames.length; ++i)
             {
                 // Hack: check for certain internal enums and break
-                if (enumNames[i] == "Master" || enumNames[i] == "SplitPoint")
+                if (enumNames[i] == "Master")
                     break;
                 Text@ choice = Text();
                 choice.SetStyle(uiStyle, "EditorEnumAttributeText");
@@ -431,7 +436,7 @@ UIElement@ CreateAttributeEditor(ListView@ list, Serializable@ serializable, con
         parent = CreateAttributeEditorParent(list, "", index, subIndex);
 
         UIElement@ spacer = UIElement();
-        spacer.SetFixedSize(10, 16);
+        spacer.SetFixedSize(10, ATTR_HEIGHT - 2);
         parent.AddChild(spacer);
 
         LineEdit@ attrEdit = CreateAttributeLineEdit(parent, serializable, index, subIndex);
@@ -439,12 +444,12 @@ UIElement@ CreateAttributeEditor(ListView@ list, Serializable@ serializable, con
         SubscribeToEvent(attrEdit, "TextFinished", "EditAttribute");
 
         UIElement@ spacer2 = UIElement();
-        spacer2.SetFixedSize(4, 16);
+        spacer2.SetFixedSize(4, ATTR_HEIGHT - 2);
         parent.AddChild(spacer2);
 
         Button@ pickButton = Button();
         pickButton.style = uiStyle;
-        pickButton.SetFixedSize(36, 16);
+        pickButton.SetFixedSize(36, ATTR_HEIGHT - 2);
         pickButton.vars["Index"] = index;
         pickButton.vars["SubIndex"] = subIndex;
         SetAttributeEditorID(pickButton, serializable);

+ 7 - 5
Bin/Data/Scripts/Editor/EditorSceneWindow.as

@@ -334,18 +334,20 @@ int GetNodeIndent(Node@ node)
 String GetNodeTitle(Node@ node, int indent)
 {
     String indentStr;
-    String localStr;
     indentStr.Resize(indent);
     for (int i = 0; i < indent; ++i)
         indentStr[i] = ' ';
 
+    String idStr;
     if (node.id >= FIRST_LOCAL_ID)
-        localStr = ", Local";
+        idStr = "Local " + String(node.id - FIRST_LOCAL_ID);
+    else
+        idStr = String(node.id);
 
     if (node.name.empty)
-        return indentStr + node.typeName + " (" + node.id + localStr + ")";
+        return indentStr + node.typeName + " (" + idStr + ")";
     else
-        return indentStr + node.name + " (" + node.id + localStr + ")";
+        return indentStr + node.name + " (" + idStr + ")";
 }
 
 String GetComponentTitle(Component@ component, int indent)
@@ -355,7 +357,7 @@ String GetComponentTitle(Component@ component, int indent)
     indentStr.Resize(indent);
     for (int i = 0; i < indent; ++i)
         indentStr[i] = ' ';
-    
+
     if (component.id >= FIRST_LOCAL_ID)
         localStr = " (Local)";
 

+ 2 - 2
Bin/Data/UI/DefaultStyle.xml

@@ -385,10 +385,10 @@
         <font name="Fonts/Anonymous Pro.ttf" size="11" />
     </element>
     <element type="EditorAttributeText">
-        <font name="Fonts/BlueHighway.ttf" size="11" />
+        <font name="Fonts/BlueHighway.ttf" size="12" />
     </element>
     <element type="EditorEnumAttributeText">
-        <font name="Fonts/BlueHighway.ttf" size="11" />
+        <font name="Fonts/BlueHighway.ttf" size="12" />
         <hovercolor value="0.45 0.70 0.45" />
     </element>
     <element type="EditorAttributeEdit">

+ 6 - 6
Bin/Data/UI/EditorNodeWindow.xml

@@ -4,7 +4,7 @@
     <resizeborder value="6 6 6 6" />
     <layout mode="vertical" spacing="4" border="6 6 6 6" />
     <element>
-        <fixedheight value="16" />
+        <fixedheight value="17" />
         <layout mode="horizontal" />
         <element type="Text" name="WindowTitle">
             <text value="Node / component edit" />
@@ -15,7 +15,7 @@
         <fixedheight value="4" />
     </element>
     <element type="Text" name="NodeTitle">
-        <fixedheight value="16" />
+        <fixedheight value="17" />
     </element>
     <element type="ListView" name="NodeAttributeList">
         <highlight value="always" />
@@ -25,7 +25,7 @@
         </horizontalscrollbar>
     </element>
     <element>
-        <fixedheight value="16" />
+        <fixedheight value="17" />
         <layout mode="horizontal" spacing="4" />
         <element type="LineEdit" name="VarNameEdit">
         </element>
@@ -48,7 +48,7 @@
             <text value="Color" />
         </element>
         <element type="DropDownList" name="NewVarDropDown">
-            <fixedsize value="50 16" />
+            <fixedsize value="50 17" />
             <layout mode="free" />
             <placeholder>
                 <visible enable="false" />
@@ -68,7 +68,7 @@
             <popupitem name="VarColor" />
         </element>
         <element type="Button" name="DeleteVarButton">
-            <fixedsize value="50 16" />
+            <fixedsize value="50 17" />
             <element type="Text">
                 <text value="Del" />
                 <alignment horizontal="center" vertical="center" />
@@ -79,7 +79,7 @@
         <fixedheight value="4" />
     </element>
     <element type="Text" name="ComponentTitle">
-        <fixedheight value="16" />
+        <fixedheight value="17" />
     </element>
     <element type="ListView" name="ComponentAttributeList">
         <highlight value="always" />

+ 2 - 5
Engine/Graphics/Light.cpp

@@ -122,11 +122,8 @@ void Light::RegisterObject(Context* context)
     ATTRIBUTE(Light, VAR_BOOL, "Focus To Scene", shadowFocus_.focus_, true, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_BOOL, "Non-uniform View", shadowFocus_.nonUniform_, true, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_BOOL, "Auto-Reduce Size", shadowFocus_.autoSize_, true, AM_DEFAULT);
-    ATTRIBUTE(Light, VAR_FLOAT, "CSM Split 1 End", shadowCascade_.splits_[0], M_LARGE_VALUE, AM_DEFAULT);
-    ATTRIBUTE(Light, VAR_FLOAT, "CSM Split 2 End", shadowCascade_.splits_[1], M_LARGE_VALUE, AM_DEFAULT);
-    ATTRIBUTE(Light, VAR_FLOAT, "CSM Split 3 End", shadowCascade_.splits_[2], M_LARGE_VALUE, AM_DEFAULT);
-    ATTRIBUTE(Light, VAR_FLOAT, "CSM Split 4 End", shadowCascade_.splits_[3], M_LARGE_VALUE, AM_DEFAULT);
-    ATTRIBUTE(Light, VAR_FLOAT, "CSM Fade Start", shadowCascade_.fadeStart_, M_LARGE_VALUE, AM_DEFAULT);
+    ATTRIBUTE(Light, VAR_VECTOR4, "CSM Splits", shadowCascade_.splits_, Vector4(M_LARGE_VALUE, 0.0f, 0.0f, 0.0f), AM_DEFAULT);
+    ATTRIBUTE(Light, VAR_FLOAT, "CSM Fade Start", shadowCascade_.fadeStart_, DEFAULT_SHADOWFADESTART, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_FLOAT, "View Size Quantize", shadowFocus_.quantize_, DEFAULT_SHADOWQUANTIZE, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_FLOAT, "View Size Minimum", shadowFocus_.minView_, DEFAULT_SHADOWMINVIEW, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_FLOAT, "Depth Constant Bias", shadowBias_.constantBias_, DEFAULT_CONSTANTBIAS, AM_DEFAULT);

+ 1 - 1
Engine/Physics/RigidBody.cpp

@@ -75,10 +75,10 @@ void RigidBody::RegisterObject(Context* context)
     REF_ACCESSOR_ATTRIBUTE(RigidBody, VAR_VECTOR3, "Physics Position", GetPosition, SetPosition, Vector3, Vector3::ZERO, AM_FILE | AM_NOEDIT);
     REF_ACCESSOR_ATTRIBUTE(RigidBody, VAR_QUATERNION, "Physics Rotation", GetRotation, SetRotation, Quaternion, Quaternion::IDENTITY, AM_FILE | AM_NOEDIT);
     REF_ACCESSOR_ATTRIBUTE(RigidBody, VAR_VECTOR3, "Lin Velocity", GetLinearVelocity, SetLinearVelocity, Vector3, Vector3::ZERO, AM_DEFAULT | AM_LATESTDATA);
+    REF_ACCESSOR_ATTRIBUTE(RigidBody, VAR_VECTOR3, "Ang Velocity", GetAngularVelocity, SetAngularVelocity, Vector3, Vector3::ZERO, AM_FILE);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Lin Rest Threshold", GetLinearRestThreshold, SetLinearRestThreshold, float, 0.01f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Lin Damp Threshold", GetLinearDampingThreshold, SetLinearDampingThreshold, float, 0.01f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Lin Damp Scale", GetLinearDampingScale, SetLinearDampingScale, float, 0.0f, AM_DEFAULT);
-    REF_ACCESSOR_ATTRIBUTE(RigidBody, VAR_VECTOR3, "Ang Velocity", GetAngularVelocity, SetAngularVelocity, Vector3, Vector3::ZERO, AM_FILE);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Ang Rest Threshold", GetAngularRestThreshold, SetAngularRestThreshold, float, 0.01f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Ang Damp Threshold", GetAngularDampingThreshold, SetAngularDampingThreshold, float, 0.01f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Ang Damp Scale", GetAngularDampingScale, SetAngularDampingScale, float, 0.0f, AM_DEFAULT);

+ 1 - 1
SourceAssets/GLSLShaders/Samplers.frag

@@ -17,6 +17,6 @@ vec3 DecodeNormal(vec4 normalInput)
 {
     vec3 normal;
     normal.xy = normalInput.ag * 2.0 - 1.0;
-    normal.z = max(sqrt(1.0 - dot(normal.xy, normal.xy)), 0.0);
+    normal.z = sqrt(max(1.0 - dot(normal.xy, normal.xy), 0.0));
     return normal;
 }

+ 1 - 1
SourceAssets/HLSLShaders/Samplers.hlsl

@@ -42,6 +42,6 @@ float3 DecodeNormal(float4 normalInput)
 {
     float3 normal;
     normal.xy = normalInput.ag * 2.0 - 1.0;
-    normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
+    normal.z = sqrt(max(1.0 - dot(normal.xy, normal.xy), 0.0));
     return normal;
 }