Browse Source

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

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

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

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

@@ -4,7 +4,7 @@
     <resizeborder value="6 6 6 6" />
     <resizeborder value="6 6 6 6" />
     <layout mode="vertical" spacing="4" border="6 6 6 6" />
     <layout mode="vertical" spacing="4" border="6 6 6 6" />
     <element>
     <element>
-        <fixedheight value="16" />
+        <fixedheight value="17" />
         <layout mode="horizontal" />
         <layout mode="horizontal" />
         <element type="Text" name="WindowTitle">
         <element type="Text" name="WindowTitle">
             <text value="Node / component edit" />
             <text value="Node / component edit" />
@@ -15,7 +15,7 @@
         <fixedheight value="4" />
         <fixedheight value="4" />
     </element>
     </element>
     <element type="Text" name="NodeTitle">
     <element type="Text" name="NodeTitle">
-        <fixedheight value="16" />
+        <fixedheight value="17" />
     </element>
     </element>
     <element type="ListView" name="NodeAttributeList">
     <element type="ListView" name="NodeAttributeList">
         <highlight value="always" />
         <highlight value="always" />
@@ -25,7 +25,7 @@
         </horizontalscrollbar>
         </horizontalscrollbar>
     </element>
     </element>
     <element>
     <element>
-        <fixedheight value="16" />
+        <fixedheight value="17" />
         <layout mode="horizontal" spacing="4" />
         <layout mode="horizontal" spacing="4" />
         <element type="LineEdit" name="VarNameEdit">
         <element type="LineEdit" name="VarNameEdit">
         </element>
         </element>
@@ -48,7 +48,7 @@
             <text value="Color" />
             <text value="Color" />
         </element>
         </element>
         <element type="DropDownList" name="NewVarDropDown">
         <element type="DropDownList" name="NewVarDropDown">
-            <fixedsize value="50 16" />
+            <fixedsize value="50 17" />
             <layout mode="free" />
             <layout mode="free" />
             <placeholder>
             <placeholder>
                 <visible enable="false" />
                 <visible enable="false" />
@@ -68,7 +68,7 @@
             <popupitem name="VarColor" />
             <popupitem name="VarColor" />
         </element>
         </element>
         <element type="Button" name="DeleteVarButton">
         <element type="Button" name="DeleteVarButton">
-            <fixedsize value="50 16" />
+            <fixedsize value="50 17" />
             <element type="Text">
             <element type="Text">
                 <text value="Del" />
                 <text value="Del" />
                 <alignment horizontal="center" vertical="center" />
                 <alignment horizontal="center" vertical="center" />
@@ -79,7 +79,7 @@
         <fixedheight value="4" />
         <fixedheight value="4" />
     </element>
     </element>
     <element type="Text" name="ComponentTitle">
     <element type="Text" name="ComponentTitle">
-        <fixedheight value="16" />
+        <fixedheight value="17" />
     </element>
     </element>
     <element type="ListView" name="ComponentAttributeList">
     <element type="ListView" name="ComponentAttributeList">
         <highlight value="always" />
         <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, "Focus To Scene", shadowFocus_.focus_, true, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_BOOL, "Non-uniform View", shadowFocus_.nonUniform_, 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_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 Quantize", shadowFocus_.quantize_, DEFAULT_SHADOWQUANTIZE, AM_DEFAULT);
     ATTRIBUTE(Light, VAR_FLOAT, "View Size Minimum", shadowFocus_.minView_, DEFAULT_SHADOWMINVIEW, 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);
     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_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_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, "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 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 Threshold", GetLinearDampingThreshold, SetLinearDampingThreshold, float, 0.01f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Lin Damp Scale", GetLinearDampingScale, SetLinearDampingScale, float, 0.0f, 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 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 Threshold", GetAngularDampingThreshold, SetAngularDampingThreshold, float, 0.01f, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(RigidBody, VAR_FLOAT, "Ang Damp Scale", GetAngularDampingScale, SetAngularDampingScale, float, 0.0f, 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;
     vec3 normal;
     normal.xy = normalInput.ag * 2.0 - 1.0;
     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;
     return normal;
 }
 }

+ 1 - 1
SourceAssets/HLSLShaders/Samplers.hlsl

@@ -42,6 +42,6 @@ float3 DecodeNormal(float4 normalInput)
 {
 {
     float3 normal;
     float3 normal;
     normal.xy = normalInput.ag * 2.0 - 1.0;
     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;
     return normal;
 }
 }