📄 mordorscene.h
字号:
#define NUMBER_OF_WALKING_BAUUL_MOVEMENTS 30
BezCam moCam(0.01f,0.75f);
CSkyBox moSkyBox;
CMap moMap;
int moMusic;
int moParticleSystem[11]; // the flames! :)
Md2Model moWalkingBauul, moBauuls[2], moBauulsWeapons[2];
CharMovement moWalkingBauulMovement[NUMBER_OF_WALKING_BAUUL_MOVEMENTS];
float moWalkingBauulAnimationFraction, moBauulsFraction[2];
int moWalkingBauulMovementIndex;
void MordorSceneInit()
{
moMap.Init("Data/Mordor.cmf");
moSkyBox.Init("Data/CSkyBox/Night","jpg");
moWalkingBauul.Load("Data/ModelsAndSkins/Bauul/Bauul.md2","Data/ModelsAndSkins/Bauul/Bauul.jpg");
moWalkingBauul.SetAnimation("run");
moBauuls[0].Load("Data/ModelsAndSkins/Bauul/Bauul.md2","Data/ModelsAndSkins/Bauul/Bauul.jpg");
moBauuls[0].SetAnimation("stand");
moBauuls[1].Load("Data/ModelsAndSkins/Bauul/Bauul.md2","Data/ModelsAndSkins/Bauul/Bauul.jpg");
moBauuls[1].SetAnimation("crstnd");
moBauulsWeapons[0].Load("Data/ModelsAndSkins/Bauul/BauulWeapon.md2","Data/ModelsAndSkins/Bauul/BauulWeapon.jpg");
moBauulsWeapons[0].SetAnimation("stand");
moBauulsWeapons[1].Load("Data/ModelsAndSkins/Bauul/BauulWeapon.md2","Data/ModelsAndSkins/Bauul/BauulWeapon.jpg");
moBauulsWeapons[1].SetAnimation("crstnd");
moCam.LoadFromFile("Data/Paths/Mordor.path");
#include "MordorSceneWalkingBauulMovements.h"
}
void MordorSceneRenderNextFrame(float Milliseconds)
{
static bool Record=false, DrawPath=false;
static int FrameCount, FrameRate;
static float Second=0.0f;
static bool started=false;
if (!started)
{
started=true;
LightManager.Enable(GL_LIGHT1);
LightManager.SetAmbientColor(GL_LIGHT1,0.5f,0.5f,0.5f,1.0f);
LightManager.SetDiffuseColor(GL_LIGHT1,1.0f,1.0f,1.0f,1.0f);
#include "MordorSceneFlames.h"
fpvCam.StartRecord("Data\\record.path");
}
PGod.Update(Milliseconds);
// UPDATE!
static float temptime=0.0f, TotalTime=0.0f, CamPointTime=0.0f;
temptime+=Milliseconds;
Second+=Milliseconds;
TotalTime+=Milliseconds;
FrameCount++;
if (Second>=1000.0f)
{
Second=0.0f;
FrameRate=FrameCount;
FrameCount=0;
}
//DRAW
moCam.LookAtNextPoint(Milliseconds*0.05);
moCam.PositionSkybox();
moSkyBox.Render();
glLoadIdentity();
moCam.Position();
if (TotalTime>70000.0f)
{
float t=1.0-((TotalTime-70000.0f)*0.0002f);
LightManager.SetAmbientColor(GL_LIGHT1,0.5f*t,0.5f*t,0.5f*t,1.0f);
LightManager.SetDiffuseColor(GL_LIGHT1,1.0f*t,1.0f*t,1.0f*t,1.0f);
}
LightManager.SetPosition(GL_LIGHT1,-3.0f,54.0f,-16.0f);
moMap.Draw();
if (DrawPath)
{
moCam.DrawCurves();
moCam.DrawPoints();
}
// DRAW THE WATCHING BAUULS
glPushMatrix();
moBauulsFraction[0]+=Milliseconds*0.0005f;;
if (moBauulsFraction[0]>=0.99f)
moBauulsFraction[0]=0.0f;
glTranslatef(8.7f,19.7f,13.7f);
glScalef(0.01f,0.01f,0.01f);
glRotatef(180.0f,0,1,0);
moBauuls[0].Animate(moBauulsFraction[0],true);
moBauulsWeapons[0].Animate(moBauulsFraction[0],true);
glPopMatrix();
glPushMatrix();
moBauulsFraction[1]+=Milliseconds*0.0005f;;
if (moBauulsFraction[1]>=0.99f)
moBauulsFraction[1]=0.0f;
glTranslatef(1.87f,19.2f,-0.94f);
glScalef(0.01f,0.01f,0.01f);
glRotatef(180.0f,0,1,0);
moBauuls[1].Animate(moBauulsFraction[1],true);
moBauulsWeapons[1].Animate(moBauulsFraction[1],true);
glPopMatrix();
// DRAW THE RUNNING BAUUL :)
glPushMatrix();
moWalkingBauulAnimationFraction+=Milliseconds*moWalkingBauulMovement[moWalkingBauulMovementIndex].TimeFactor;
if (moWalkingBauulAnimationFraction>=0.99f)
{
moWalkingBauulMovementIndex++;
moWalkingBauulAnimationFraction=0.0f;
if (moWalkingBauulMovement[moWalkingBauulMovementIndex].ChangeAnimation)
moWalkingBauul.SetAnimation(moWalkingBauulMovement[moWalkingBauulMovementIndex].NewAnimation);
}
glTranslatef( moWalkingBauulMovement[moWalkingBauulMovementIndex].Position.Coords[0] +((moWalkingBauulMovement[moWalkingBauulMovementIndex+1].Position.Coords[0]-moWalkingBauulMovement[moWalkingBauulMovementIndex].Position.Coords[0])*moWalkingBauulAnimationFraction),
moWalkingBauulMovement[moWalkingBauulMovementIndex].Position.Coords[1]+((moWalkingBauulMovement[moWalkingBauulMovementIndex+1].Position.Coords[1]-moWalkingBauulMovement[moWalkingBauulMovementIndex].Position.Coords[1])*moWalkingBauulAnimationFraction),
moWalkingBauulMovement[moWalkingBauulMovementIndex].Position.Coords[2]+((moWalkingBauulMovement[moWalkingBauulMovementIndex+1].Position.Coords[2]-moWalkingBauulMovement[moWalkingBauulMovementIndex].Position.Coords[2])*moWalkingBauulAnimationFraction));
glScalef(0.01f,0.01f,0.01f);
glRotatef(moWalkingBauulMovement[moWalkingBauulMovementIndex].Rotation.Coords[0],1,0,0);
glRotatef(moWalkingBauulMovement[moWalkingBauulMovementIndex].Rotation.Coords[1],0,1,0);
glRotatef(moWalkingBauulMovement[moWalkingBauulMovementIndex].Rotation.Coords[2],0,0,1);
if (!moWalkingBauulMovement[moWalkingBauulMovementIndex].TwoFrameInterpolation)
moWalkingBauul.Animate(moWalkingBauulAnimationFraction,true);
else
moWalkingBauul.TwoFrameInterpolate(moWalkingBauulAnimationFraction,
moWalkingBauulMovement[moWalkingBauulMovementIndex].Frame1,
moWalkingBauulMovement[moWalkingBauulMovementIndex].Frame2);
glPopMatrix();
if (TotalTime>79000 && moParticleSystem[0]!=-1)
{
for (int i = moParticleSystem[0];i<=moParticleSystem[10];i++)
PGod[i]->Enabled=false;
moParticleSystem[0]=-1;
}
PGod.Draw();
if (TotalTime<5000.0f)
{
Fade(1,1,1,1.0f-(TotalTime*0.0002f));
}
if (TotalTime>12000.0f && TotalTime<17000.0f)
{
glLoadIdentity();
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
Standart.Display(" *HE IS COMING! HE IS COMIIINNGG!!* ",1.0f,20,40,0);
glEnable(GL_LIGHTING);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
}
if (TotalTime>46000.0f && TotalTime<51000.0f)
{
glLoadIdentity();
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
Standart.Display(" *What's all that fuss down there?* ",1.0f,20,40,0);
glEnable(GL_LIGHTING);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
}
if (TotalTime>56000.0f && TotalTime<61000.0f)
{
glLoadIdentity();
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
Standart.Display(" *Grunt?!* ",1.0f,20,40,1);
glEnable(GL_LIGHTING);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
}
}
void MordorSceneDeInit ()
{}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -