Example #1
0
 public void ObjectDefocused(DeckObject deckObject)
 {
     if (selectionGrid.SelectedRows.Count != 0)
     {
         selectionGrid.ClearSelection();
     }
 }
Example #2
0
 public void EvictCard(DeckObject destination)
 {
     //destination.CreateNewCard(cardObject);
     //cardObject.Destroy();
     //card.Destroy();
     //isOccupied = false;
 }
Example #3
0
 public void OnObjectUpdate(DeckObject deckObject)
 {
     if (objectId == deckObject.ObjectId)
     {
         RefreshUserInterfaceValues(deckObject);
     }
 }
Example #4
0
        public void OnObjectRemove(DeckObject deckObject)
        {
            int hordeId = m_objectIdHordeIdDictionary[deckObject.ObjectId];

            h3d.removeNode(hordeId);
            m_objectIdHordeIdDictionary.Remove(deckObject.ObjectId);
            m_hordeIdObjectIdDictionary.Remove(hordeId);
        }
Example #5
0
        private void deleteObjectButton_Click(object sender, EventArgs e)
        {
            DeckObject deckObject = DeckProgram.DeckSelection.GetFocus();

            if (deckObject != null)
            {
                DeckProgram.DeckEngine.RequestObjectDelete(deckObject.ObjectId);
            }
        }
Example #6
0
        public void ObjectDeselected(DeckObject deckObject)
        {
            DataRow row = m_selectionTable.Rows.Find(deckObject.ObjectId);

            if (row != null)
            {
                m_selectionTable.Rows.Remove(row);
            }
        }
Example #7
0
        private void zTextBox_Leave(object sender, EventArgs e)
        {
            DeckObject deckObject = DeckProgram.DeckScene.GetObject(objectId);
            Vector3    location   = new Vector3();

            location.X = deckObject.NetworkLocation.X;
            location.Y = deckObject.NetworkLocation.Y;
            location.Z = Convert.ToSingle(zTextBox.Text);
            DeckProgram.DeckEngine.RequestObjectUpdate(objectId, deckObject.ObjectName, location, deckObject.NetworkOrientation, deckObject.Radius);
        }
Example #8
0
 public void OnChatMessage(DeckObject sourceObject, string message)
 {
     textBox1.Text += sourceObject.ObjectName + " - " + message + Environment.NewLine;
     textBox1.Select(textBox1.Text.Length - 1, 0);
     textBox1.ScrollToCaret();
     if (this.Visible == false)
     {
         this.Visible = true;
     }
 }
Example #9
0
        public void OnObjectAdd(DeckObject deckObject)
        {
            string modelUrl = deckObject.ModelUrl;

            int hordeId = h3d.addNodes(h3d.H3DRootNode, DeckProgram.AssetManager.GetAssetRendererId(deckObject.ModelUrl));

            deckObject.RenderId = hordeId;
            m_hordeIdObjectIdDictionary.Add(hordeId, deckObject.ObjectId);
            m_objectIdHordeIdDictionary.Add(deckObject.ObjectId, hordeId);
        }
Example #10
0
 private void RefreshUserInterfaceValues(DeckObject deckObject)
 {
     objectId = deckObject.ObjectId;
     objectNameTextBox.Text = deckObject.ObjectName;
     typeNameTextBox.Text   = deckObject.TypeName;
     xTextBox.Text          = deckObject.NetworkLocation.X.ToString();
     yTextBox.Text          = deckObject.NetworkLocation.Y.ToString();
     zTextBox.Text          = deckObject.NetworkLocation.Z.ToString();
     scaleTextBox.Text      = deckObject.Radius.ToString();
 }
Example #11
0
        private void insertObjectButton_Click(object sender, EventArgs e)
        {
            DeckObjectType objectType = (DeckObjectType)typeComboBox.SelectedItem;

            if (objectType == null)
            {
                return;
            }
            DeckObject avatarObject = DeckProgram.DeckScene.GetObject(DeckProgram.DeckEngine.AvatarId);

            DeckProgram.DeckEngine.RequestObjectInsert(objectType.TypeId, avatarObject.RenderLocation, Quaternion.Identity);
        }
Example #12
0
        public void ObjectFocused(DeckObject deckObject)
        {
            if (this.Visible == false)
            {
                this.Visible = true;
            }
            DataRow row      = m_selectionTable.Rows.Find(deckObject.ObjectId);
            int     rowIndex = m_selectionTable.Rows.IndexOf(row);

            if (selectionGrid.Rows.Count > rowIndex)
            {
                selectionGrid.Rows[rowIndex].Selected = true;
            }
        }
Example #13
0
        private void rollSubButton_Click(object sender, EventArgs e)
        {
            DeckObject deckObject          = DeckProgram.DeckScene.GetObject(objectId);
            Quaternion originalOrientation = deckObject.NetworkOrientation;
            Matrix     originalOrientationMatrix;

            Common.Rotate(out originalOrientationMatrix, ref originalOrientation);

            Matrix resultOrientationMatrix;

            Common.RotateZ(out resultOrientationMatrix, ref originalOrientationMatrix, -Common.DegreesToRadians(Convert.ToSingle(orientationStepTextBox.Text)));

            Quaternion resultOrientation;

            Common.Rotate(out resultOrientation, ref resultOrientationMatrix);
            DeckProgram.DeckEngine.RequestObjectUpdate(objectId, deckObject.ObjectName, deckObject.NetworkLocation, resultOrientation, deckObject.Radius);
        }
Example #14
0
        private void selectionGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataRow    row        = m_selectionTable.Rows[e.RowIndex];
            DeckObject deckObject = (DeckObject)row["Object"];

            if (Control.ModifierKeys == Keys.Control)
            {
                if (DeckProgram.DeckSelection.GetSelection().Contains(deckObject))
                {
                    DeckProgram.DeckSelection.DeselectObject(deckObject);
                }
            }
            else
            {
                if (DeckProgram.DeckSelection.GetFocus() != deckObject)
                {
                    DeckProgram.DeckSelection.FocusObject(deckObject);
                }
            }
        }
Example #15
0
        public void OnObjectUpdate(DeckObject deckObject)
        {
            int hordeId = m_objectIdHordeIdDictionary[deckObject.ObjectId];

            Matrix     orientationMatrix;
            Quaternion orientation = deckObject.RenderOrientation;

            Common.Rotate(out orientationMatrix, ref orientation);
            Matrix translationMatrix    = Matrix.CreateTranslation(deckObject.RenderLocation.X, deckObject.RenderLocation.Y, deckObject.RenderLocation.Z);
            Matrix scaleMatrix          = Matrix.CreateScale(deckObject.RenderScale.X, deckObject.RenderScale.Y, deckObject.RenderScale.Z);
            Matrix transformationMatrix = Matrix.Multiply(scaleMatrix, Matrix.Multiply(Matrix.RotationY(Common.DegreesToRadians(180)) * orientationMatrix, translationMatrix));

            h3d.setNodeTransMat(hordeId, transformationMatrix.ToArray(MatrixElementOrder.RowMajor));

            if (deckObject.ObjectId == DeckProgram.DeckEngine.AvatarId)
            {
                DeckProgram.DeckRudder.AvatarCurrentLocation          = deckObject.RenderLocation;
                DeckProgram.DeckRudder.AvatarCurrentOrientationMatrix = orientationMatrix;
            }
        }
Example #16
0
        private void renderPanel_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (Control.ModifierKeys != Keys.Control)
                {
                    DeckProgram.DeckSelection.ClearSelection();
                }
                DeckObject deckObject = DeckProgram.DeckRenderer.GetPointedObject();

                if (deckObject != null)
                {
                    if (DeckProgram.DeckSelection.GetSelection().Contains(deckObject))
                    {
                        DeckProgram.DeckSelection.DeselectObject(deckObject);
                    }
                    else
                    {
                        DeckProgram.DeckSelection.FocusObject(deckObject);
                    }
                }
            }
        }
Example #17
0
        private void objectNameTextBox_Leave(object sender, EventArgs e)
        {
            DeckObject deckObject = DeckProgram.DeckScene.GetObject(objectId);

            DeckProgram.DeckEngine.RequestObjectUpdate(objectId, objectNameTextBox.Text, deckObject.NetworkLocation, deckObject.NetworkOrientation, deckObject.Radius);
        }
Example #18
0
 public void ObjectDefocused(DeckObject deckObject)
 {
     this.Visible = false;
 }
Example #19
0
 private void Start()
 {
     Deck = GameObject.FindGameObjectWithTag("Deck").GetComponent <DeckObject>();
 }
Example #20
0
        private void resetOrientationButton_Click(object sender, EventArgs e)
        {
            DeckObject deckObject = DeckProgram.DeckScene.GetObject(objectId);

            DeckProgram.DeckEngine.RequestObjectUpdate(objectId, deckObject.ObjectName, deckObject.NetworkLocation, Quaternion.Identity, deckObject.Radius);
        }
Example #21
0
        private void scaleTextBox_Leave(object sender, EventArgs e)
        {
            DeckObject deckObject = DeckProgram.DeckScene.GetObject(objectId);

            DeckProgram.DeckEngine.RequestObjectUpdate(objectId, deckObject.ObjectName, deckObject.NetworkLocation, deckObject.NetworkOrientation, Convert.ToSingle(scaleTextBox.Text));
        }
Example #22
0
 public void ObjectDefocused(DeckObject deckObject)
 {
     deleteObjectButton.Enabled = false;
 }
Example #23
0
        private void scaleSubButton_Click(object sender, EventArgs e)
        {
            DeckObject deckObject = DeckProgram.DeckScene.GetObject(objectId);

            DeckProgram.DeckEngine.RequestObjectUpdate(objectId, deckObject.ObjectName, deckObject.NetworkLocation, deckObject.NetworkOrientation, deckObject.Radius * (1 - Convert.ToSingle(scaleStepTextBox.Text) / 100.0f));
        }
Example #24
0
 public void ObjectSelected(DeckObject deckObject)
 {
     m_selectionTable.Rows.Add(new object[] { deckObject.ObjectId, deckObject.ObjectName, deckObject.TypeName, deckObject });
 }
Example #25
0
 public void ObjectFocused(DeckObject deckObject)
 {
     RefreshUserInterfaceValues(deckObject);
     this.Visible = true;
 }
Example #26
0
        public void Process()
        {
            if (m_objectUpdateQueue.Count > 0)
            {
                foreach (Guid objectId in m_objectUpdateQueue)
                {
                    CloudObject         cloudObject       = DeckProgram.CloudView.CloudCache.GetObject(objectId);
                    OmModelPrimitiveExt modelPrimitiveExt = cloudObject.GetExtension <OmModelPrimitiveExt>();

                    Vector3    location    = new Vector3(cloudObject.Location.X, cloudObject.Location.Y, cloudObject.Location.Z);
                    Quaternion orientation = new Quaternion(cloudObject.Orientation.W, cloudObject.Orientation.X, cloudObject.Orientation.Y, cloudObject.Orientation.Z);
                    Vector3    scale       = new Vector3(cloudObject.BoundingSphereRadius * modelPrimitiveExt.Scale, cloudObject.BoundingSphereRadius * modelPrimitiveExt.Scale, cloudObject.BoundingSphereRadius * modelPrimitiveExt.Scale);

                    bool isNewAvatar = objectId == AvatarId && !DeckProgram.DeckScene.ContainsObject(objectId);

                    if (!DeckProgram.DeckScene.ContainsObject(objectId))
                    {
                        if (IsSynchronizing)
                        {
                            CurrentObjectSynchronizationCount++;
                            if (ExpectedObjectSynchronizationCount <= CurrentObjectSynchronizationCount)
                            {
                                CurrentObjectSynchronizationCount  = 0;
                                ExpectedObjectSynchronizationCount = 0;
                                Thread.Sleep(200);
                            }
                        }

                        DeckProgram.DeckScene.AddObject(new DeckObject(objectId, cloudObject.ObjectName, cloudObject.TypeName, modelPrimitiveExt.ModelUrl, modelPrimitiveExt.Scale, location, orientation, cloudObject.BoundingSphereRadius, scale));
                    }

                    DeckObject deckObject = DeckProgram.DeckScene.GetObject(cloudObject.ObjectId);

                    if (isNewAvatar)
                    {
                        Matrix orientationMatrix;
                        Common.Rotate(out orientationMatrix, ref orientation);

                        DeckProgram.DeckRudder.AvatarTargetLocation           = location;
                        DeckProgram.DeckRudder.AvatarCurrentLocation          = location;
                        DeckProgram.DeckRudder.AvatarTargetOrientationMatrix  = orientationMatrix;
                        DeckProgram.DeckRudder.AvatarCurrentOrientationMatrix = orientationMatrix;
                        DeckProgram.DeckRudder.UpdateCameraTransformation();
                        DeckProgram.DeckRudder.SynchronizeCameraCurrentLocationWithTargetLocation();
                    }

                    deckObject.ObjectName         = cloudObject.ObjectName;
                    deckObject.NetworkLocation    = location;
                    deckObject.NetworkOrientation = orientation;
                    deckObject.Radius             = cloudObject.BoundingSphereRadius;
                    deckObject.ModelScale         = modelPrimitiveExt.Scale;
                    deckObject.NetworkScale       = scale;

                    DeckProgram.DeckScene.UpdateObject(deckObject);

                    DeckProgram.DeckScene.ActivateObject(objectId);
                }
                m_objectUpdateQueue.Clear();
            }

            if (DeckProgram.DeckRudder.IsSteered && DateTime.Now.Subtract(m_lastSteeringUpdate).TotalMilliseconds > 100)
            {
                m_lastSteeringUpdate = DateTime.Now;

                if (DeckProgram.CloudView.CloudCache.GetObject(AvatarId) != null)
                {
                    ModifyRequestMessage modifyRequestMessage = new ModifyRequestMessage();
                    modifyRequestMessage.ObjectFragment.ObjectId             = AvatarId;
                    modifyRequestMessage.ObjectFragment.OwnerId              = ParticipantId;
                    modifyRequestMessage.ObjectFragment.TypeId               = Guid.Empty;
                    modifyRequestMessage.ObjectFragment.ObjectName           = ParticipantNickName;
                    modifyRequestMessage.ObjectFragment.TypeName             = "Avatar";
                    modifyRequestMessage.ObjectFragment.BoundingSphereRadius = 2f;
                    modifyRequestMessage.ObjectFragment.Mass       = 2f;
                    modifyRequestMessage.ObjectFragment.Location.X = (float)DeckProgram.DeckRudder.AvatarTargetLocation.X;
                    modifyRequestMessage.ObjectFragment.Location.Y = (float)DeckProgram.DeckRudder.AvatarTargetLocation.Y;
                    modifyRequestMessage.ObjectFragment.Location.Z = (float)DeckProgram.DeckRudder.AvatarTargetLocation.Z;
                    Matrix     rotationMatrix = DeckProgram.DeckRudder.AvatarTargetOrientationMatrix;
                    Quaternion quaternion;
                    Common.Rotate(out quaternion, ref rotationMatrix);
                    modifyRequestMessage.ObjectFragment.Orientation.X = (float)quaternion.I;
                    modifyRequestMessage.ObjectFragment.Orientation.Y = (float)quaternion.J;
                    modifyRequestMessage.ObjectFragment.Orientation.Z = (float)quaternion.K;
                    modifyRequestMessage.ObjectFragment.Orientation.W = (float)quaternion.W;

                    OmModelPrimitiveExt modelPrimitiveExt = new OmModelPrimitiveExt();
                    modelPrimitiveExt.ModelUrl = "http://assets.bubblecloud.org/Collada/Seymour/Seymour_triangulate.dae";
                    modelPrimitiveExt.Scale    = (float)0.1f;
                    modifyRequestMessage.SetExtension(modelPrimitiveExt);

                    DeckProgram.CloudView.ModifyObject(modifyRequestMessage);
                    DeckProgram.DeckRudder.IsSteered = false;
                }
            }
        }
Example #27
0
 public void ObjectFocused(DeckObject deckObject)
 {
     deleteObjectButton.Enabled = true;
     this.Visible = true;
 }