//
// cocos2d (incomplete) GLU implementation
//
// gluLookAt and gluPerspective from:
// http://jet.ro/creations (San Angeles Observation)
//
//
#import <OpenGLES/ES1/gl.h>
#import <math.h>
#import "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
{
int a;
GLfloat fixedM[16];
for (a = 0; a < 16; ++a)
fixedM[a] = m[a];
glMultMatrixf(fixedM);
}
/* Translate Eye to Origin */
glTranslatef(-eyex, -eyey, -eyez);
}
没有合适的资源?快使用搜索试试~ 我知道了~
iOS游戏应用源代码——torrez-MatchGame-619986c.zip
共182个文件
h:81个
m:73个
png:11个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 14 浏览量
2023-07-05
23:24:24
上传
评论
收藏 539KB ZIP 举报
温馨提示
iOS游戏应用源代码——torrez-MatchGame-619986c.zip
资源推荐
资源详情
资源评论
收起资源包目录
iOS游戏应用源代码——torrez-MatchGame-619986c.zip (182个子文件)
Default.acorn 208KB
card-back.acorn 49KB
shuffle-cards.acorn 10KB
Icon.acorn 10KB
card-1.acorn 8KB
card-2.acorn 7KB
card-5.acorn 7KB
card-6.acorn 7KB
card-4.acorn 7KB
card-3.acorn 7KB
glu.c 2KB
base64.c 2KB
.gitignore 91B
CocosNode.h 15KB
IntervalAction.h 11KB
CocosDenshion.h 10KB
CDOpenALSupport.h 10KB
Texture2D.h 9KB
MenuItem.h 9KB
Director.h 8KB
ParticleSystem.h 8KB
Transition.h 7KB
ccArray.h 7KB
EAGLView.h 6KB
Grid3DAction.h 6KB
TiledGridAction.h 6KB
CDAudioManager.h 6KB
TMXTiledMap.h 6KB
CGPointExtension.h 5KB
AtlasSprite.h 5KB
ccHashSet.h 4KB
GridAction.h 4KB
OpenGL_Internal.h 4KB
ccTypes.h 4KB
TextureMgr.h 4KB
TextureAtlas.h 4KB
Layer.h 4KB
BitmapFontAtlas.h 4KB
ScoreServerRequest.h 3KB
ScoreServerPost.h 3KB
Sprite.h 3KB
PVRTexture.h 3KB
Ribbon.h 3KB
ActionManager.h 3KB
Action.h 3KB
Grid.h 3KB
AtlasSpriteManager.h 3KB
TMXXMLParser.h 3KB
Scheduler.h 2KB
SimpleAudioEngine.h 2KB
CDataScanner.h 2KB
TouchDelegateProtocol.h 2KB
TouchHandler.h 2KB
AtlasNode.h 2KB
InstantAction.h 2KB
cocos2d.h 2KB
TileMapAtlas.h 2KB
MotionStreak.h 2KB
DrawingPrimitives.h 2KB
EaseAction.h 2KB
Menu.h 2KB
CJSONDeserializer.h 2KB
RenderTexture.h 2KB
CJSONScanner.h 2KB
TouchDispatcher.h 2KB
Label.h 2KB
Camera.h 2KB
CJSONSerializer.h 2KB
CameraAction.h 2KB
NSScanner_Extensions.h 2KB
LabelAtlas.h 2KB
CDataScanner_Extensions.h 1KB
NSDictionary_JSONExtensions.h 1KB
TextureNode.h 1KB
NSCharacterSet_Extensions.h 1KB
ccMacros.h 1KB
ParticleExamples.h 1KB
TGAlib.h 1KB
QuadParticleSystem.h 1KB
ParallaxNode.h 1KB
ccExceptions.h 910B
PointParticleSystem.h 905B
GameLayerScene.h 868B
Scene.h 854B
ZipUtils.h 699B
Grabber.h 694B
cocoslive.h 646B
FileUtils.h 591B
Card.h 561B
base64.h 551B
TransformUtils.h 527B
glu.h 526B
HUDLayer.h 351B
MatchGameAppDelegate.h 173B
CocosDenshion.m 24KB
IntervalAction.m 21KB
Director.m 21KB
Transition.m 19KB
Texture2D.m 17KB
CDAudioManager.m 16KB
共 182 条
- 1
- 2
资源评论
快乐无限出发
- 粉丝: 1142
- 资源: 7289
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第一百五十四阶段 - 4.4.2.152全局变量的作用域-152 -2024.06.04
- 松哥解协议松哥解协议松哥解协议松哥解协议松哥解协议
- 618节日618节日618节日
- tensorflow-gpu-2.9.1-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp37-cp37m-win-amd64.whl
- tensorflow-gpu-2.9.0-cp39-cp39-win-amd64.whl
- lcd daimalcd daima
- 电影领域-推荐算法-个性化内容-观影决策-电影推荐小程序.zip
- 电气控制PLC考试题库
- 如何使用MATLAB简介
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功