johnnymao.com
深度缓冲与画家算法 | Johnny Mao's blog
http://johnnymao.com/2016/03/07/GC
2016-03-07 Categorized in GC Algoritm. 深度缓冲的分辨率对于场景质量有很大的影响 当两个物体非常接近的时候,16位的深度缓冲区可能会导致 z缓冲区fighting 的人为噪声 使用24位或者32位的深度缓冲区就会表现得较好 由于精度太低,所以很少使用8位的深度缓冲区。 结果z'是在 -1到1之间归一化之后的值,其中近距near 平面位于 -1处,远距far平面位于1处。 F=far, N=near, Z=final return. Z=( f n)/(f-n) ( 1.
johnnymao.com
Unity碰撞检测中碰撞器与触发器的区别 | Johnny Mao's blog
http://johnnymao.com/2016/03/10/Unity碰撞检测中碰撞器与触发器的区别
2016-03-10 Categorized in Unity. 碰撞器 一群组件,它包含了很多种类,比如 Box Collider 盒碰撞体 ,Mesh Collider 网格碰撞体 等,这些碰撞器应用的场合不同,但都必须加到GameObjecet身上。 1MonoBehaviour.OnCollisionEnter(Collision collision) 当进入碰撞器. 2MonoBehaviour.OnCollisionExit(Collision collision) 当退出碰撞器. 3MonoBehaviour.OnCollisionStay(Collision collision) 当逗留碰撞器.
johnnymao.com
Java HashMap | Johnny Mao's blog
http://johnnymao.com/2016/04/28/Java-HashMap
1Iterate through the entrySet. It = mp.entrySet(). iterator. Pair = ( Map. Println(pair.getKey() " = ". Itremove(); / avoids a ConcurrentModificationException. 2Iterate through the keyset(). 3Iterate through the value(). Of the maps when you only need values:. 4Iterate through the entrySet(). If you want both key and value(different from method 1):. Value = entry.getValue();.
johnnymao.com
Java.IO | Johnny Mao's blog
http://johnnymao.com/2016/04/28/Java-IO
Buffered I/O Methods for Text Files. The java.nio.file package supports channel I/O, which moves data in buffers, bypassing some of the layers that can bottleneck stream I/O. Reading a File by Using Buffered Stream I/O. The newBufferedReader(Path, Charset) method opens a file for reading, returning a BufferedReader that can be used to read text from a file in an efficient manner. Charset charset = Charset.forName( "US-ASCII". Reader = Files.newBufferedReader(file, charset) {. System.out. println.
johnnymao.com
转-自适应网页设计 | Johnny Mao's blog
http://johnnymao.com/2016/03/09/自适应网页设计
2016-03-09 Categorized in Front-End. 手机的屏幕比较小,宽度通常在600像素以下 PC的屏幕宽度,一般都在1000像素以上 目前主流宽度是1366 768 ,有的还达到了2000像素。 2010年,Ethan Marcotte提出了自适应网页设计 Responsive Web Design 这个名词,指可以自动识别屏幕宽度、并做出相应调整的网页设计。 Content= "width=device-width, initial-scale=1". Viewport是网页默认的宽度和高度,上面这行代码的意思是,网页宽度默认等于屏幕宽度 width=device-width ,原始缩放比例 initial-scale=1 为1.0,即网页初始大小占屏幕面积的100%。 对于那些老式浏览器 主要是IE6、7、8 ,需要使用css3-mediaqueries.js。 If lt IE 9]. 字体也不能使用绝对大小 px ,而只能使用相对大小 em。 Helvetica, Arial, sans-serif. Screen and (max-device-width: 400px.
johnnymao.com
Java | Johnny Mao's blog
http://johnnymao.com/categories/Java
Reading articles in Java.
johnnymao.com
Android应用自适应分辨率的解决办法 | Johnny Mao's blog
http://johnnymao.com/2016/02/22/Android应用自适应分辨率的解决办法
2016-02-22 Categorized in Android. 在 /application 标签和 /manifest 标签之间添加上面那段代码。 Android 应用程序自适应屏幕大小和layout 的布局 一 不同的layout. Android手机屏幕大小不一,有480x320, 640x360, 800x480.怎样才能让App自动适应不同的屏幕呢 其实很简单,只需要在res目录下创建不同的layout文件夹,比如layout-640x360,layout-800x480,所有的layout文件在编译之. 1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),FWVGA (480x854). 还要说明一点 每个activity都有这个属性screenOrientation,每个activity都需要设置,可以设置为竖屏 portrait ,也可以. Xml version="1.0" encoding="utf-8"? Http:/ schemas.android.com/apk/res/android". Land do nothing is ok.
johnnymao.com
Unity Tips | Johnny Mao's blog
http://johnnymao.com/2016/04/04/Unity-Tips
2016-04-04 Categorized in Unity. Vector A (x,y,z) Vector B (x,y,z). The dot product of Vector A and Vector B is (Ax * Bx) (Ay * By) (Az * Bz) = Doc Product. This Value is usually check if this two vectors are perpendicular:. If the result is 0. Then this two vectors are perpendicular;. If the result is 1. Then they point in exactly the same direction;. If the result is -1. Then they point in exactly the opposite direction;. Description: Returns the squared length of this vector (Read Only). The result's ...
johnnymao.com
Algorithm | Johnny Mao's blog
http://johnnymao.com/categories/Algorithm
Reading articles in Algorithm.
johnnymao.com
#转#面试中的二叉树题目 | Johnny Mao's blog
http://johnnymao.com/2015/12/14/转-面试中的二叉树题目
2015-12-14 Categorized in Data structure. Http:/ blog.csdn.net/walkinginthewind/article/details/7518888. 二叉树节点定义如下 struct BinaryTreeNode { int m nValue; BinaryTreeNode* m pLeft; BinaryTreeNode* m pRight; };. 相关链接 轻松搞定面试中的链表题目 http:/ blog.csdn.net/luckyxiaoqiang/article/details/7393134. 前序遍历,中序遍历,后序遍历 4.分层遍历二叉树 按层次从上往下,从左往右. 2 如果二叉树不为空,二叉树节点个数 = 左子树节点个数 右子树节点个数 1. GetNodeNum(pRoot- m pLeft) GetNodeNum(pRoot- m pRight) 1. 2 如果二叉树不为空,二叉树的深度 = max(左子树深度, 右子树深度) 1. DepthLeft = GetDepth(pRoot- m pLeft);. 递归解法 ...
SOCIAL ENGAGEMENT