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)); } } } } }
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); } } } } }
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); } } } }
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); }