使用#define指令模块化地创建着色器

作者:追风剑情 发布于:2016-3-6 13:38 分类:Shader

一、创建MyCgInclude.cginc文件 #ifndef MY_CG_INCLUDE #define MY_CG_INCLUDE fixed4 _MyColor; //半兰伯特光照模型 inline fixed4 LightingHalfLambert (SurfaceOutput s, fixed3 lightDir, fixed atten) { fixe...

阅读全文>>

标签: Shader

评论(0) 浏览(2828)

创建CgInclude文件来存储光照模型

作者:追风剑情 发布于:2016-3-5 19:52 分类:Shader

一、创建MyCgInclude.cginc文件 #ifndef MY_CG_INCLUDE #define MY_CG_INCLUDE fixed4 _MyColor; //半兰伯特光照模型 inline fixed4 LightingHalfLambert (SurfaceOutput s, fixed3 lightDir, fixed atten) { fixe...

阅读全文>>

标签: Shader

评论(0) 浏览(3748)

Debug.DrawLine()

作者:追风剑情 发布于:2016-3-3 15:26 分类:Unity3d

一、创建脚本 using UnityEngine; using System.Collections; public class DebugTest : MonoBehaviour { public Transform cube0; public Transform cube1; void Update() { Deb...

阅读全文>>

标签: Unity3d

评论(0) 浏览(6025)

Unity中的内置CgInclude文件

作者:追风剑情 发布于:2016-2-28 17:09 分类:Shader

你可以在Unity安装目录Editor/Data/CGIncludes/下找到内置的CgInclude文件。 在着色器对物体的渲染过程中它们各司其职,有些是处理阴影和光照的,有些是处理辅助函数的,有些是管理平台依赖关系的。 你可以访问http://docs.unity3d.com/Manual/SL-BuiltinIncludes.html来查找相关信息。 示例...

阅读全文>>

标签: Shader

评论(0) 浏览(3873)

求点到线段的最短距离

作者:追风剑情 发布于:2016-2-25 20:42 分类:Algorithms

线段的向量表示 p=at+b (0≤t≤1) 向量b为线段的起点,向量a是延着线段的向量。 问题:求点(x0, y0)到线段p的最短距离? 解题思路:将线段上的点p=at+b(0≤t≤1)与点(x0, y0)的距离表示为t的函数,然后对t进行微分,求得距离最小时的t。 向量p=at+b (0≤t≤1)可分解表示为:...

阅读全文>>

标签: Algorithms

评论(0) 浏览(4562)

判断一个整数的某个比特位是否为1

作者:追风剑情 发布于:2016-2-21 22:59 分类:C#

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BigPower { class Program { static void Main(string[] args) { ...

阅读全文>>

标签: C#

评论(0) 浏览(2752)

列表碎片——ListFragment

作者:追风剑情 发布于:2016-2-21 18:59 分类:Android

fragment1.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout...

阅读全文>>

标签: Android

评论(0) 浏览(2501)

摇杆

作者:追风剑情 发布于:2016-2-19 18:02 分类:GUI

摇杆脚本 using UnityEngine; using System; [ExecuteInEditMode] public class Joystick : MonoBehaviour { public enum JoystickAnchor { None, UpperLeft, UpperCenter, UpperRight, MiddleLeft, Midd...

阅读全文>>

标签: GUI

评论(0) 浏览(3902)

委托链——Delegate.Combine()

作者:追风剑情 发布于:2016-2-19 10:48 分类:C#

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CombineTest { public delegate void Log(string message); class Program { ...

阅读全文>>

标签: C#

评论(0) 浏览(5377)

行为树

作者:追风剑情 发布于:2016-2-17 15:46 分类:Unity3d

=====================行为树(Behavior Tree)框架代码====================== 父节点: using UnityEngine; using System.Collections.Generic; /// <summary> /// 父节点 /// </summary> publ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4545)

动态更改Shader属性值

作者:追风剑情 发布于:2016-2-15 17:36 分类:Shader

一、创建脚本 using UnityEngine; using System.Collections; public class ProceduralMaterialTest : MonoBehaviour { public Color mainColor; void Start () { renderer.materials[...

阅读全文>>

标签: Shader

评论(0) 浏览(5511)

系统语言检测——SystemLanguage

作者:追风剑情 发布于:2016-1-29 14:19 分类:Unity3d

using UnityEngine; using System.Collections; public class SystemLanguageTest : MonoBehaviour { void OnGUI() { GUI.color = Color.green; //系统语言检测 GUI.Label(new...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3018)

判断网络状态——NetworkReachability

作者:追风剑情 发布于:2016-1-29 14:10 分类:Unity3d

using UnityEngine; using System.Collections; public class InternetTest : MonoBehaviour { void OnGUI() { GUI.color = Color.green; GUI.Label(new Rect(20, 20, 500, 200),...

阅读全文>>

标签: Unity3d

评论(0) 浏览(7689)

输入管理器——Input Manager

作者:追风剑情 发布于:2016-1-28 15:50 分类:Unity3d

位于菜单 Edit->Project Settings->Input 字段解释参见: http://www.ceeger.com/Components/class-InputManager.html 对应脚本类Input http://www.ceeger.com/Script/Input/Input.html

阅读全文>>

标签: Unity3d

评论(0) 浏览(3939)

屏幕拾取

作者:追风剑情 发布于:2016-1-27 14:42 分类:Unity3d

示例一: 判断鼠标选中的物体 using UnityEngine; using System.Collections; public class ScreenPointToRayTest : MonoBehaviour { void Update() { if (Input.GetMouseButtonDown(0)) { ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(2946)

动画事件——AnimationEvent

作者:追风剑情 发布于:2016-1-27 11:17 分类:Unity3d

一、创建一个Cube并选中,   二、创建个脚本并挂在Cube上 using UnityEngine; using System.Collections; public class AnimationEventTest : MonoBehaviour { void Event0 () { print("Event0")...

阅读全文>>

标签: Unity3d

评论(0) 浏览(3936)

协程——Coroutine

作者:追风剑情 发布于:2016-1-26 14:31 分类:Unity3d

using UnityEngine; using System.Collections; public class YieldTest : MonoBehaviour { public void Awake() { print("Begin Awake"); //StartCoroutine("FunCoroutine1"); ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(4778)

获取设备信息——SystemInfo

作者:追风剑情 发布于:2016-1-25 14:45 分类:Unity3d

using UnityEngine; using System.Text; using System.Collections; public class SystemInfoTest : MonoBehaviour { void Start() { StringBuilder sb = new StringBuilder(); ...

阅读全文>>

标签: Unity3d

评论(0) 浏览(7411)

绘制纹理——GUI.DrawTexture()

作者:追风剑情 发布于:2016-1-21 11:22 分类:GUI

using UnityEngine; using System.Collections; public class DrawTextureTest : MonoBehaviour { public Texture aTexture; void OnGUI() { if (null == aTexture) { ...

阅读全文>>

标签: GUI

评论(0) 浏览(4647)

Profiler连接真机调试

作者:追风剑情 发布于:2016-1-20 10:44 分类:Unity3d

方案一、通过Wifi连接 方案二、通过ADB连接 步骤1: 打包   步骤2: 在cmd中执行adb 关闭windows的防火墙 adb forward tcp:54999 localabstract:Unity-包名   步骤3: 在unity中打开profiler窗口...

阅读全文>>

标签: Unity3d

评论(0) 浏览(9237)

NGUI绘制饼状图

作者:追风剑情 发布于:2016-1-18 19:22 分类:NGUI

using UnityEngine; using System.Collections; /// <summary> /// 饼状图 /// </summary> public class PieChart : MonoBehaviour { public UITexture texture; public int radius = 10;...

阅读全文>>

标签: NGUI

评论(0) 浏览(4412)

自定义光照模型

作者:追风剑情 发布于:2016-1-17 18:31 分类:Shader

一、创建Shader Shader "Custom/BlinnPhong" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _MainTint ("Diffuse Tint", Color) = (1,1,1,1)//色调 _SpecularColor ("Specular Color", Color)...

阅读全文>>

标签: Shader

评论(0) 浏览(3468)

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号