91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6KB
    文件類型: .cs
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-10
  • 語言: C#
  • 標(biāo)簽: Unity3d??Meth??溫度云圖??

資源簡(jiǎn)介

Unity3d使用Meth實(shí)現(xiàn)溫度云圖,看了網(wǎng)上有幾個(gè)使用Shader實(shí)現(xiàn)的溫度云圖,基本都是寫死的,并且代碼都有毛病出不來效果,所以就用Meth實(shí)現(xiàn)了一個(gè),溫度點(diǎn)位能動(dòng)態(tài)。行列動(dòng)態(tài)創(chuàng)建,只需要自己給一個(gè)數(shù)值。創(chuàng)建一個(gè)空物體然后附上代碼,再把空物體添加MethRenderer和MethFilter即可出現(xiàn)效果,本人親自調(diào)試過,如果有問題可以問我一塊探討。

資源截圖

代碼片段和文件信息

using?UnityEngine;
using?System.Collections;
using?System.Collections.Generic;

public?class?MethTest?:?MonoBehaviour
{

????public?Vector3[]?vertices?=?null;???//頂點(diǎn)取樣個(gè)數(shù)
????public?Color[]?colors?=?null;//每個(gè)定點(diǎn)對(duì)應(yīng)的顏色?會(huì)自動(dòng)進(jìn)行插值
????private?int[]?m_yellow?=?{?10?11?12?13?17?18?19?20?21?22?25?26?27?28?29?30?34?35?36?37?};
????private?int[]?m_blue?=?{?0?1?2?3?4?5?6?7?8?16?24?32?40?41?42?43?44?45?46?47?};
????private?int[]?m_Red?=?{?18?19?20?21?26?27?28?29?};
????public?Transform?jigui_s;
????private?float?Wendu?=?50;//設(shè)置溫度
????private?float?time?=?2;

????//定義行和列
????public?int?hang;
????public?int?lie;
????//行和列的間距
????public?float?hjj;



????//定義三角形定點(diǎn)數(shù)的數(shù)組?
????public?int[]?triangles?=?null;



????void?Start()
????{
????????DelegeteToUpdate();
????}
????void?Update()
????{
????????time?-=?Time.deltaTime;
????????if?(time<=0)
????????{
????????????time?=?2;
????????????DelegeteToUpdate();
????????}

????}

????void?DelegeteToUpdate()
????{
????????Listject>?jigui_Name?=?new?Listject>();
????????List?list_pos?=?new?List();
????????//獲取所有機(jī)柜的坐標(biāo)保存到list集合中
????????foreach?(Transform?item?in?jigui_s)
????????{
????????????Vector3?jigui_pos?=?item.transform.position;
????????????list_pos.Add(jigui_pos);
????????}
???????

????????int?tCount?=?0;
????????//三角形數(shù)量
????????int?triangleCount?=?hang?*?2?*?lie;
????????//三角形頂點(diǎn)數(shù)量
????????int?triangleCountPoint?=?hang?*?2?*?lie?*?3;

????????vertices?=?new?Vector3[(hang?+?1)?*?(lie?+?1)];
????????triangles?=?new?int[triangleCountPoint];//三角形的定點(diǎn)索引
????????colors?=?new?Color[(hang?+?1)?*?(lie?+?1)];

????????MeshFilter?filter?=?gameobject.GetComponent();
????????MeshRenderer?render?=?gameobject.GetComponent();
????????Shader?shader?=?Shader.Find(“Sprites/Default“);
????????render.material?=?new?Material(shader);
????????filter.mesh?=?new?Mesh();
????????Mesh?mesh?=?filter.mesh;

????????//全部畫在第一象限

????????for?(int?i?=?hang;?i?>=?0;?i--)
????????{
????????????for?(int?j?=?0;?j?<=?lie;?j++)
????????????{

????????????????vertices[tCount]?=?new?Vector3(j?*?hjj?0?i?*?hjj);
????????????????tCount++;

????????????}
????????}

????????int?point?=?0;

????????for?(int?i?=?0;?i?????????{
????????????for?(int?j?=?0;?j?????????????{
????????????????triangles[point++]?=?i?*?(lie?+?1)?+?j;
????????????????triangles[point]?=?i?*?(lie?+?1)?+?j?+?1;
????????????????int?a?=?triangles[point++];
????????????????triangles[point]?=?a?+?lie;
????????????????int?b?=?triangles[point++];
????????????????triangles[point++]?=?a;
????????????????triangles[p

評(píng)論

共有 條評(píng)論