SBSPSS/Utils/MapEdit/Layer.cpp

81 lines
1.9 KiB
C++
Raw Normal View History

2000-09-25 17:43:52 +02:00
/******************/
/*** Layer Core ***/
/******************/
#include "stdafx.h"
#include "gl3d.h"
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glut.h>
//#include "GLEnabledView.h"
//#include "MapEditDoc.h"
//#include "MapEditView.h"
#include "Layer.h"
#include "Utils.h"
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
CLayer::CLayer()
{
}
2000-10-25 20:28:44 +02:00
2000-09-25 17:43:52 +02:00
/*****************************************************************************/
CLayer::~CLayer()
{
}
/*****************************************************************************/
2000-10-25 23:00:54 +02:00
void CLayer::Render(Vec &MapPos,BOOL Is3d)
2000-09-25 17:43:52 +02:00
{
2000-10-25 23:00:54 +02:00
if (Is3d && CanRender3d())
Render3d(MapPos);
else
Render2d(MapPos);
}
2000-09-25 17:43:52 +02:00
2000-10-25 23:00:54 +02:00
/*****************************************************************************/
2000-10-27 02:06:19 +02:00
extern GLint TestTile;
2000-10-25 23:00:54 +02:00
void CLayer::Render2d(Vec &MapPos)
{
float XYDiv=GetLayerZPosDiv();
2000-10-27 20:18:30 +02:00
return;
2000-10-25 23:00:54 +02:00
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
2000-10-27 20:18:30 +02:00
2000-10-25 23:00:54 +02:00
glBegin(GL_QUADS);
SetTestColor();
BuildGLQuad(-1,LayerWidth+1,-1,0,0); // Bottom
BuildGLQuad(-1,LayerWidth+1,LayerHeight+1,LayerHeight,0); // Top
BuildGLQuad(-1,0,LayerHeight,0,0); // Left
BuildGLQuad(LayerWidth,LayerWidth+1,LayerHeight,0,0); // Right
glEnd();
2000-10-27 20:18:30 +02:00
2000-10-25 23:00:54 +02:00
}
/*****************************************************************************/
2000-10-27 20:18:30 +02:00
float asd=0;
2000-10-25 23:00:54 +02:00
void CLayer::Render3d(Vec &MapPos)
{
2000-10-25 20:28:44 +02:00
float XYDiv=GetLayerZPosDiv();
2000-09-25 17:43:52 +02:00
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
2000-10-30 22:16:48 +01:00
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
2000-10-27 20:18:30 +02:00
glRotatef(asd,0,1,0);
asd+=0.5;
2000-10-30 22:16:48 +01:00
2000-10-27 20:18:30 +02:00
glCallList(TestTile);
2000-09-25 17:43:52 +02:00
}
2000-10-25 23:00:54 +02:00
2000-09-25 17:43:52 +02:00
/*****************************************************************************/
/*****************************************************************************/