private static void SetAlphaTesting(MaterialData mat, RenderInfoData r) { switch (r.Name) { case "gsys_alpha_test_enable": if (r.Value_String == "true") { } else { } break; case "gsys_alpha_test_func": if (r.Value_String == "lequal") { } else if (r.Value_String == "gequal") { } break; case "gsys_alpha_test_value": break; default: break; } }
private void SetRenderMode(MaterialData mat, RenderInfoData r, Mesh m) { switch (r.Name) { case "gsys_render_state_mode": if (r.Value_String == "transparent") { m.isTransparent = true; } if (r.Value_String == "alpha") { m.isTransparent = true; } if (r.Value_String == "mask") { m.isTransparent = true; } break; case "mode": if (r.Value_Int == 1) { } if (r.Value_Int == 2) { m.isTransparent = true; } break; } }
private static void SetDepthTesting(MaterialData mat, RenderInfoData r) { if (r.Type == Syroot.NintenTools.Bfres.RenderInfoType.String) { foreach (string value in r.Value_Strings) { switch (r.Name) { case "gsys_depth_test_enable": if (value == "true") { } else { } break; case "gsys_depth_test_func": if (value == "lequal") { } break; case "gsys_depth_test_write": break; default: break; } } } }
private void ReadRenderInfo(Material mat, Mesh poly) { foreach (RenderInfo rnd in mat.RenderInfos) { RenderInfoData r = new RenderInfoData(); r.Name = rnd.Name; r.Type = (Syroot.NintenTools.Bfres.RenderInfoType)rnd.Type; switch (rnd.Type) { case RenderInfoType.Int32: r.Value_Ints = rnd.GetValueInt32s(); break; case RenderInfoType.Single: r.Value_Floats = rnd.GetValueSingles(); break; case RenderInfoType.String: r.Value_Strings = rnd.GetValueStrings(); break; } poly.material.renderinfo.Add(r); SetAlphaBlending(poly.material, r); SetRenderMode(poly.material, r, poly); } }
private void SetAlphaBlending(MaterialData mat, RenderInfoData r) { switch (r.Name) { case "gsys_color_blend_rgb_src_func": if (r.Value_String == "src_alpha") { mat.srcFactor = 1; } break; case "gsys_color_blend_rgb_dst_func": if (r.Value_String == "one_minus_src_alpha") { mat.dstFactor = 1; } break; case "gsys_color_blend_rgb_op": if (r.Value_String == "add") { } break; case "gsys_color_blend_alpha_op": if (r.Value_String == "add") { } break; case "gsys_color_blend_alpha_src_func": if (r.Value_String == "one") { } break; case "gsys_color_blend_alpha_dst_func": if (r.Value_String == "zero") { } break; case "gsys_alpha_test_func": break; case "gsys_alpha_test_value": break; case "sourceColorBlendFactor": if (r.Value_String == "sourceAlpha") { mat.srcFactor = 1; } break; default: break; } }
private void SetRenderMode(MaterialData mat, RenderInfoData r, Mesh m) { if (r.Type == Syroot.NintenTools.Bfres.RenderInfoType.Int32) { foreach (int value in r.Value_Ints) { switch (r.Name) { case "mode": if (value == 1) { } if (value == 2) { m.isTransparent = true; } break; } } } if (r.Type == Syroot.NintenTools.Bfres.RenderInfoType.String) { foreach (string value in r.Value_Strings) { switch (r.Name) { case "gsys_render_state_mode": if (value == "transparent") { m.isTransparent = true; } if (value == "alpha") { m.isTransparent = true; } if (value == "mask") { m.isTransparent = true; } break; } } } }
private void SetAlphaBlending(MaterialData mat, RenderInfoData r) { if (r.Type == Syroot.NintenTools.Bfres.RenderInfoType.String) { foreach (string value in r.Value_Strings) { switch (r.Name) { case "gsys_color_blend_rgb_src_func": if (value == "src_alpha") { mat.srcFactor = 1; } break; case "gsys_color_blend_rgb_dst_func": if (value == "one_minus_src_alpha") { mat.dstFactor = 1; } break; case "gsys_color_blend_rgb_op": if (value == "add") { } break; case "gsys_color_blend_alpha_op": if (value == "add") { } break; case "gsys_color_blend_alpha_src_func": if (value == "one") { } break; case "gsys_color_blend_alpha_dst_func": if (value == "zero") { } break; case "gsys_alpha_test_func": break; case "gsys_alpha_test_value": break; case "sourceColorBlendFactor": if (value == "sourceAlpha") { mat.srcFactor = 1; } break; default: break; } } } }