This commit is contained in:
parent
4ced8e9af2
commit
bd07373b05
6 changed files with 41 additions and 14 deletions
|
@ -130,8 +130,8 @@ float YOfs=0;
|
|||
RECT ThisRect;
|
||||
|
||||
ParentWindow->GetWindowRect(&ThisRect);
|
||||
XS=MapPos.z*Layers[ActiveLayer]->GetLayerZPos();
|
||||
YS=MapPos.z*Layers[ActiveLayer]->GetLayerZPos();
|
||||
XS=MapPos.z*2;//*Layers[ActiveLayer]->GetLayerZPos();
|
||||
YS=MapPos.z*2;//*Layers[ActiveLayer]->GetLayerZPos();
|
||||
XS/=((ThisRect.right-ThisRect.left));
|
||||
YS/=((ThisRect.bottom-ThisRect.top));
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
void UpdateView(float XOfs,float YOfs,float ZOfs);
|
||||
void SetMouseMode(MOUSE_MODE CurrentMode,MOUSE_MODE NewMode);
|
||||
|
||||
Vec &GetMapPos() {return(MapPos);}
|
||||
|
||||
// Layers
|
||||
void LayerSetActive(int Layer);
|
||||
int LayerGetActive();
|
||||
|
|
|
@ -70,10 +70,19 @@ CLayer::~CLayer()
|
|||
/*****************************************************************************/
|
||||
void CLayer::Render(Vec &MapPos,BOOL Is3d)
|
||||
{
|
||||
|
||||
/*
|
||||
if (Is3d && CanRender3d())
|
||||
Render3d(MapPos);
|
||||
else
|
||||
Render2d(MapPos);
|
||||
*/
|
||||
Vec ZeroPos(0,0,0);
|
||||
if (Is3d && CanRender3d())
|
||||
Render3d(ZeroPos);
|
||||
else
|
||||
Render2d(ZeroPos);
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -102,24 +111,16 @@ return;
|
|||
float asd=0;
|
||||
void CLayer::Render3d(Vec &MapPos)
|
||||
{
|
||||
float ZOfs=GetLayerZPos();
|
||||
float XYDiv=GetLayerZPosDiv();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z-ZOfs);
|
||||
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
|
||||
glRotatef(asd,0,1,0);
|
||||
asd+=0.5;
|
||||
/*
|
||||
glBegin(GL_QUADS);
|
||||
SetTestColor();
|
||||
BuildGLBox(-1,LayerWidth+1,-1,0,0,0+1); // Bottom
|
||||
BuildGLBox(-1,LayerWidth+1,LayerHeight+1,LayerHeight,0,0+1); // Top
|
||||
BuildGLBox(-1,0,LayerHeight,0,0,0+1); // Left
|
||||
BuildGLBox(LayerWidth,LayerWidth+1,LayerHeight,0,0,0+1); // Right
|
||||
glEnd();
|
||||
*/
|
||||
|
||||
glCallList(TestTile);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ virtual void Render2d(Vec &MapPos);
|
|||
virtual void Render3d(Vec &MapPos);
|
||||
|
||||
virtual float GetLayerZPosDiv()=0;
|
||||
virtual float GetLayerZPos()=0;
|
||||
virtual BOOL CanRender3d()=0;
|
||||
virtual void SetTestColor()=0;
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ void CMapEditView::OnCreateGL()
|
|||
glClearDepth(1.0f); // Depth Buffer Setup
|
||||
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
|
||||
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
|
||||
// glDepthRange(-100000,+100000);
|
||||
glEnable(GL_LIGHT0); // Quick And Dirty Lighting (Assumes Light0 Is SetUp)
|
||||
glEnable(GL_LIGHTING); // Enable Lighting
|
||||
glEnable(GL_COLOR_MATERIAL); // Enable Material Coloring
|
||||
|
@ -78,6 +79,27 @@ void CMapEditView::OnCreateGL()
|
|||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CMapEditView::OnSizeGL(int cx, int cy)
|
||||
{
|
||||
// set correspondence between window and OGL viewport
|
||||
glViewport(0,0,cx,cy);
|
||||
|
||||
}
|
||||
|
||||
void CMapEditView::UpdateCamera()
|
||||
{
|
||||
//Vec &CamPos=Core
|
||||
// update the camera
|
||||
glPushMatrix();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(40.0,m_dAspectRatio,0.1f, 10.0f);
|
||||
glTranslatef(0.0f,0.0f,-4.f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
void CMapEditView::OnDrawGL()
|
||||
{
|
||||
|
|
|
@ -21,6 +21,9 @@ public:
|
|||
CMapEditDoc* GetDocument();
|
||||
void OnCreateGL();
|
||||
void OnDrawGL();
|
||||
void OnSizeGL(int cx, int cy);
|
||||
void UpdateCamera();
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue