91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6.76MB
    文件類(lèi)型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-11-02
  • 語(yǔ)言: 其他
  • 標(biāo)簽: 兔子??opengl??

資源簡(jiǎn)介

用opgl繪制的兔子,支持放大縮小,旋轉(zhuǎn)等功能,開(kāi)發(fā)環(huán)境是vs2005

資源截圖

代碼片段和文件信息

#include?								
#include?“glew.h“
#include?“glaux.h“

#include?“math.h“????????????????????????????????????
#include?“ArcBall.h“?????????????????????????????????

//軌跡球參數(shù):
//直徑 2.0f
//半徑 1.0f
//半徑平方 1.0f


void?ArcBall_t::_mapToSphere(const?Point2fT*?NewPt?Vector3fT*?NewVec)?const
{
????Point2fT?TempPt;
????GLfloat?length;

????//復(fù)制到臨時(shí)變量
????TempPt?=?*NewPt;

????//把長(zhǎng)寬調(diào)整到[-1?...?1]區(qū)間
????TempPt.s.X??=????????(TempPt.s.X?*?this->AdjustWidth)??-?1.0f;
????TempPt.s.Y??=?1.0f?-?(TempPt.s.Y?*?this->AdjustHeight);

????//計(jì)算長(zhǎng)度的平方
????length??????=?(TempPt.s.X?*?TempPt.s.X)?+?(TempPt.s.Y?*?TempPt.s.Y);

????//如果點(diǎn)映射到球的外面
????if?(length?>?1.0f)
????{
????????GLfloat?norm;

????????//縮放到球上
????????norm????=?1.0f?/?FuncSqrt(length);

????????//設(shè)置z坐標(biāo)為0
????????NewVec->s.X?=?TempPt.s.X?*?norm;
????????NewVec->s.Y?=?TempPt.s.Y?*?norm;
????????NewVec->s.Z?=?0.0f;
????}
//如果在球內(nèi)
????else???
????{
????????//利用半徑的平方為1求出z坐標(biāo)
????????NewVec->s.X?=?TempPt.s.X;
????????NewVec->s.Y?=?TempPt.s.Y;
????????NewVec->s.Z?=?FuncSqrt(1.0f?-?length);
????}
}

ArcBall_t::ArcBall_t(GLfloat?NewWidth?GLfloat?NewHeight)
{
????this->StVec.s.X?????=
????this->StVec.s.Y?????=?
????this->StVec.s.Z?????=?

????this->EnVec.s.X?????=
????this->EnVec.s.Y?????=?
????this->EnVec.s.Z?????=?0.0f;

????this->setBounds(NewWidth?NewHeight);
}

//按下鼠標(biāo)記錄當(dāng)前對(duì)應(yīng)的軌跡球的位置
void????ArcBall_t::click(const?Point2fT*?NewPt)
{
????this->_mapToSphere(NewPt?&this->StVec);
}

//鼠標(biāo)拖動(dòng)計(jì)算旋轉(zhuǎn)四元數(shù)
void????ArcBall_t::drag(const?Point2fT*?NewPt?Quat4fT*?NewRot)
{
????//新的位置
????this->_mapToSphere(NewPt?&this->EnVec);

????//計(jì)算旋轉(zhuǎn)
????if?(NewRot)
????{
????????Vector3fT??Perp;

????????//計(jì)算旋轉(zhuǎn)軸
????????Vector3fCross(&Perp?&this->StVec?&this->EnVec);

????????//如果不為0
????????if?(Vector3fLength(&Perp)?>?Epsilon)????
????????{
????????????//記錄旋轉(zhuǎn)軸
????????????NewRot->s.X?=?Perp.s.X;
????????????NewRot->s.Y?=?Perp.s.Y;
????????????NewRot->s.Z?=?Perp.s.Z;
????????????//在四元數(shù)中w=cos(a/2),a為旋轉(zhuǎn)的角度
????????????NewRot->s.W=?Vector3fDot(&this->StVec?&this->EnVec);
????????}
//是0,說(shuō)明沒(méi)有旋轉(zhuǎn)
????????else?????????????????????????????????
????????{
????????????NewRot->s.X?=?
????????????NewRot->s.Y?=?
????????????NewRot->s.Z?=?
????????????NewRot->s.W?=?0.0f;
????????}
????}
}


?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????7719936??2009-04-26?12:44??bunny\48_ArcBall.ncb

?????文件???????4537??2009-05-15?09:54??bunny\48_ArcBall.vcproj

?????文件???????1423??2009-05-15?15:18??bunny\48_ArcBall.vcproj.20090401-1254.Administrator.user

?????文件???????2516??2006-08-21?07:18??bunny\ArcBall.cpp

?????文件??????13088??2006-08-13?12:53??bunny\ArcBall.h

?????文件??????32904??2009-05-15?09:54??bunny\bunny.aps

?????文件???????9361??2009-05-15?10:38??bunny\bunny.cpp

?????文件????2417019??2000-10-11?01:34??bunny\bunny.dat

?????文件????9415680??2009-05-15?15:18??bunny\bunny.ncb

?????文件???????1418??2009-05-15?09:54??bunny\bunny.rc

?????文件????????879??2009-04-26?10:04??bunny\bunny.sln

????..A..H.?????25600??2009-05-15?15:18??bunny\bunny.suo

?????文件?????593920??2009-05-15?10:38??bunny\Debug\48_ArcBall.exe

?????文件????????146??2009-04-26?10:05??bunny\Debug\48_ArcBall.exe.embed.manifest

?????文件????????212??2009-04-26?10:05??bunny\Debug\48_ArcBall.exe.embed.manifest.res

?????文件????????145??2009-05-15?10:38??bunny\Debug\48_ArcBall.exe.intermediate.manifest

?????文件????1296180??2009-05-15?10:38??bunny\Debug\48_ArcBall.ilk

?????文件??????48332??2009-04-26?11:15??bunny\Debug\48_ArcBall.obj

?????文件????2345984??2009-05-15?10:38??bunny\Debug\48_ArcBall.pdb

?????文件??????28647??2009-04-26?10:05??bunny\Debug\ArcBall.obj

?????文件??????10062??2009-05-15?10:38??bunny\Debug\BuildLog.htm

?????文件????2417019??2000-10-11?01:34??bunny\Debug\bunny.dat

?????文件??????55068??2009-05-15?10:38??bunny\Debug\bunny.obj

?????文件?????192512??2006-03-04?03:19??bunny\Debug\glew32.dll

?????文件?????121856??2004-08-04?08:52??bunny\Debug\glu32.dll

?????文件?????169984??1998-08-18?23:25??bunny\Debug\glut32.dll

?????文件?????????67??2009-05-15?10:38??bunny\Debug\mt.dep

?????文件??????39995??2009-05-15?09:41??bunny\Debug\NeHeGL.obj

?????文件?????713728??2004-08-04?08:52??bunny\Debug\opengl32.dll

?????文件?????396288??2009-05-15?10:38??bunny\Debug\vc80.idb

............此處省略26個(gè)文件信息

評(píng)論

共有 條評(píng)論

相關(guān)資源