新增线框模式 边线宽度可自定义

This commit is contained in:
shenjianxing 2025-05-09 16:15:12 +08:00
parent 06b0bac688
commit 90b1694ab8
4 changed files with 16 additions and 4 deletions

View File

@ -81,6 +81,10 @@ public class Body3DObjItem : MonoBehaviour
if (t.shader != null) if (t.shader != null)
{ {
GetComponent<Renderer>().material.shader = t.shader; GetComponent<Renderer>().material.shader = t.shader;
if (body.lineModeWidth != 0)
{
GetComponent<Renderer>().material.SetFloat("_OutlineWidth", body.lineModeWidth);
}
} }
else else
{ {

View File

@ -18,7 +18,8 @@ public class ObjectColorToggle : MonoBehaviour
private void Awake() private void Awake()
{ {
mesh = gameObject.GetComponent<MeshRenderer>(); mesh = gameObject.GetComponent<MeshRenderer>();
isOffColor = mesh.material.color; isOffColor = mesh.material.color;
savedTexture = mesh.material.mainTexture as Texture2D;
} }
public void SetColor(State state) public void SetColor(State state)
@ -28,7 +29,6 @@ public class ObjectColorToggle : MonoBehaviour
{ {
case State.On: case State.On:
isOnColor.a = alpha; isOnColor.a = alpha;
savedTexture = mesh.material.mainTexture as Texture2D;
mesh.material.mainTexture = null; mesh.material.mainTexture = null;
mesh.material.color = isOnColor; mesh.material.color = isOnColor;
break; break;
@ -39,7 +39,6 @@ public class ObjectColorToggle : MonoBehaviour
break; break;
case State.Hover: case State.Hover:
isHoverColor.a = alpha; isHoverColor.a = alpha;
savedTexture = mesh.material.mainTexture as Texture2D;
mesh.material.mainTexture = null; mesh.material.mainTexture = null;
mesh.material.color = isHoverColor; mesh.material.color = isHoverColor;
break; break;

View File

@ -186,6 +186,7 @@ namespace XMLTool
public Dictionary<string, Body> subBody { get; set; } = new Dictionary<string, Body>(); public Dictionary<string, Body> subBody { get; set; } = new Dictionary<string, Body>();
public Body parent; public Body parent;
public float lineModeWidth = 0;
//public Dictionary<string, Body> bodyList { get; set; } = new Dictionary<string, Body>(); //public Dictionary<string, Body> bodyList { get; set; } = new Dictionary<string, Body>();
} }
@ -440,6 +441,12 @@ namespace XMLTool
body.subBody.Add(subBody.Name, subBody); body.subBody.Add(subBody.Name, subBody);
} }
body.parent = parent; body.parent = parent;
var lineModeWidth = bodyElement.Attribute("lineModeWidth");
if (lineModeWidth != null)
{
float.TryParse(lineModeWidth.Value, out body.lineModeWidth);
}
return body; return body;
} }

View File

@ -12198,7 +12198,9 @@
</Body> </Body>
<Body name="胸内侧神经" englishName="Medial pectoral (C08,T01)" tip="胸内侧神经:发自臂丛内侧束,常与胸外侧神经分支联合,分布于胸小肌和部分胸大肌的神经。" path="Ren_NEW/SM_ShenJing/SM_nerve/SM_brachial_plexus/SM_left_brachial_plexus_and_its_branches/SM_branches_of_left_subclavian/SM_branches_of_left_medial_cord/XiongNeiCeShenJing"> <Body name="胸内侧神经" englishName="Medial pectoral (C08,T01)" tip="胸内侧神经:发自臂丛内侧束,常与胸外侧神经分支联合,分布于胸小肌和部分胸大肌的神经。" path="Ren_NEW/SM_ShenJing/SM_nerve/SM_brachial_plexus/SM_left_brachial_plexus_and_its_branches/SM_branches_of_left_subclavian/SM_branches_of_left_medial_cord/XiongNeiCeShenJing"
lineModeWidth="0.000003"
>