Git代码管理

创建Git仓库

1
2
3
4
5
6
7

echo "# Git 工程" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/09jianfeng/AudioDemo.git
git push -u origin master

Mehr lesen

OpenGL全景播放

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma mark - 渲染
- (void)update {
float aspect = fabs(self.bounds.size.width / self.bounds.size.height);

//透视矩阵
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(self.overture), aspect, 0.1f, 400.0f);

//model矩阵
GLKMatrix4 modelViewMatrix = GLKMatrix4Identity;
modelViewMatrix = GLKMatrix4Scale(modelViewMatrix, 300.0, 300.0, 300.0);

GLKMatrix4 lookatMatrix = GLKMatrix4MakeLookAt(0, 0.0, 1.0, 0, 0, 0, 0, 1, 0);
_isLandscape = YES;
if (_isUsingMotion) {
if (_isLandscape) {
//顶点物体本身的x,y,z三个轴。
//注意: x,y,z是对应于承载这个opengl es层的那个view的x,y,z。竖屏x,y,z就是跟屏幕的x,y,z轴一致。如果是横屏,则x轴与y轴跟屏幕的是对调的。 opengl这里的model的坐标参考系是跟view的一致的。
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, -M_PI_2, 1.0f, 0.0f, 0.0f);
CMRotationMatrix a = _mineattitude.rotationMatrix;
GLKMatrix4 rotatoinMatri = GLKMatrix4Make(a.m11, a.m21, a.m31, 0.0f,
a.m12, a.m22, a.m32, 0.0f,
a.m13, a.m23, a.m33, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
//手机平放在桌面,陀螺仪的方向是对应着lookat矩阵代表的摄像头方向是只向Z方向。(也就是说把Lookat矩阵的开始方向要对着Z的方向),并且摄像机Up方向是Y正方向。
rotatoinMatri = GLKMatrix4RotateZ(rotatoinMatri, M_PI_2);

lookatMatrix = GLKMatrix4Multiply(lookatMatrix, rotatoinMatri);
//look at的坐标系就是手机y坐标方向是Y轴,x坐标方向是x轴,正对着手机的Z轴。
//注意:判断坐标系的时候要从模型最开始的状态,紧跟整个模型/摄像机在3D空间中的方向,然后再考虑摄像机应该绕着哪条轴旋转。不要被从手机看到的画面迷惑。 提示:可以把手机想象成整个3D模型中的一个平面,竖直放着手机,竖直方向是Y轴,横向是X轴,垂直于手机屏的是Z轴
lookatMatrix = GLKMatrix4RotateX(lookatMatrix, self.fingerRotationX);
//这里在屏幕上滑动的左右滑,为什么却是围绕着Z轴旋转? 想象一下上面的注释,提示:抬起手机的时候lookat矩阵已经是指向了的球体的顶部(陀螺仪的旋转矩阵导致的)。
lookatMatrix = GLKMatrix4RotateZ(lookatMatrix, -self.fingerRotationY);

}else{

{
//顶点物体本身的x,y,z三个轴。
//注意: x,y,z是对应于承载这个opengl es层的那个view的x,y,z。竖屏x,y,z就是跟屏幕的x,y,z轴一致。如果是横屏,则x轴与y轴跟屏幕的是对调的。 opengl这里的model的坐标参考系是跟view的一致的。
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, -M_PI_2, 1.0f, 0.0f, 0.0f);
CMRotationMatrix a = _mineattitude.rotationMatrix;
GLKMatrix4 rotatoinMatri = GLKMatrix4Make(a.m11, a.m21, a.m31, 0.0f,
a.m12, a.m22, a.m32, 0.0f,
a.m13, a.m23, a.m33, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
//手机平放在桌面,陀螺仪的方向是对应着lookat矩阵代表的摄像头方向是只向Z方向。(也就是说把Lookat矩阵的开始方向要对着Z的方向),并且摄像机Up方向是Y正方向。
lookatMatrix = GLKMatrix4Multiply(lookatMatrix, rotatoinMatri);
//look at的坐标系就是手机y坐标方向是Y轴,x坐标方向是x轴,正对着手机的Z轴。
//注意:判断坐标系的时候要从模型最开始的状态,紧跟整个模型/摄像机在3D空间中的方向,然后再考虑摄像机应该绕着哪条轴旋转。不要被从手机看到的画面迷惑。 提示:可以把手机想象成整个3D模型中的一个平面,竖直放着手机,竖直方向是Y轴,横向是X轴,垂直于手机屏的是Z轴
lookatMatrix = GLKMatrix4RotateX(lookatMatrix, self.fingerRotationX);
//这里在屏幕上滑动的左右滑,为什么却是围绕着Z轴旋转? 想象一下上面的注释,提示:抬起手机的时候lookat矩阵已经是指向了的球体的顶部(陀螺仪的旋转矩阵导致的)。
lookatMatrix = GLKMatrix4RotateZ(lookatMatrix, -self.fingerRotationY);
}

/*
{ //这个通过旋转LookAt矩阵得到的结果跟上面的先通过旋转 model的结果一样。只是上面的比较好理解
CMRotationMatrix a = _mineattitude.rotationMatrix;
GLKMatrix4 rotatoinMatri = GLKMatrix4Make(a.m11, a.m21, a.m31, 0.0f,
a.m12, a.m22, a.m32, 0.0f,
a.m13, a.m23, a.m33, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
lookatMatrix = GLKMatrix4Multiply(lookatMatrix, rotatoinMatri);
lookatMatrix = GLKMatrix4Rotate(lookatMatrix, -M_PI_2, 1.0f, 0.0f, 0.0f);
lookatMatrix = GLKMatrix4RotateX(lookatMatrix, self.fingerRotationX);
lookatMatrix = GLKMatrix4RotateY(lookatMatrix, self.fingerRotationY);
}
*/
}
}else{
lookatMatrix = GLKMatrix4RotateX(lookatMatrix, self.fingerRotationX);
lookatMatrix = GLKMatrix4RotateY(lookatMatrix, -self.fingerRotationY);
}

self.glkView.frame = self.frame;
self.modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, lookatMatrix);
self.modelViewProjectionMatrix = GLKMatrix4Multiply(self.modelViewProjectionMatrix, modelViewMatrix);
}

Mehr lesen

模版

Mehr lesen

metal vs opengl

顶点坐标

opengl 顶点/纹理坐标

不使用buffer的顶点坐标

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
GLfloat quadVertexData [] = {
-1,-1,
-1,1,
1,1,
1,-1,
};

// Update attribute values.
glVertexAttribPointer(ATTRIB_VERTEX_LOC, 2, GL_FLOAT, 0, 0, quadVertexData);
glEnableVertexAttribArray(ATTRIB_VERTEX);


GLfloat quadTextureData[] = {
0, 0,
0, 1,
1, 1,
1, 0
};
glVertexAttribPointer(ATTRIB_TEXCOORD_LOC, 2, GL_FLOAT, 0, 0, quadTextureData);
glEnableVertexAttribArray(ATTRIB_TEXCOORD);

Mehr lesen

描述文件获取UDID

一、创建网页快捷图标

步骤

首先给mac系统装一个工具。“iPhone 配置实用工具”。网上下载安装包:iPhoneConfigUtility.dmg。装好后在“Launchpad”里的“其它”里。运行它,并点击左上角的新建按钮创建一个配置描述文件。如下图设置:

Mehr lesen

SearchADS

苹果搜索广告投放后台

一些首字母缩写(acronyms)定义

    Mehr lesen

    ReactiveCocoa文档

    ReactiveCocoa github上已经去掉了相关文档,我这里存档一份

    NOTE: This is legacy introduction to the Objective-C ReactiveCocoa. For the
    updated version that uses Swift please see the main README

    Mehr lesen

    二叉树

    二叉树简介

    基本概念

    每个结点最多有两棵子树,左子树和右子树,次序不可以颠倒。

    Mehr lesen

    iOS Mach-O file type

    https://www.objc.io/issues/6-build-tools/mach-o-executables/

    Mehr lesen

    sublime text 2插件

    html自动补全工具

    打开sublime,mac下用command + shift + p调出命令窗口,输入install,选中package control:install package,等待1-2秒,下拉选中emmet plugin回车,等待2-3秒,重启sublime。

    Mehr lesen