//
// 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实例开发源码——kylcrow-SampleGame-44bb8e4.zip
共593个文件
o:228个
h:120个
m:103个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 170 浏览量
2023-07-02
15:13:40
上传
评论
收藏 10.85MB ZIP 举报
温馨提示
iOS实例开发源码——kylcrow-SampleGame-44bb8e4.zip
资源推荐
资源详情
资源评论
收起资源包目录
iOS实例开发源码——kylcrow-SampleGame-44bb8e4.zip (593个子文件)
libcocos2d libraries.a 3.85MB
libcocos2d libraries.a 3.62MB
glu.c 3KB
base64.c 2KB
ccUtils.c 364B
background-music-aac.caf 255KB
background-music-aac.caf 255KB
background-music-aac.caf 255KB
pew-pew-lei.caf 52KB
pew-pew-lei.caf 52KB
pew-pew-lei.caf 52KB
explosion.caf 18KB
explosion.caf 18KB
explosion.caf 18KB
LICENSE.cocos2d 1KB
Cocos2DSimpleGame 1.67MB
Cocos2DSimpleGame 1.51MB
Cocos2DSimpleGame 1.48MB
Cocos2DSimpleGame 1.43MB
LICENSE.cocosdenshion 1KB
CodeResources 2KB
CodeResources 28B
control 512KB
build-state~.dat 375KB
build-state.dat 375KB
build-state~.dat 354KB
build-state.dat 354KB
build-state.dat 134KB
build-state.dat 127KB
build-state~.dat 99KB
build-state~.dat 91KB
cocos2d libraries~.dep 25KB
cocos2d libraries.dep 25KB
cocos2d libraries~.dep 24KB
cocos2d libraries.dep 24KB
Cocos2DSimpleGame.dep 10KB
Cocos2DSimpleGame.dep 10KB
Cocos2DSimpleGame~.dep 8KB
Cocos2DSimpleGame~.dep 7KB
uthash.h 63KB
utlist.h 36KB
CCNode.h 17KB
CCCompatibility.h 14KB
CCParticleSystem.h 14KB
CocosDenshion.h 14KB
CCSprite.h 13KB
CCMenuItem.h 13KB
CCActionInterval.h 13KB
ccCArray.h 12KB
CCTexture2D.h 11KB
CCDirectorIOS.h 11KB
ccConfig.h 9KB
CCDirector.h 9KB
CDAudioManager.h 9KB
CCTransition.h 8KB
CGPointExtension.h 8KB
ccMacros.h 7KB
EAGLView.h 7KB
CCActionGrid3D.h 7KB
CCActionTiledGrid.h 7KB
CCEventDispatcher.h 7KB
CCScheduler.h 6KB
CCSpriteBatchNode.h 6KB
CCLayer.h 6KB
CCTMXLayer.h 6KB
ccTypes.h 6KB
CCTMXXMLParser.h 6KB
CCAction.h 6KB
CCActionEase.h 6KB
CCLabelBMFont.h 6KB
CCTMXTiledMap.h 5KB
CCTextureCache.h 5KB
CCActionGrid.h 5KB
CCTextureAtlas.h 5KB
CCSpriteFrameCache.h 5KB
CCAnimation.h 5KB
CCActionInstant.h 4KB
OpenGL_Internal.h 4KB
cocos2d.h 4KB
CLScoreServerRequest.h 4KB
CLScoreServerPost.h 4KB
CCTouchDispatcher.h 4KB
CCActionManager.h 4KB
CCRibbon.h 4KB
CCProtocols.h 4KB
FontLabelStringDrawing.h 4KB
CCRenderTexture.h 4KB
SimpleAudioEngine.h 4KB
CCGrid.h 4KB
CCTexturePVR.h 3KB
CCTouchHandler.h 3KB
CCSpriteFrame.h 3KB
CCConfiguration.h 3KB
CDOpenALSupport.h 3KB
FontManager.h 3KB
CCDrawingPrimitives.h 3KB
ZAttributedString.h 3KB
CCAtlasNode.h 3KB
CCGL.h 3KB
CCArray.h 3KB
共 593 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
快乐无限出发
- 粉丝: 1143
- 资源: 7294
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- win10-64位画图cab安装包Microsoft-Windows-MSPaint
- 基于C#财务管理系统设计与实现
- 封装redis常用基本命令.zip
- 基于python的图书推荐管理系统设计与实现
- Termius 7.13.0 (windows免登录版)
- 基于STM32F072C8T6单片机PWM波控制蜂鸣器实验软件例程 KEIL工程源码+核心板硬件PDF原理图.zip
- debian package
- Redis 命令脑图.zip
- 机器学习使用Stable Diffusion实现潜在空间搜索
- 基于Python+tkinter+MySQL的图书管理系统+设计报告+PPT(课程设计高分项目).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功