OSDN Git Service

Now that we have calculate sim position and rotation of all prims, remove duplicate...
authorLatif Khalifa <latifer@streamgrid.net>
Mon, 11 Jul 2011 12:44:51 +0000 (12:44 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Mon, 11 Jul 2011 12:44:51 +0000 (12:44 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@974 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Rendering/Rendering.cs

index 4d899f4..48806c2 100644 (file)
@@ -1775,10 +1775,6 @@ namespace Radegast.Rendering
         void RenderPrim(RenderPrimitive mesh, RenderPass pass, int primNr)\r
         {\r
             Primitive prim = mesh.Prim;\r
-            RenderPrimitive parent = null;\r
-            RenderAvatar parentav = null;\r
-\r
-            if (prim.ParentID != 0 && !Prims.TryGetValue(prim.ParentID, out parent) && !Avatars.TryGetValue(prim.ParentID, out parentav)) return;\r
 \r
             // Don't render objects too small to matter\r
             if (LODFactor(mesh.DistanceSquared, prim.Scale, mesh.BoundingVolume.R) < minLODFactor) return;\r
@@ -1789,100 +1785,9 @@ namespace Radegast.Rendering
             // Individual prim matrix\r
             GL.PushMatrix();\r
 \r
-            //TODO we really need a scene graph but for the moment simple if/else logic checks and parent finding are used\r
-            if (prim.ParentID != 0) // Does this prim have a parent\r
-            {\r
-                if (parent != null) // Check the parent is valid\r
-                {\r
-                    if (parent.Prim.ParentID != 0) // Does the parent have a parent? if so it must be an avatar \r
-                    {\r
-                        if (Avatars.TryGetValue(parent.Prim.ParentID, out parentav)) // Get the parent avatar\r
-                        {\r
-                            // Child prims of parents that have avatar as parent\r
-\r
-                            if (prim.PrimData.AttachmentPoint >= AttachmentPoint.HUDCenter2 && prim.PrimData.AttachmentPoint <= AttachmentPoint.HUDBottomRight)\r
-                            {\r
-                                // Child HUD elements\r
-                            }\r
-                            else\r
-                            {\r
-                                //This is a child prim attachment\r
-\r
-                                // Apply prim translation and rotation relative to the root prim\r
-                                GL.MultMatrix(Math3D.CreateTranslationMatrix(parentav.avatar.Position));\r
-                                GL.MultMatrix(Math3D.CreateRotationMatrix(parentav.avatar.Rotation));\r
-\r
-                                int attachment_index = (int)parent.Prim.PrimData.AttachmentPoint;\r
-                                if (attachment_index > GLAvatar.attachment_points.Count())\r
-                                {\r
-                                    // invalid LL attachment point\r
-                                    return;\r
-                                }\r
-\r
-                                attachment_point apoint = GLAvatar.attachment_points[attachment_index];\r
-\r
-                                Vector3 point = parentav.glavatar.skel.getOffset(apoint.joint) + apoint.position;\r
-                                Quaternion qrot = parentav.glavatar.skel.getRotation(apoint.joint) * apoint.rotation;\r
-                                //Vector3 point = Bone.getOffset(apoint.joint) + apoint.position;\r
-                                // Quaternion qrot = Bone.getRotation(apoint.joint) * apoint.rotation;\r
-\r
-                                GL.MultMatrix(Math3D.CreateTranslationMatrix(point));\r
-                                GL.MultMatrix(Math3D.CreateRotationMatrix(qrot));\r
-\r
-                                // Apply prim translation and rotation relative to the root prim\r
-                                GL.MultMatrix(Math3D.CreateTranslationMatrix(parent.Prim.Position));\r
-                                GL.MultMatrix(Math3D.CreateRotationMatrix(parent.Prim.Rotation));\r
-                            }\r
-                        }\r
-                    }\r
-                    else // This prims parent does not have a parent there for its a regular prim and this must be its child\r
-                    {\r
-                        // Regular child prim\r
-                        // Apply prim translation and rotation relative to the root prim\r
-                        GL.MultMatrix(Math3D.CreateTranslationMatrix(parent.Prim.Position));\r
-                        GL.MultMatrix(Math3D.CreateRotationMatrix(parent.Prim.Rotation));\r
-                    }\r
-                }\r
-                else // This prim has a parent but does not have a parent in the ObjectsList, its parent is therefor parentav from the avatars list \r
-                {\r
-                    //Root prims with avatar as parent\r
-\r
-                    if (prim.PrimData.AttachmentPoint >= AttachmentPoint.HUDCenter2 && prim.PrimData.AttachmentPoint <= AttachmentPoint.HUDBottomRight)\r
-                    {\r
-                        // Root HUD elements\r
-                    }\r
-                    else\r
-                    {\r
-                        // Root attachments\r
-\r
-                        // Apply prim translation and rotation relative to the root prim\r
-                        GL.MultMatrix(Math3D.CreateTranslationMatrix(parentav.avatar.Position));\r
-                        GL.MultMatrix(Math3D.CreateRotationMatrix(parentav.avatar.Rotation));\r
-\r
-                        int attachment_index = (int)prim.PrimData.AttachmentPoint;\r
-                        if (attachment_index > GLAvatar.attachment_points.Count())\r
-                        {\r
-                            // invalid LL attachment point\r
-                            return;\r
-                        }\r
-\r
-                        attachment_point apoint = GLAvatar.attachment_points[attachment_index];\r
-\r
-                        //Vector3 point = Bone.getOffset(apoint.joint) + apoint.position;\r
-                        //Quaternion qrot = Bone.getRotation(apoint.joint) * apoint.rotation;\r
-                        Vector3 point = parentav.glavatar.skel.getOffset(apoint.joint) + apoint.position;\r
-                        Quaternion qrot = parentav.glavatar.skel.getRotation(apoint.joint) * apoint.rotation;\r
-\r
-                        GL.MultMatrix(Math3D.CreateTranslationMatrix(point));\r
-                        GL.MultMatrix(Math3D.CreateRotationMatrix(qrot));\r
-                    }\r
-                }\r
-            }\r
-\r
-\r
             // Prim roation and position\r
-            GL.MultMatrix(Math3D.CreateTranslationMatrix(prim.Position));\r
-            GL.MultMatrix(Math3D.CreateRotationMatrix(prim.Rotation));\r
+            GL.MultMatrix(Math3D.CreateTranslationMatrix(mesh.SimPosition));\r
+            GL.MultMatrix(Math3D.CreateRotationMatrix(mesh.SimRotation));\r
 \r
             // Prim scaling\r
             GL.Scale(prim.Scale.X, prim.Scale.Y, prim.Scale.Z);\r