Răsfoiți Sursa

Changed controls in TestScene.as & TestSceneOld.as to not require the middle mouse button for adding decals.

Lasse Öörni 13 ani în urmă
părinte
comite
2d8f47618f

+ 2 - 2
Bin/Data/Scripts/TestScene.as

@@ -394,7 +394,7 @@ void HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
         ui.cursor.visible = false;
 
     // Test creating a new physics object
-    if (button == MOUSEB_LEFT && ui.GetElementAt(ui.cursorPosition, true) is null && ui.focusElement is null)
+    if (button == MOUSEB_LEFT && !input.qualifierDown[QUAL_SHIFT] && ui.GetElementAt(ui.cursorPosition, true) is null && ui.focusElement is null)
     {
         VariantMap eventData;
         eventData["Pos"] = cameraNode.position;
@@ -465,7 +465,7 @@ void HandlePostRenderUpdate()
             testScene.debugRenderer.AddBoundingBox(BoundingBox(rayHitPos + Vector3(-0.01, -0.01, -0.01), rayHitPos +
                 Vector3(0.01, 0.01, 0.01)), Color(1.0, 1.0, 1.0), true);
 
-            if (input.mouseButtonPress[MOUSEB_MIDDLE])
+            if (input.mouseButtonPress[MOUSEB_LEFT] && input.qualifierDown[QUAL_SHIFT] && ui.GetElementAt(ui.cursorPosition, true) is null && ui.focusElement is null)
             {
                 DecalSet@ decal = result.drawable.node.GetComponent("DecalSet");
                 if (decal is null)

+ 3 - 3
Bin/Data/Scripts/TestSceneOld.as

@@ -500,11 +500,11 @@ void HandleMouseButtonDown(StringHash eventType, VariantMap& eventData)
         ui.cursor.visible = false;
 
     // Test creating a new physics object
-    if (button == MOUSEB_LEFT && ui.GetElementAt(ui.cursorPosition, true) is null && ui.focusElement is null)
+    if (button == MOUSEB_LEFT && !input.qualifierDown(QUAL_SHIFT) && ui.GetElementAt(ui.cursorPosition, true) is null && ui.focusElement is null)
     {
         Vector3 position = eventData["Pos"].GetVector3();
         Quaternion rotation = eventData["Rot"].GetQuaternion();
-    
+
         Node@ newNode = testScene.CreateChild();
         newNode.position = cameraNode.position;
         newNode.rotation = cameraNode.rotation;
@@ -555,7 +555,7 @@ void HandlePostRenderUpdate()
             testScene.debugRenderer.AddBoundingBox(BoundingBox(rayHitPos + Vector3(-0.01, -0.01, -0.01), rayHitPos +
                 Vector3(0.01, 0.01, 0.01)), Color(1.0, 1.0, 1.0), true);
 
-            if (input.mouseButtonPress[MOUSEB_MIDDLE])
+            if (input.mouseButtonPress[MOUSEB_LEFT] && input.qualifierDown[QUAL_SHIFT] && ui.GetElementAt(ui.cursorPosition, true) is null && ui.focusElement is null)
             {
                 DecalSet@ decal = result.drawable.node.GetComponent("DecalSet");
                 if (decal is null)

+ 1 - 1
Docs/GettingStarted.dox

@@ -95,7 +95,7 @@ Key and mouse controls:
 WSAD        Move
 Left mouse  Create a new physics object; characters will ragdoll when hit
 Right mouse Hold and move mouse to rotate view
-Mid mouse   Paint a decal into the mouse cursor hit location
+Shift+LMB   Paint a decal into the mouse cursor hit location
 Space       Toggle debug geometry
 F1          Toggle AngelScript console
 F5          Save scene

+ 8 - 1
Engine/Graphics/DecalSet.cpp

@@ -388,13 +388,20 @@ bool DecalSet::AddDecal(Drawable* target, const Vector3& worldPosition, const Qu
         return true;
     }
     
-    if (newDecal.vertices_.Size() > maxVertices_ || newDecal.indices_.Size() > maxIndices_)
+    if (newDecal.vertices_.Size() > maxVertices_)
     {
         LOGWARNING("Can not add decal, vertex count " + String(newDecal.vertices_.Size()) + " exceeds maximum " +
             String(maxVertices_));
         decals_.Pop();
         return false;
     }
+    if (newDecal.indices_.Size() > maxIndices_)
+    {
+        LOGWARNING("Can not add decal, index count " + String(newDecal.indices_.Size()) + " exceeds maximum " +
+            String(maxIndices_));
+        decals_.Pop();
+        return false;
+    }
     
     // Finally transform vertices to this node's local space
     Matrix3x4 decalTransform = node_->GetWorldTransform().Inverse() * target->GetNode()->GetWorldTransform();