Example #1
0
        public void Create(fMaterial defaultMaterial)
        {
            button     = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDToggleButton"));
            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape),
                                      defaultMaterial, button);

            buttonMesh.RotateD(Vector3f.AxisX, -90.0f); // ??

            if (text.Length > 0)
            {
                UpdateText();
            }
        }
Example #2
0
        // creates a button in the desired geometry shape
        public void Create(Material defaultMaterial, Material disabledMaterial = null)
        {
            button     = new GameObject(UniqueNames.GetNext("HUDButton"));
            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape),
                                      defaultMaterial, button);

            buttonMesh.transform.Rotate(Vector3.right, -90.0f);              // ??
            MaterialUtil.DisableShadows(buttonMesh);

            standard_mat = new fMaterial(defaultMaterial);
            if (disabledMaterial != null)
            {
                disabled_mat = new fMaterial(disabledMaterial);
            }
        }
Example #3
0
        // creates a button in the desired geometry shape
        public void Create()
        {
            entry = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDLabel"));

            bgMesh = AppendMeshGO("background", HUDUtil.MakeBackgroundMesh(Shape),
                                  MaterialUtil.CreateFlatMaterialF(BackgroundColor),
                                  entry);
            bgMesh.RotateD(Vector3f.AxisX, -90.0f);


            if (EnableBorder)
            {
                HUDShape borderShape = Shape;
                borderShape.Radius += BorderWidth;
                borderShape.Height += 2 * BorderWidth;
                borderShape.Width  += 2 * BorderWidth;
                border              = AppendMeshGO("border", HUDUtil.MakeBackgroundMesh(borderShape),
                                                   MaterialUtil.CreateFlatMaterialF(BorderColor), entry);
                border.RotateD(Vector3f.AxisX, -90.0f);
                border.Translate(-0.001f * Vector3f.AxisY, true);
            }

            BoxPosition horzAlign = BoxPosition.CenterLeft;

            if (AlignmentHorz == HorizontalAlignment.Center)
            {
                horzAlign = BoxPosition.Center;
            }
            else if (AlignmentHorz == HorizontalAlignment.Right)
            {
                horzAlign = BoxPosition.CenterRight;
            }

            textMesh =
                GameObjectFactory.CreateTextMeshGO(
                    "text", Text, TextColor, TextHeight, horzAlign, SceneGraphConfig.TextLabelZOffset);

            textMesh.TextObject.SetFixedWidth(Shape.Width);
            textMesh.TextObject.SetOverflowMode(TextOverflowMode.Ellipses);

            Vector2f toPos = BoxModel.GetBoxPosition(this, horzAlign);

            BoxModel.Translate(textMesh, Vector2f.Zero, toPos);

            AppendNewGO(textMesh, entry, false);

            MaterialUtil.DisableShadows(RootGameObject);
        }
Example #4
0
        // creates a button with a background shape and a foreground mesh
        public void Create(fMaterial bgMaterial, fMesh mesh, fMaterial meshMaterial, float fScale, Frame3f deltaF)
        {
            button = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDButton"));

            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape), bgMaterial, button);
            buttonMesh.RotateD(Vector3f.AxisX, -90.0f); // ??
            MaterialUtil.DisableShadows(buttonMesh);

            iconMesh = AppendMeshGO("shape", mesh, meshMaterial, button);
            iconMesh.SetLocalScale(new Vector3f(fScale, fScale, fScale));
            iconMesh.SetLocalPosition(deltaF.Origin);
            iconMesh.SetLocalRotation(deltaF.Rotation);
            MaterialUtil.DisableShadows(iconMesh);

            standard_mat = new fMaterial(bgMaterial);
        }
Example #5
0
        // creates a button with a floating primitive in front of the button shape
        public void Create(PrimitiveType eType, Material bgMaterial, Material primMaterial, float fPrimScale = 0.7f)
        {
            button     = new GameObject(UniqueNames.GetNext("HUDButton"));
            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape), bgMaterial, button);
            buttonMesh.transform.Rotate(Vector3.right, -90.0f);              // ??
            MaterialUtil.DisableShadows(buttonMesh);

            GameObject prim     = AppendUnityPrimitiveGO("primitive", eType, primMaterial, button);
            float      primSize = Shape.EffectiveRadius() * fPrimScale;

            prim.transform.localScale = new Vector3(primSize, primSize, primSize);
            prim.transform.Translate(0.0f, 0.0f, -primSize);
            prim.transform.Rotate(-15.0f, 45.0f, 0.0f, Space.Self);
            MaterialUtil.DisableShadows(prim);

            standard_mat = new fMaterial(bgMaterial);
        }
Example #6
0
        // creates a button with a background shape and a foreground mesh
        public void Create(Material bgMaterial, fMesh mesh, Material meshMaterial, float fScale, Frame3f deltaF)
        {
            button = new GameObject(UniqueNames.GetNext("HUDButton"));

            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape), bgMaterial, button);
            buttonMesh.transform.Rotate(Vector3.right, -90.0f); // ??
            MaterialUtil.DisableShadows(buttonMesh);

            GameObject meshGO = AppendMeshGO("shape", mesh, meshMaterial, button);

            meshGO.transform.localScale    = new Vector3(fScale, fScale, fScale);
            meshGO.transform.localPosition = deltaF.Origin;
            meshGO.transform.localRotation = deltaF.Rotation;
            MaterialUtil.DisableShadows(meshGO);

            standard_mat = new fMaterial(bgMaterial);
        }
Example #7
0
        // creates a button in the desired geometry shape
        public void Create(fMaterial defaultMaterial, fMaterial disabledMaterial = null, fMaterial hoverMaterial = null)
        {
            button     = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDButton"));
            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape),
                                      defaultMaterial, button);
            buttonMesh.RotateD(Vector3f.AxisX, -90.0f); // ??
            MaterialUtil.DisableShadows(buttonMesh);

            standard_mat = defaultMaterial;
            if (disabledMaterial != null)
            {
                disabled_mat = disabledMaterial;
            }
            if (hoverMaterial != null)
            {
                hover_mat = hoverMaterial;
            }
        }
 void update_shape(HUDShape newShape)
 {
     shape = newShape;
     if (bgMesh == null)
     {
         return;
     }
     bgMesh.SetSharedMesh(
         HUDUtil.MakeBackgroundMesh(shape));
     if (EnableBorder)
     {
         HUDShape borderShape = shape;
         borderShape.Radius += BorderWidth;
         borderShape.Height += 2 * BorderWidth;
         borderShape.Width  += 2 * BorderWidth;
         border.SetSharedMesh(HUDUtil.MakeBackgroundMesh(borderShape));
     }
 }
        // creates a button in the desired geometry shape
        public void Create()
        {
            entry = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDShapeElement"));

            bgMesh = new fGameObject(AppendMeshGO("background", HUDUtil.MakeBackgroundMesh(Shape),
                                                  MaterialUtil.CreateFlatMaterialF(Color),
                                                  entry));
            bgMesh.RotateD(Vector3f.AxisX, -90.0f);

            if (EnableBorder)
            {
                HUDShape borderShape = Shape;
                borderShape.Radius += BorderWidth;
                borderShape.Height += 2 * BorderWidth;
                borderShape.Width  += 2 * BorderWidth;
                border              = new fGameObject(AppendMeshGO("border", HUDUtil.MakeBackgroundMesh(borderShape),
                                                                   MaterialUtil.CreateFlatMaterialF(BorderColor), entry));
                border.RotateD(Vector3f.AxisX, -90.0f);
                border.Translate(-0.001f * Vector3f.AxisY, true);
            }
        }
Example #10
0
        // creates a button with a floating primitive in front of the button shape
        public void Create(UnityEngine.PrimitiveType eType, fMaterial bgMaterial, fMaterial primMaterial, float fPrimScale = 0.7f)
        {
            button     = GameObjectFactory.CreateParentGO(UniqueNames.GetNext("HUDButton"));
            buttonMesh = AppendMeshGO("shape", HUDUtil.MakeBackgroundMesh(this.Shape), bgMaterial, button);
            buttonMesh.RotateD(Vector3f.AxisX, -90.0f); // ??
            MaterialUtil.DisableShadows(buttonMesh);

            iconMesh = AppendUnityPrimitiveGO("primitive", eType, primMaterial, button);
            float primSize = Shape.EffectiveRadius() * fPrimScale;

            iconMesh.SetLocalScale(new Vector3f(primSize, primSize, primSize));
            iconMesh.Translate(new Vector3f(0.0f, 0.0f, -primSize), false);
            Quaternionf rot = iconMesh.GetLocalRotation();

            rot = rot * Quaternionf.AxisAngleD(Vector3f.AxisY, 45.0f);
            rot = rot * Quaternionf.AxisAngleD(Vector3f.AxisX, -15.0f);
            iconMesh.SetLocalRotation(rot);
            //buttonMesh.transform.Rotate(-15.0f, 45.0f, 0.0f, Space.Self);
            MaterialUtil.DisableShadows(iconMesh);

            standard_mat = new fMaterial(bgMaterial);
        }