赞
踩
画线可以简化为正八棱柱
算法为:
两点A,B 向量AB 求向量AB的任意垂直向量,旋转垂直向量获得正半边形的顶点,通过顶点绘制三角形网格
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
-
- // 画线
- public class MeshLine
- {
- private Material material; // 材质
- private RepeatSegmentMesh segment_mesh;
- private RenderObject render_object;
- private MeshEnableFlag flag;
-
- public MeshLine()
- {
- this.material = GlobalAppData.Instance.Data.line_material;
- render_object = RenderObject.Create(null, null, Vector3.zero, Quaternion.identity);
- render_object.mesh_render.material = material;
- render_object.mesh_render.castShadows = true;
- render_object.mesh_render.receiveShadows = true;
- render_object.go.name = "MeshLine";
-
- //Light light = render_object.mesh_filter.GetComponent<Lighting>(
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。