コード例 #1
0
ファイル: RAnimation.cs プロジェクト: trainboy2019/SSBHLib
        public void SetFrameModel(Models.RModel model, float frame)
        {
            if (model == null)
            {
                return;
            }

            // Visibility
            foreach (RVisibilityAnimation a in VisibilityNodes)
            {
                foreach (Models.RMesh m in model.subMeshes)
                {
                    // names match with start ignoreing the _VIS tags
                    if (m.Name.StartsWith(a.MeshName))
                    {
                        m.Visible = a.Visibility.GetValue(frame);
                    }
                }
            }

            // Material
            foreach (Models.RMesh m in model.subMeshes)
            {
                if (m.Material != null)
                {
                    m.Material.MaterialAnimation.Clear();
                    m.Material.CurrentFrame = frame;
                }
            }

            foreach (RMaterialAnimation a in MaterialNodes)
            {
                //System.Diagnostics.Debug.WriteLine($"Animation: {a.AttributeName} {a.Keys.GetValue(frame)}");

                foreach (Models.RMesh m in model.subMeshes)
                {
                    if (m.Material != null && m.Material.Name.Equals(a.MaterialName))
                    {
                        if (System.Enum.TryParse(a.AttributeName, out SSBHLib.Formats.Materials.MatlEnums.ParamId paramId))
                        {
                            m.Material.MaterialAnimation.Add((long)paramId, a.Keys.GetValue(frame));
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void SetFrameModel(Models.RModel model, float frame)
        {
            if (model == null)
            {
                return;
            }

            // Visibility
            foreach (RVisibilityAnimation a in VisibilityNodes)
            {
                foreach (Models.RMesh m in model.SubMeshes)
                {
                    // names match with start ignoreing the _VIS tags
                    if (m.Name.StartsWith(a.MeshName))
                    {
                        m.Visible = a.Visibility.GetValue(frame);
                    }
                }
            }

            // Material
            foreach (Models.RMesh m in model.SubMeshes)
            {
                if (m.Material != null)
                {
                    m.Material.Vec4ParamsMaterialAnimation.Clear();
                    m.Material.CurrentFrame = frame;
                }
            }

            foreach (RMaterialAnimation a in MaterialNodes)
            {
                foreach (Models.RMesh m in model.SubMeshes)
                {
                    if (m.Material != null && m.Material.MaterialLabel.Equals(a.MaterialName))
                    {
                        if (System.Enum.TryParse(a.AttributeName, out SSBHLib.Formats.Materials.MatlEnums.ParamId paramId))
                        {
                            m.Material.Vec4ParamsMaterialAnimation[paramId] = a.Keys.GetValue(frame);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public void SetFrameModel(Models.RModel Model, float Frame)
        {
            if (Model == null)
            {
                return;
            }

            // Visibility
            foreach (RVisibilityAnimation a in VisibilityNodes)
            {
                foreach (Models.RMesh m in Model.subMeshes)
                {
                    // names match with start ignoreing the _VIS tags
                    if (m.Name.StartsWith(a.MeshName))
                    {
                        m.Visible = a.Visibility.GetValue(Frame);
                    }
                }
            }
        }
コード例 #4
0
ファイル: ModelCollection.cs プロジェクト: ssbucarlos/SSBHLib
        public void Render(Camera camera)
        {
            var shader = ShaderContainer.GetCurrentRModelShader();

            if (!shader.LinkStatusIsOk)
            {
                return;
            }

            shader.UseProgram();

            if (boneUniformBuffer == null)
            {
                boneUniformBuffer = new UniformBlock(shader, "Bones");
            }

            boneUniformBuffer.BindBlock(shader);

            RModel.SetRenderSettingsUniforms(shader);
            RModel.SetCameraUniforms(camera, shader);

            RModel.DrawMeshes(Meshes, shader, boneUniformBuffer);
        }