Пример #1
0
        public GFLXBone(GFLXModel parent, Bone bone) : base(parent.Skeleton)
        {
            ParentModel = parent;
            Bone        = bone;

            Text        = bone.Name;
            parentIndex = bone.Parent;

            if (bone.Translation != null)
            {
                Position = new OpenTK.Vector3(
                    bone.Translation.X,
                    bone.Translation.Y,
                    bone.Translation.Z
                    );
            }

            if (bone.Rotation != null)
            {
                EulerRotation = new OpenTK.Vector3(
                    bone.Rotation.X,
                    bone.Rotation.Y,
                    bone.Rotation.Z
                    );
            }

            if (bone.Scale != null)
            {
                Scale = new OpenTK.Vector3(
                    bone.Scale.X,
                    bone.Scale.Y,
                    bone.Scale.Z
                    );
            }
        }
Пример #2
0
 public GFLXMesh(GFLXModel model,
                 GFMDLStructs.Group group,
                 GFMDLStructs.Mesh mesh)
 {
     ParentModel = model;
     GroupData   = group;
     MeshData    = mesh;
 }
Пример #3
0
        public GFLXMaterialData(GFLXModel parent, Material mat)
        {
            ParentModel = parent;
            Material    = mat;
            Text        = mat.Name;

            ReloadMaterial();
        }
Пример #4
0
        public GFLXBone(GFLXModel parent, Bone bone) : base(parent.Skeleton)
        {
            ParentModel = parent;
            Bone        = bone;

            Text        = bone.Name;
            parentIndex = bone.Parent;

            if (bone.Translation != null)
            {
                position = new float[3]
                {
                    bone.Translation.X,
                    bone.Translation.Y,
                    bone.Translation.Z
                };
            }

            if (bone.Rotation != null)
            {
                rotation = new float[4]
                {
                    bone.Rotation.X,
                    bone.Rotation.Y,
                    bone.Rotation.Z,
                    1.0f,
                };
            }

            if (bone.Scale != null)
            {
                scale = new float[3]
                {
                    bone.Scale.X,
                    bone.Scale.Y,
                    bone.Scale.Z
                };
            }
        }
Пример #5
0
        private void ReloadModel(Model model)
        {
            if (Renderer != null)
            {
                Renderer.Meshes.Clear();
            }

            DrawableContainer.Drawables.Clear();

            Renderer            = new GFBMDL_Render();
            Renderer.GfbmdlFile = this;
            DrawableContainer.Drawables.Add(Renderer);

            Nodes.Clear();

            Model = new GFLXModel();
            Model.LoadFile(model, this, Renderer);

            TreeNode SkeletonWrapper       = new TreeNode("Skeleton");
            TreeNode MaterialFolderWrapper = new TreeNode("Materials");
            TreeNode VisualGroupWrapper    = new TreeNode("Visual Groups");
            TreeNode Textures = new TreeNode("Textures");

            if (Model.Skeleton.bones.Count > 0)
            {
                Nodes.Add(SkeletonWrapper);
                DrawableContainer.Drawables.Add(Model.Skeleton);

                foreach (var bone in Model.Skeleton.bones)
                {
                    if (bone.Parent == null)
                    {
                        SkeletonWrapper.Nodes.Add(bone);
                    }
                }
            }


            List <string> loadedTextures = new List <string>();

            for (int i = 0; i < Model.Textures.Count; i++)
            {
                foreach (var bntx in PluginRuntime.bntxContainers)
                {
                    if (bntx.Textures.ContainsKey(Model.Textures[i]) &&
                        !loadedTextures.Contains(Model.Textures[i]))
                    {
                        TreeNode tex = new TreeNode(Model.Textures[i]);
                        tex.ImageKey         = "texture";
                        tex.SelectedImageKey = "texture";

                        tex.Tag = bntx.Textures[Model.Textures[i]];
                        Textures.Nodes.Add(tex);
                        loadedTextures.Add(Model.Textures[i]);
                    }
                }
            }

            loadedTextures.Clear();

            Nodes.Add(MaterialFolderWrapper);
            Nodes.Add(VisualGroupWrapper);
            if (Textures.Nodes.Count > 0)
            {
                Nodes.Add(Textures);
            }

            for (int i = 0; i < Model.GenericMaterials.Count; i++)
            {
                MaterialFolderWrapper.Nodes.Add(Model.GenericMaterials[i]);
            }

            for (int i = 0; i < Model.GenericMeshes.Count; i++)
            {
                VisualGroupWrapper.Nodes.Add(Model.GenericMeshes[i]);
            }
        }