public void DepthSortModels(Vector3 cameraPosition) { if (NUD != null) { NUD.DepthSortMeshes(cameraPosition); } if (Bfres != null) { Bfres.DepthSortMeshes(cameraPosition); } }
public void Render(Camera camera, int depthMap, Matrix4 lightMatrix, Vector2 screenDimensions, bool drawShadow = false) { if (!Checked) { return; } Shader shader; // 3DS MBN shader = OpenTKSharedResources.shaders["Mbn"]; shader.UseProgram(); SetMbnUniforms(camera, shader); // Melee DAT shader = OpenTKSharedResources.shaders["Dat"]; shader.UseProgram(); SetDatUniforms(shader); if (Bch != null) { foreach (BCH_Model mo in Bch.Models.Nodes) { mo.Render(camera.MvpMatrix); } } if (DatMelee != null && OpenTKSharedResources.shaders["Dat"].ProgramCreatedSuccessfully) { DatMelee.Render(camera.MvpMatrix); } LightColor diffuseColor = Runtime.lightSetParam.characterDiffuse.diffuseColor; LightColor ambientColor = Runtime.lightSetParam.characterDiffuse.ambientColor; if (Kcl != null) { shader = OpenTKSharedResources.shaders["KCL"]; if (!shader.ProgramCreatedSuccessfully) { return; } shader.UseProgram(); shader.SetVector3("difLightColor", diffuseColor.R, diffuseColor.G, diffuseColor.B); shader.SetVector3("ambLightColor", ambientColor.R, ambientColor.G, ambientColor.B); Kcl.Render(camera.MvpMatrix); } if (Bfres != null) { Bfres.Render(camera, Runtime.drawNudColorIdPass); } if (NUD != null && OpenTKSharedResources.shaders["Nud"].ProgramCreatedSuccessfully && OpenTKSharedResources.shaders["NudDebug"].ProgramCreatedSuccessfully) { // Choose the appropriate shader. if (drawShadow) { shader = OpenTKSharedResources.shaders["Shadow"]; } else if (Runtime.renderType != Runtime.RenderTypes.Shaded) { shader = OpenTKSharedResources.shaders["NudDebug"]; } else { shader = OpenTKSharedResources.shaders["Nud"]; } shader.UseProgram(); // Matrices. Matrix4 lightMatrixRef = lightMatrix; shader.SetMatrix4x4("lightMatrix", ref lightMatrixRef); SetCameraMatrixUniforms(camera, shader); SetRenderSettingsUniforms(shader); SetLightingUniforms(shader, camera); shader.SetInt("renderType", (int)Runtime.renderType); shader.SetInt("debugOption", (int)Runtime.uvChannel); shader.SetBoolToInt("drawShadow", Runtime.drawModelShadow); shader.SetTexture("depthMap", depthMap, TextureTarget.Texture2D, 14); SetElapsedDirectUvTime(shader); NUD.Render(VBN, camera, drawShadow, Runtime.drawNudColorIdPass); } }