//
// cocos2d (incomplete) GLU implementation
//
// gluLookAt and gluPerspective from:
// http://jet.ro/creations (San Angeles Observation)
//
//
// Only compile this code on iOS. These files should NOT be included on your Mac project.
// But in case they are included, it won't be compiled.
#import <Availability.h>
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#import <OpenGLES/ES1/gl.h>
#import <math.h>
#import "../../Support/OpenGL_Internal.h"
#include "glu.h"
void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
{
GLfloat xmin, xmax, ymin, ymax;
ymax = zNear * (GLfloat)tanf(fovy * (float)M_PI / 360);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;
glFrustumf(xmin, xmax,
ymin, ymax,
zNear, zFar);
}
void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
GLfloat centerx, GLfloat centery, GLfloat centerz,
GLfloat upx, GLfloat upy, GLfloat upz)
{
GLfloat m[16];
GLfloat x[3], y[3], z[3];
GLfloat mag;
/* Make rotation matrix */
/* Z vector */
z[0] = eyex - centerx;
z[1] = eyey - centery;
z[2] = eyez - centerz;
mag = (float)sqrtf(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
if (mag) {
z[0] /= mag;
z[1] /= mag;
z[2] /= mag;
}
/* Y vector */
y[0] = upx;
y[1] = upy;
y[2] = upz;
/* X vector = Y cross Z */
x[0] = y[1] * z[2] - y[2] * z[1];
x[1] = -y[0] * z[2] + y[2] * z[0];
x[2] = y[0] * z[1] - y[1] * z[0];
/* Recompute Y = Z cross X */
y[0] = z[1] * x[2] - z[2] * x[1];
y[1] = -z[0] * x[2] + z[2] * x[0];
y[2] = z[0] * x[1] - z[1] * x[0];
/* cross product gives area of parallelogram, which is < 1.0 for
* non-perpendicular unit-length vectors; so normalize x, y here
*/
mag = (float)sqrtf(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
if (mag) {
x[0] /= mag;
x[1] /= mag;
x[2] /= mag;
}
mag = (float)sqrtf(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
if (mag) {
y[0] /= mag;
y[1] /= mag;
y[2] /= mag;
}
#define M(row,col) m[col*4+row]
M(0, 0) = x[0];
M(0, 1) = x[1];
M(0, 2) = x[2];
M(0, 3) = 0.0f;
M(1, 0) = y[0];
M(1, 1) = y[1];
M(1, 2) = y[2];
M(1, 3) = 0.0f;
M(2, 0) = z[0];
M(2, 1) = z[1];
M(2, 2) = z[2];
M(2, 3) = 0.0f;
M(3, 0) = 0.0f;
M(3, 1) = 0.0f;
M(3, 2) = 0.0f;
M(3, 3) = 1.0f;
#undef M
glMultMatrixf(m);
/* Translate Eye to Origin */
glTranslatef(-eyex, -eyey, -eyez);
}
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED
没有合适的资源?快使用搜索试试~ 我知道了~
iOS游戏应用源代码——shadowboy-Crunching-bcdb02f.zip
共1569个文件
o:689个
png:345个
h:135个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 48 浏览量
2023-07-05
23:23:49
上传
评论
收藏 50.5MB ZIP 举报
温馨提示
iOS游戏应用源代码——shadowboy-Crunching-bcdb02f.zip
资源推荐
资源详情
资源评论
收起资源包目录
iOS游戏应用源代码——shadowboy-Crunching-bcdb02f.zip (1569个子文件)
libcocos2d libraries.a 7.03MB
libGoogleAdMobAds.a 7MB
libcocos2d libraries.a 3.75MB
libcocos2d libraries.a 3.61MB
libcocos2d libraries.a 3.55MB
libcocos2d libraries.a 3.48MB
libcocos2d libraries.a 3.35MB
glu.c 3KB
base64.c 2KB
ccUtils.c 364B
background-music-aac.caf 255KB
background-music-aac.caf 255KB
background-music-aac.caf 255KB
background-music-aac.caf 255KB
atm_1.caf 61KB
fbm_1.caf 61KB
push_1.caf 61KB
push_1.caf 61KB
atm_1.caf 61KB
fbm_1.caf 61KB
atm_1.caf 61KB
fbm_1.caf 61KB
push_1.caf 61KB
atm_1.caf 61KB
fbm_1.caf 61KB
fbm_2.caf 57KB
atm_2.caf 57KB
push_2.caf 57KB
push_2.caf 57KB
fbm_2.caf 57KB
atm_2.caf 57KB
fbm_2.caf 57KB
atm_2.caf 57KB
push_2.caf 57KB
fbm_2.caf 57KB
atm_2.caf 57KB
push_3.caf 51KB
atm_3.caf 51KB
fbm_3.caf 51KB
push_3.caf 51KB
atm_3.caf 51KB
fbm_3.caf 51KB
push_3.caf 51KB
atm_3.caf 51KB
fbm_3.caf 51KB
atm_3.caf 51KB
fbm_3.caf 51KB
push_0.caf 27KB
fbm_0.caf 27KB
atm_0.caf 27KB
push_0.caf 27KB
fbm_0.caf 27KB
atm_0.caf 27KB
push_0.caf 27KB
fbm_0.caf 27KB
atm_0.caf 27KB
fbm_0.caf 27KB
atm_0.caf 27KB
button_click.caf 8KB
button_click.caf 8KB
button_click.caf 8KB
button_click_1.caf 8KB
LICENSE.cocos2d 1KB
LICENSE.cocosdenshion 1KB
CodeResources 8KB
CodeResources 7KB
control 512KB
Crunching2 3.99MB
Crunching2 3.36MB
Crunching2 3.26MB
Crunching2 3.06MB
Crunching2 2.48MB
Crunching2 2.17MB
Crunching2 1.43MB
Crunching2 1.21MB
Crunching2 1.13MB
Crunching2 1.02MB
build-state.dat 1.21MB
build-state~.dat 1.2MB
build-state.dat 962KB
build-state.dat 877KB
build-state~.dat 877KB
build-state.dat 773KB
build-state.dat 640KB
build-state~.dat 640KB
build-state~.dat 362KB
build-state.dat 362KB
build-state.dat 273KB
build-state~.dat 192KB
build-state.dat 172KB
build-state~.dat 139KB
build-state~.dat 87KB
build-state~.dat 52KB
Crunching2.dep 130KB
Crunching2~.dep 130KB
Crunching2.dep 110KB
cocos2d libraries~.dep 97KB
cocos2d libraries.dep 97KB
cocos2d libraries.dep 95KB
cocos2d libraries~.dep 48KB
共 1569 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
快乐无限出发
- 粉丝: 1126
- 资源: 7260
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功