I have a method that is called each frame that will object a GUI window based on the selected object's properties.
private void Update_Window_Properties()
{
if (objectSelected == null)
{
return;
}
Entity e = objectSelected.Entity;
Vector3 position = e.InternalCenterPosition;
textBox_PositionX.Text = position.X.ToString();
textBox_PositionY.Text = position.Y.ToString();
textBox_PositionZ.Text = position.Z.ToString();
Vector3 rotation = e.InternalOrientationMatrix.ToEulerAngles();
textBox_RotationX.Text = rotation.X.ToString();
textBox_RotationY.Text = rotation.Y.ToString();
textBox_RotationZ.Text = rotation.Z.ToString();
Vector3 scale = objectSelected.Scale;
textBox_ScaleX.Text = scale.X.ToString();
textBox_ScaleY.Text = scale.Y.ToString();
textBox_ScaleZ.Text = scale.Z.ToString();
if (comboBox_ShapeType.ItemIndex != (int)objectSelected.Shape)
{
comboBox_ShapeType.ItemIndex = (int)objectSelected.Shape;
}
textBox_Mass.Text = e.Mass.ToString();
Vector3 angularVelocity = e.InternalAngularVelocity;
textBox_AngularVelocityX.Text = angularVelocity.X.ToString();
textBox_AngularVelocityY.Text = angularVelocity.Y.ToString();
textBox_AngularVelocityZ.Text = angularVelocity.Z.ToString();
Vector3 linearVelocity = e.InternalLinearVelocity;
textBox_LinearVelocityX.Text = linearVelocity.X.ToString();
textBox_LinearVelocityY.Text = linearVelocity.Y.ToString();
textBox_LinearVelocityZ.Text = linearVelocity.Z.ToString();
imageBox_Texture.Image = game.Textures[objectSelected.TextureIndex];
}
My FPS will drop from 817 to 100 if this method is run once per frame. How can I possibly reduce the damage from this horrible bottleneck?