Beispiel #1
0
        /// <summary>
        /// Replace the geometries in the scene with the ones contained in the given Assimp scene.
        /// </summary>
        /// <param name="scene"></param>
        public void ReplaceGeometries(Assimp.Scene scene)
        {
            var skinToBoneMatrices = ComputeSkinToBoneMatrices(scene);

            GeometryList.Clear();
            Atomics.Clear();

            for (var i = 0; i < scene.Meshes.Count; i++)
            {
                var assimpMesh = scene.Meshes[i];

                var rootNode = FindMeshRootNode(scene.RootNode, i) ?? scene.RootNode;
                TransformMeshVertices(assimpMesh, rootNode);

                var geometryNode = new RwGeometryNode(this, assimpMesh, scene.Materials[assimpMesh.MaterialIndex], FrameList, skinToBoneMatrices, out bool singleWeight);
                GeometryList.Add(geometryNode);

                var atomicNode = new RwAtomicNode(this, 0, i, 5);
                if (singleWeight)
                {
                    if (assimpMesh.Bones.Count != 0)
                    {
                        atomicNode.FrameIndex = FrameList.GetFrameIndexByName(assimpMesh.Bones[0].Name);
                    }
                    else if (rootNode != null)
                    {
                        atomicNode.FrameIndex = FrameList.GetFrameIndexByName(rootNode.Name);
                    }
                }

                Atomics.Add(atomicNode);
            }

            mStructNode = new RwClumpStructNode(this);
        }
Beispiel #2
0
        public override void UpdateGeometry()
        {
            GeometryList.Clear();
            GeometryList.Add(Name + "Up", new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));
            GeometryList.Add(Name + "Down", new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));

            float Buffer    = SX * 0.1f;
            float LetterGap = 0.75f;

            LetterGap = Text.Length > 1 ? LetterGap : 1;
            float DX = (SX - Buffer) / Text.Length;
            float OY = (SY - DX) / 2.0f;

            float DY = DX;

            DY = DY > SY / 4.0f ? DY : SY / 4.0f;

            for (int i = 0; i < Text.Length; i++)
            {
                int Index = Text[i] - 1;

                string Bit = Text[i].ToString();

                /*
                 * if ( Int32.TryParse(Bit, out int n))
                 * {
                 *  Index = 64 + Int32.Parse(Bit);
                 * }
                 */

                GeometryList.Add(Name + i, new Geometry2D(Name + i, "StandardText", (PX + Buffer / 2) * ScreenWidth + (DX * LetterGap * i * ScreenWidth), (PY + OY) * ScreenHeight, DX * (2.0f - LetterGap) * ScreenWidth, DY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));
            }
            NeedsNodeUpdate = true;
        }
Beispiel #3
0
        public override void UpdateGeometry()
        {
            GeometryList.Clear();
            GeometryList.Add(Name + "Background", new Geometry2D(Name + "StandardMenu", "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));

            if (Lines.Count > 0)
            {
                float LetterGap = 0.5f;
                float DY        = SY / MaxLineCount;
                float DX        = DY;

                for (int i = CurrentIndex; i < CurrentIndex + MaxLineCount && i < Lines.Count; i++)
                {
                    string Line = Lines[i];


                    float AllowedLength = SX / (DX * LetterGap);

                    for (int j = 0; j < AllowedLength && j < Line.Length; j++)
                    {
                        //get text texcoord
                        int Index = Line[j] - 1;
                        GeometryList.Add(Name + i + "-" + j, new Geometry2D(Name + i + "-" + j, "StandardText", (PX + DX * LetterGap * j) * ScreenWidth, (PY + DY * i) * ScreenHeight, DX * ScreenWidth, DY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));

                        //GeometryList.Add(Name + i, new Geometry2D(Name + i, "StandardText", (PX + DX * j + Buffer / 2) * ScreenWidth + (DX * i * ScreenWidth), (PY + OY) * ScreenHeight, DX * (2.0f - LetterGap) * ScreenWidth, DY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));
                    }
                }

                GeometryList.Add(Name + "HighLight", new Geometry2D(Name + "HighLight", "StandardMenu", PX * ScreenWidth, (PY + (SY / MaxLineCount * CurrentLocalIndex)) * ScreenHeight, SX * ScreenWidth, SY / MaxLineCount * ScreenHeight, 0.75f, 0, 0.1875f, 0.0625f, Z));
            }
            NeedsNodeUpdate = true;
        }
Beispiel #4
0
 public override void GenerateGeometry()
 {
     if (GeometryList.Count > 0)
     {
         GeometryList.Clear();
     }
     UpdateGeometry();
 }
Beispiel #5
0
 public override void GenerateGeometry()
 {
     if (GeometryList.Count > 0)
     {
         GeometryList.Clear();
     }
     GeometryList.Add(Name, new Geometry2D(Name, TextureName, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, 0, 0, 1.0f, 1.0f, Z));
 }
Beispiel #6
0
 public virtual void GenerateGeometry()
 {
     if (GeometryList.Count > 0)
     {
         GeometryList.Clear();
     }
     GeometryList.Add(Name, new Geometry2D(Name, TextureName, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));
 }
Beispiel #7
0
        public override void GenerateGeometry()
        {
            if (GeometryList.Count > 0)
            {
                GeometryList.Clear();
            }
            GeometryList.Add(Name, new Geometry2D(Name, TileTexture, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, 0, 0, 1, 1, 0.0f));

            float SSX = TileSizeX > 50 ? SX * ScreenWidth / 50 : SX * ScreenWidth / TileSizeX;
            float SSY = TileSizeY > 50 ? SY * ScreenWidth / 50 : SY * ScreenHeight / TileSizeY;

            float SPX = TileSizeX > 50 ? PX * ScreenWidth + (SX * ScreenWidth / TileSizeX * TileX) - SSX / 2 : PX * ScreenWidth + (SX * ScreenWidth / TileSizeX * TileX);
            float SPY = TileSizeY > 50 ? PY * ScreenHeight + (SY * ScreenHeight / TileSizeY * TileY) - SSY / 2 : PY * ScreenHeight + (SY * ScreenHeight / TileSizeY * TileY);

            GeometryList.Add(Name + "Selector", new Geometry2D(Name, "StandardMenu", SPX, SPY, SSX, SSY, TX, TY, TSX, TSY, 0.5f));
        }
Beispiel #8
0
        public override void GenerateGeometry()
        {
            if (GeometryList.Count > 0)
            {
                GeometryList.Clear();
            }
            //GeometryList.Add(Name, new Geometry2D(Name, TileTexture, PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, 0, 0, 1, 1, 0.0f));

            //background
            //Red Slider
            //Green Slider
            //Blue Slider
            //Alpha Slider
            float SPX  = PX * ScreenWidth;
            float SPY  = PY * ScreenHeight;
            float SPPX = SX * ScreenWidth;
            float SSX  = SX * ScreenWidth / 256;
            float SSY  = SY * ScreenHeight / 4;

            Geometry2D RedGeom   = new Geometry2D(Name + "RedSlider", "StandardMenu", SPX, SPY, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);
            Geometry2D GreenGeom = new Geometry2D(Name + "GreenSlider", "StandardMenu", SPX, SPY + SSY, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);
            Geometry2D BlueGeom  = new Geometry2D(Name + "BlueSlider", "StandardMenu", SPX, SPY + SSY * 2, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);
            Geometry2D AlphaGeom = new Geometry2D(Name + "AlphaSlider", "StandardMenu", SPX, SPY + SSY * 3, SPPX, SSY, TX, TY, TSX, TSY, 0.5f);

            GeometryList.Add(RedGeom.Name, RedGeom);
            GeometryList.Add(GreenGeom.Name, GreenGeom);
            GeometryList.Add(BlueGeom.Name, BlueGeom);
            GeometryList.Add(AlphaGeom.Name, AlphaGeom);
            //Selectors

            float RPX = PX * ScreenWidth + (SSX * RX) - SSY / 2;
            float GPX = PX * ScreenWidth + (SSX * GX) - SSY / 2;
            float BPX = PX * ScreenWidth + (SSX * BX) - SSY / 2;
            float APX = PX * ScreenWidth + (SSX * AX) - SSY / 2;

            Geometry2D RedSelector   = new Geometry2D(Name + "RedSelector", "StandardMenu", RPX, SPY, SSY, SSY, TX, TY, TSX, TSY, 0.9f);
            Geometry2D GreenSelector = new Geometry2D(Name + "GreenSelector", "StandardMenu", GPX, SPY + SSY, SSY, SSY, TX, TY, TSX, TSY, 0.9f);
            Geometry2D BlueSelector  = new Geometry2D(Name + "BlueSelector", "StandardMenu", BPX, SPY + SSY * 2, SSY, SSY, TX, TY, TSX, TSY, 0.9f);
            Geometry2D AlphaSelector = new Geometry2D(Name + "AlphaSelector", "StandardMenu", APX, SPY + SSY * 3, SSY, SSY, TX, TY, TSX, TSY, 0.9f);

            GeometryList.Add(RedSelector.Name, RedSelector);
            GeometryList.Add(GreenSelector.Name, GreenSelector);
            GeometryList.Add(BlueSelector.Name, BlueSelector);
            GeometryList.Add(AlphaSelector.Name, AlphaSelector);
        }
Beispiel #9
0
        public override void UpdateGeometry()
        {
            GeometryList.Clear();
            GeometryList.Add(Name, new Geometry2D(Name, "StandardMenu", PX * ScreenWidth, PY * ScreenHeight, SX * ScreenWidth, SY * ScreenHeight, TX, TY, TSX, TSY, Z));

            if (Text.Length > 0)
            {
                float Buffer = SX * 0.1f;
                float DX     = (SX - Buffer) / Text.Length;

                for (int i = 0; i < Text.Length; i++)
                {
                    int    Index = Text[i] - 1;
                    string Bit   = Text[i].ToString();

                    GeometryList.Add(Name + i, new Geometry2D(Name + i, "StandardText", (PX + Buffer) * ScreenWidth + (DX * i * ScreenWidth), PY * ScreenHeight, DX * ScreenWidth, SY * ScreenHeight, 0.0625f * (Index % 16), 0.0625f * (Index / 16), 0.0625f, 0.0625f, Z + 0.1f));
                }
            }
            NeedsNodeUpdate = true;
        }