当前位置: 首页 > news >正文

白银网站建设白银网站的付款链接怎么做

白银网站建设白银,网站的付款链接怎么做,dw中旅游网站怎么做,秦皇岛制作网站游戏视野剔除显示FieldOfViewRenderer 中文简介主要功能图片预览部分代码图形绘制器 DrawHelper基础扇形类定义shader美观优化 使用步骤:下载链接更新: EnglishFieldOfViewRenderer DescriptionDownload 中文 简介 游戏中的英雄,小怪等单位的视野显示.因为工作需求做了一个游戏… 游戏视野剔除显示FieldOfViewRenderer 中文简介主要功能图片预览部分代码图形绘制器 DrawHelper基础扇形类定义shader美观优化 使用步骤:下载链接更新: EnglishFieldOfViewRenderer DescriptionDownload 中文 简介 游戏中的英雄,小怪等单位的视野显示.因为工作需求做了一个游戏中单位的视野剔除显示的功能,网上相关资源太少,有的可能也不是很适合,比如没有剔除,功能不完善,性能开销太大等,最后用自己的方式实现了策划需求.查了下网上貌似没有这样做的,想到很多游戏项目估计都有这些需求,现在贡献出来,还请斧正.主要功能 通过配档显示敌人视野的范围.有障碍物的地方视野会剔除渲染.自定义shader,通过美术给定的图片采样渲染出不同透明度有渐变效果的纹理.代码简洁易懂,扩展性高.数据类型接口丰富,(如:可通过给定颜色改变视野颜色,以起到显示状态作用.)性能开销可调整,高质量的情况也不会开销太大.提供其他可行方案,供选择对比. 图片预览 下载包体里有详细的说明和录制视频,这里贴出预览图 部分代码 Demo全部代码都在Scripts文件夹里.命名和注释都一目了然,建议下载后直接看源码,这里简单介绍下. 图形绘制器 DrawHelper 主要就是通过Unity封装的GL类库直接绘制相应图形 入口函数是OnPostRender,包含此函数的脚本挂摄像机上,就会被每帧调用. 在其他地方调用AddSector和RemoveSector达到添加移除所需要绘制的扇形视野 当绘制器检测到有图形需要绘制的时候 就绘制, void OnPostRender(){if (allSectors.Count 0)DrawTriangle(allSectors);//绘制其他图形}private void DrawTriangle(ListSector sectors){if (sectors.Count 0) return;GL.PushMatrix();mat.SetPass(0);//GL.LoadOrtho();GL.Begin(GL.TRIANGLES);foreach (var sector in sectors){sector.PushGLVertex();}GL.End();GL.PopMatrix();}/// summary/// 添加需要绘制扇形(视野)/// /summary/// param namesector/parampublic void AddSector(Sector sector){if (allSectors.Contains(sector)) return;allSectors.Add(sector);}//正式项目中需要用到移除视野(如死亡的时候)public void RemoveSector(Sector sector){if (allSectors.Contains(sector))allSectors.Remove(sector);}基础扇形类 基础扇形类,就是小怪英雄等单位视野显示的图形. 扇形由许多小三角形拼合而成,三角形由顶点决定,而我们需要把被障碍物挡住的定点剔除, 所以剔除顶点,计算顶点,重构三角形是关键. 绘制出的图形需要和游戏单位保持相对固定的位置关系,所以需要转换坐标系同步更新位置. 最后,显示的图形不能直接显示到单位的眼睛上,而是显示到脚下,所以需要做一个偏移,虽然视野剔除还是从眼睛哪里发起的. public Transform origin;public float angleFov 90; //视野角度public float R 2f; //视野最远距离public float r 0.3f;public int quality 72; //越大质量越高(12的倍数)public float startAngle 0;public Color color Color.green; //视野颜色(可以通过改变颜色显示不同的状态,如看到敌人变红色)public Vector3[] vertices;/// summary/// 视野显示的高度/// /summarypublic float offsetY 0.2f;/// summary/// 将顶点等数据传送给GL/// /summarypublic void PushGLVertex(){GL.Color(color);int verCount 0;var vertices this.RefreshVertices();if (null vertices) return;int wholeCount vertices.Length - vertices.Length % 3;if (0 this.r)wholeCount vertices.Length;//以下为舍进算法,可能会导致渲染出的FOV和配档差一点点for (int i 0; i wholeCount; i){verCount;vertice vertices[i];GL.TexCoord2(GetUVx(vertice), 0.5f);GL.Vertex3(vertice.x, vertice.y, vertice.z);if (0 ! this.r){if (verCount 3 vertices.Length - i 3){i i - 2;verCount 0;}}else{if (verCount 2){if (vertices.Length - i 1){i--;}verCount 0;GL.TexCoord2(GetUVx(this.origin.position), 0.5f);GL.Vertex3(this.origin.position.x, this.origin.position.y, this.origin.position.z);}}}}/// summary/// 更新扇形顶点数据/// /summary/// returns/returnspublic Vector3[] RefreshVertices(){startAngle origin.eulerAngles.y angleFov / 2;float angleCurr startAngle;offsetVec3 new Vector3(origin.position.x, offsetY, origin.position.z);for (int i 0; i quality; i){Vector3 curVec new Vector3();curVec.z Mathf.Cos(Mathf.Deg2Rad * angleCurr);curVec.x Mathf.Sin(Mathf.Deg2Rad * angleCurr);Vector3 posCurrMax;RaycastHit hit;//Debug.DrawRay(origin.position, curVec * R, Color.green,0.1f);//可以取消此行注释显示扫描射线//if (Physics.Raycast(origin.position, curVec * R, out hit, R, ~(int)Layers.Corpse))//可以过滤掉某些层if (Physics.Raycast(origin.position, curVec * R, out hit, R)){posCurrMax curVec * Vector3.Distance(hit.point, origin.position) offsetVec3;//Debug.DrawLine(origin.position,hit.point,Color.red,0.1f);}else{posCurrMax curVec * R offsetVec3;}Vector3 posCurrMin curVec * r offsetVec3;if (0 ! r){vertices[2 * i] posCurrMin;vertices[2 * i 1] posCurrMax;}else{vertices[i] posCurrMax;}angleCurr - angleDelta;}return vertices;}定义shader美观优化 计划的功能都实现出来了,骚策划还不满足,需要再在视觉上优化下,要根据视野远近来个强弱渐变 自定义一个shader实现. 在计算扇形的时候需要抓取UV,以便shader里做渐变渲染. //获取UVprivate float GetUVx(Vector3 vertex){return Mathf.Clamp01(Vector3.SqrMagnitude(vertex - origin.position) / (R * R));}// GL.TexCoord2(GetUVx(vertice), 0.5f);SubShader{Tags { RenderType Transparent }LOD 100Pass{Blend SrcAlpha OneMinusSrcAlphaCull OffCGPROGRAM#pragma vertex vert#pragma fragment frag#include UnityCG.cgincstruct appdata{float4 vertex : POSITION;float2 uv : TEXCOORD0;float4 color : COLOR;};struct v2f{float2 uv : TEXCOORD0;float4 vertex : SV_POSITION;float4 color : TEXCOORD1;};float4 _FieldColor;sampler2D _AlphaTex;float4 _AlphaTex_ST;v2f vert (appdata v){v2f o;o.vertex UnityObjectToClipPos(v.vertex);o.uv v.uv;o.color v.color;return o;}fixed4 frag (v2f i) : SV_Target{fixed4 col _FieldColor;return fixed4(i.color.rgb, tex2D(_AlphaTex, i.uv).r);}ENDCG}} 使用步骤: 导入下载的包体,打开里面的Demo场景即可预览使用.打上合适的灯光会更好看.若存在问题或者需要修改请执行以下步骤. 1. 将在MainCamera上添加DrawHelper绘制器,并绑定材质FieldOfViewRenderer. 2. 在你的单位的眼睛或者虚拟点上添加Eye脚本(也可以在脚本里面添加一个eyeTrans的变量,这样脚本可以放在单位根节点,只需要初始化eyeTrans即可) 不明白可以看截图和视频 (之前在网上找到了一个通过摄像机剔除而渲染视野的方案,功能满足,但是开销太大,根本没法用到工程中(加入后20帧).于是采用GL底层直接渲染视野.此方案不需要创建mesh,并且所有的视野图形都一批渲染出来,不会像mesh渲染那样可能分批次.之所以不叫FieldOfVisionRenderer是为了和网上的某方案区分) 下载链接 https://download.csdn.net/download/qq_19646749/11033676 转载请注明出处 (*_^) (若下载不了 请告诉我) 更新: 2019/03/18 加入了滑动框选功能 详情见FieldOfViewRenderer_andBoxSelect.unitypackage(Unity2018.3.5) English FieldOfViewRenderer Description It is used for the enemy’s vision field in the game. Main functions: Display the enemy’s range of vision.The vision field with obstacles won’t be rendered.Customize shader to render texture with gradient effect with different transparency by sampling images given by art staff.The code is simple and easy to understand, with high expansibility. (for example, the view color can be changed by a given color to display the state).It costs little even you set it to high quality. The performance cost can be adjusted.(It is better than some other’s solution.)Provide other suitable way for comparison and selection. Use steps: Importing the package,openning the Demo scene,then you can preview it. If there are problems or need to modify, please perform the following steps. Drag the DrawHelper(script) into to the MainCamera and Drag the FieldOfViewRenderer(material) into the Mat.Add the Eye(script) to your unit’s eye or virtual point . Update: I add BoxSelect-module in this project at 03/18/2019 . Inporting FieldOfViewRenderer_andBoxSelect.unitypackage to see detail. Unity Version:2017.4.2f2 thank u very much !Download https://download.csdn.net/download/qq_19646749/11033676 Reprint please indicate the source
文章转载自:
http://www.morning.mkpqr.cn.gov.cn.mkpqr.cn
http://www.morning.gmswp.cn.gov.cn.gmswp.cn
http://www.morning.plqsc.cn.gov.cn.plqsc.cn
http://www.morning.hmgqy.cn.gov.cn.hmgqy.cn
http://www.morning.wfbs.cn.gov.cn.wfbs.cn
http://www.morning.pmmrb.cn.gov.cn.pmmrb.cn
http://www.morning.ypfw.cn.gov.cn.ypfw.cn
http://www.morning.hmxrs.cn.gov.cn.hmxrs.cn
http://www.morning.pkmcr.cn.gov.cn.pkmcr.cn
http://www.morning.krnzm.cn.gov.cn.krnzm.cn
http://www.morning.jbtwq.cn.gov.cn.jbtwq.cn
http://www.morning.dmjhp.cn.gov.cn.dmjhp.cn
http://www.morning.qbxdt.cn.gov.cn.qbxdt.cn
http://www.morning.wcczg.cn.gov.cn.wcczg.cn
http://www.morning.rxdsq.cn.gov.cn.rxdsq.cn
http://www.morning.hxhrg.cn.gov.cn.hxhrg.cn
http://www.morning.ydfr.cn.gov.cn.ydfr.cn
http://www.morning.txkrc.cn.gov.cn.txkrc.cn
http://www.morning.qsszq.cn.gov.cn.qsszq.cn
http://www.morning.rngyq.cn.gov.cn.rngyq.cn
http://www.morning.hhqjf.cn.gov.cn.hhqjf.cn
http://www.morning.gediba.com.gov.cn.gediba.com
http://www.morning.nhrkc.cn.gov.cn.nhrkc.cn
http://www.morning.pwghp.cn.gov.cn.pwghp.cn
http://www.morning.fhqdb.cn.gov.cn.fhqdb.cn
http://www.morning.tgmwy.cn.gov.cn.tgmwy.cn
http://www.morning.gchqy.cn.gov.cn.gchqy.cn
http://www.morning.jnhhc.cn.gov.cn.jnhhc.cn
http://www.morning.mrfr.cn.gov.cn.mrfr.cn
http://www.morning.diuchai.com.gov.cn.diuchai.com
http://www.morning.qbgff.cn.gov.cn.qbgff.cn
http://www.morning.xjkfb.cn.gov.cn.xjkfb.cn
http://www.morning.gcqs.cn.gov.cn.gcqs.cn
http://www.morning.rpjr.cn.gov.cn.rpjr.cn
http://www.morning.dbxss.cn.gov.cn.dbxss.cn
http://www.morning.gtxrw.cn.gov.cn.gtxrw.cn
http://www.morning.qwmdx.cn.gov.cn.qwmdx.cn
http://www.morning.lyzwdt.com.gov.cn.lyzwdt.com
http://www.morning.pghgq.cn.gov.cn.pghgq.cn
http://www.morning.bgnkl.cn.gov.cn.bgnkl.cn
http://www.morning.kmcfw.cn.gov.cn.kmcfw.cn
http://www.morning.xxwhz.cn.gov.cn.xxwhz.cn
http://www.morning.jcpq.cn.gov.cn.jcpq.cn
http://www.morning.bpwfr.cn.gov.cn.bpwfr.cn
http://www.morning.bqmhm.cn.gov.cn.bqmhm.cn
http://www.morning.bwnd.cn.gov.cn.bwnd.cn
http://www.morning.ktdqu.cn.gov.cn.ktdqu.cn
http://www.morning.qkrzn.cn.gov.cn.qkrzn.cn
http://www.morning.txfzt.cn.gov.cn.txfzt.cn
http://www.morning.fhjnh.cn.gov.cn.fhjnh.cn
http://www.morning.wqmyh.cn.gov.cn.wqmyh.cn
http://www.morning.hkng.cn.gov.cn.hkng.cn
http://www.morning.nmfwm.cn.gov.cn.nmfwm.cn
http://www.morning.wpcfm.cn.gov.cn.wpcfm.cn
http://www.morning.mmxt.cn.gov.cn.mmxt.cn
http://www.morning.bzpwh.cn.gov.cn.bzpwh.cn
http://www.morning.httpm.cn.gov.cn.httpm.cn
http://www.morning.tstwx.cn.gov.cn.tstwx.cn
http://www.morning.mrckk.cn.gov.cn.mrckk.cn
http://www.morning.bkpbm.cn.gov.cn.bkpbm.cn
http://www.morning.qxgmp.cn.gov.cn.qxgmp.cn
http://www.morning.zjrnq.cn.gov.cn.zjrnq.cn
http://www.morning.fynkt.cn.gov.cn.fynkt.cn
http://www.morning.ysckr.cn.gov.cn.ysckr.cn
http://www.morning.rtbhz.cn.gov.cn.rtbhz.cn
http://www.morning.tzrmp.cn.gov.cn.tzrmp.cn
http://www.morning.nclbk.cn.gov.cn.nclbk.cn
http://www.morning.xfmzk.cn.gov.cn.xfmzk.cn
http://www.morning.kxqmh.cn.gov.cn.kxqmh.cn
http://www.morning.fjkkx.cn.gov.cn.fjkkx.cn
http://www.morning.htfnz.cn.gov.cn.htfnz.cn
http://www.morning.crqpl.cn.gov.cn.crqpl.cn
http://www.morning.gjlxn.cn.gov.cn.gjlxn.cn
http://www.morning.rqrh.cn.gov.cn.rqrh.cn
http://www.morning.drhnj.cn.gov.cn.drhnj.cn
http://www.morning.yrccw.cn.gov.cn.yrccw.cn
http://www.morning.bxrlt.cn.gov.cn.bxrlt.cn
http://www.morning.dlwzm.cn.gov.cn.dlwzm.cn
http://www.morning.rycd.cn.gov.cn.rycd.cn
http://www.morning.mmhyx.cn.gov.cn.mmhyx.cn
http://www.tj-hxxt.cn/news/251594.html

相关文章:

  • 网站建设什么原因最主要安徽省交通运输厅网站
  • 有机蔬菜哪个网站做的更好怎么做网页版网站
  • 呼市网站制作宁波小程序网络开发公司
  • 网站集群建设熊掌号网站的基础建设费用
  • 建材家居网站模板开发一个网站大概多少钱
  • 郑州专业公司网站制作公司wordpress 脚本慢
  • 如何找客户资源网站建设公司专业的建站优化公司
  • 漫画网站怎么做谷歌网站推广优化
  • 济南手工网站建设seo网站结构优化
  • 福永网站设计东营黄页企业名录
  • wordpress修改我要注册链接seo新人培训班
  • 做一个网站花多少钱抛丸机网站排名优化
  • 网站建设费摊销wordpress怎么放音乐
  • 广州大石附近做网站的公司哪家好本地搭建的wordpress怎么外网访问
  • saas建站源码下载做哪些网站可以赚钱的
  • 查内部券的网站是怎么做的织梦网站档目管理空白
  • 百度不收录哪些网站多网站管理
  • 毕业设计报告网站开发网站推广优化业务
  • 商城网站是怎么做的商城软件下载
  • 做优惠卷网站房地产平面设计网站
  • 深圳通信管理局网站公司名称设计logo免费
  • 做好对外门户网站建设淮北做网站
  • 哪个公司建设网站惠安网站建设价格
  • 自己做网站用中文为什么是乱码cms开发
  • 免费微信网站模板下载海鲜网站开发目的在于
  • 基于php网站开发环境php商城网站开发实例视频教程
  • 医院网站如何备案建设工程信息网站
  • 我想网站建设多少钱android软件开发下载
  • 建网站需要哪些条件公司做两个网站有影响吗
  • 制作网站入门广州做外贸网站建设