当前位置:网站首页>Unity grid programming 08
Unity grid programming 08
2022-06-23 08:44:00 【LittleU】
Using the previous grid programming method , Just know how to generate the mesh , Now the advanced API, Programming , So advanced api And previous api What are the differences ?
First, follow the previous method to understand , First of all, there is data like grid , And then all of a sudden open up space in the memory , Then assign these data to mesh On this component .
And if the model is complex enough , This is bound to cause huge computation in a certain frame .
If advanced api, Operate directly in the requested memory
First, the same as before , Add script dependencies , And assignment
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class AdvancedMultiStreamProceduralMesh : MonoBehaviour
...
var mesh = new Mesh
{
name = "Procedural Mesh"
};
GetComponent<MeshFilter>().mesh = mesh;
....This is the same as the previous code , There is no need to explain .
So first of all , This advanced API Usage of , First, you need to apply for a memory space , This memory space can be directly manipulated by code :
//1. Allocate writable grid data list , It can be more than one
MeshDataArray meshDataArray = Mesh.AllocateWritableMeshData(1);then , Save it again
var mesh = new Mesh
{
name = "Procedural Mesh"
};
Mesh.ApplyAndDisposeWritableMeshData(meshDataArray, mesh);
GetComponent<MeshFilter>().mesh = mesh;that , Same thing , The rest of the code , You need to add it here .
边栏推荐
- 谈谈 @Autowired 的实现原理
- How to evaluate code quality
- 4- draw ellipse, use timer
- Comprehensive analysis of news capture
- How to solve the problem that flv video stream cannot be played and TS file generation fails due to packet loss?
- 单编内核驱动模块
- [cloud computing] GFS ideological advantages and architecture
- Flutter achieves the effect of selecting seats in the cinema!
- kibana 重建index后,如何恢复Visualizations和 Dashboards
- 7-调色板-CALayer和触摸
猜你喜欢

RTSP/ONVIF协议视频平台EasyNVR启动服务报错“service not found”,该如何解决?

最常用的5中流ETL模式

谈谈 @Autowired 的实现原理

Why use growth neural gas network (GNG)?

Monitor the cache update of Eureka client

Why do we say that the data service API is the standard configuration of the data midrange?

In June, China database industry analysis report was released! Smart wind, train storage and regeneration

自组织映射神经网络(SOM)

点云库pcl从入门到精通 第十章

Qualcomm 9x07 two startup modes
随机推荐
USB peripheral driver - configfs
4-绘制椭圆、使用定时器
史上最污技术解读,60 个 IT 术语我居然秒懂了......
How to solve the problem that flv video stream cannot be played and TS file generation fails due to packet loss?
Fraction to recursing decimal
点云库pcl从入门到精通 第十章
XSS via host header
2- use line segments to form graphics and coordinate conversion
Easycvr accesses the website through the domain name. How to solve the problem that the video cannot be viewed back?
Introduction to typescript and basic types of variable definitions
6、 Web Architecture Design
How can easycvr access the Dahua CVS video recorder and download a video file with an empty name?
鸿蒙读取资源文件
Azure Active Directory brute force attack
Single core driver module
Map (set) operation in go language
kibana 重建index后,如何恢复Visualizations和 Dashboards
Arthas vmtool命令小结
438. Find All Anagrams in a String
高通9x07两种启动模式