This commit is contained in:
parent
a1e872c005
commit
de289b4422
@ -21,6 +21,7 @@
|
||||
#include "LayerAction.h"
|
||||
#include "LayerFore.h"
|
||||
|
||||
BOOL Test3dFlag=TRUE;
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
@ -44,11 +45,10 @@ CCore::~CCore()
|
||||
void CCore::Init(CMapEditView *Wnd)
|
||||
{
|
||||
ParentWindow=Wnd;
|
||||
|
||||
// glDisable(GL_DEPTH_TEST);
|
||||
ActiveLayer=0;
|
||||
MapPos.x=MapPos.y=MapPos.z=0;
|
||||
|
||||
|
||||
UpdateView(0,0,0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -59,7 +59,11 @@ void CCore::Render()
|
||||
|
||||
for (int i=0;i<LAYER_TYPE_MAX;i++)
|
||||
{
|
||||
Layers[i]->Render(MapPos);
|
||||
if (i==LAYER_TYPE_ACTION)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
Layers[i]->Render(MapPos,Test3dFlag);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,19 +82,19 @@ void CCore::UpdateView(float XOfs,float YOfs,float ZOfs)
|
||||
/*****************************************************************************/
|
||||
void CCore::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||
{
|
||||
// if (!(nFlags & (MK_MBUTTON | MK_RBUTTON))) Layers[ActiveLayer].MouseMsg(nFlags,point);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||
{
|
||||
// if (!(nFlags & (MK_LBUTTON | MK_RBUTTON))) Layers[ActiveLayer].MouseMsg(nFlags,point);
|
||||
LastMousePos=point;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||
{
|
||||
// if (!(nFlags & (MK_LBUTTON | MK_MBUTTON))) Layers[ActiveLayer].MouseMsg(nFlags,point);
|
||||
// Test3dFlag=!Test3dFlag;
|
||||
UpdateView(0,0,0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@ -111,18 +115,19 @@ float YOfs=0;
|
||||
// check if active doc
|
||||
if (theApp.GetCurrent()!=ParentWindow->GetDocument()) return;
|
||||
|
||||
// Layers[ActiveLayer].MouseMsg(nFlags,point);
|
||||
/*
|
||||
// Handle Movement
|
||||
CurrentMousePos=point;
|
||||
|
||||
// Handle Drag Movement
|
||||
if (nFlags & MK_MBUTTON)
|
||||
{
|
||||
float XS,YS;
|
||||
RECT ThisRect;
|
||||
|
||||
ParentWindow->GetWindowRect(&ThisRect);
|
||||
|
||||
XS=MapPos.z/((ThisRect.right-ThisRect.left));
|
||||
YS=MapPos.z/((ThisRect.bottom-ThisRect.top));
|
||||
XS=MapPos.z*Layers[ActiveLayer]->GetLayerZPos();
|
||||
YS=MapPos.z*Layers[ActiveLayer]->GetLayerZPos();
|
||||
XS/=((ThisRect.right-ThisRect.left));
|
||||
YS/=((ThisRect.bottom-ThisRect.top));
|
||||
|
||||
XOfs=LastMousePos.x-CurrentMousePos.x;
|
||||
YOfs=LastMousePos.y-CurrentMousePos.y;
|
||||
@ -131,19 +136,11 @@ float YOfs=0;
|
||||
XOfs*=XS;
|
||||
YOfs*=YS;
|
||||
|
||||
// TRACE2("Move %i %i,",ThisRect.left,ThisRect.top);
|
||||
// TRACE2("Move %i %i \n",ThisRect.right,ThisRect.bottom);
|
||||
}
|
||||
UpdateView(-XOfs,-YOfs,0);
|
||||
// if (nFlags & MK_LBUTTON) LButtonControl(nFlags,point,TRUE);
|
||||
// if (nFlags & MK_RBUTTON) RButtonControl(nFlags,point,TRUE);
|
||||
|
||||
|
||||
TRACE2("Move %i %i \n",point.x,point.y);
|
||||
*/
|
||||
MapPos.x+=0.01f;
|
||||
UpdateView(0.01f,0,0);
|
||||
//Render();
|
||||
UpdateView(+XOfs,-YOfs,0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -16,6 +16,44 @@
|
||||
#include "Layer.h"
|
||||
#include "Utils.h"
|
||||
|
||||
/*
|
||||
Core Functionality
|
||||
|
||||
Layers
|
||||
Gfx Layers
|
||||
Background Layer
|
||||
Mid Layer
|
||||
Action Layer
|
||||
Fore Layer
|
||||
Tile Bank
|
||||
Tile Set
|
||||
Core
|
||||
GUI
|
||||
|
||||
Map Data
|
||||
Core
|
||||
|
||||
Project
|
||||
Load Project
|
||||
Save Project
|
||||
|
||||
Output
|
||||
PSX Data
|
||||
Map Data
|
||||
Level Data
|
||||
Tile Data
|
||||
Tile Blocks
|
||||
Textures
|
||||
AGB Data
|
||||
Map Data
|
||||
Level Data
|
||||
Tile Data
|
||||
Textures
|
||||
|
||||
Edit Functions
|
||||
Paint
|
||||
Tile Mirror
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
@ -30,10 +68,35 @@ CLayer::~CLayer()
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayer::Render(Vec &MapPos)
|
||||
void CLayer::Render(Vec &MapPos,BOOL Is3d)
|
||||
{
|
||||
TRACE1("%s\n",GetName());
|
||||
if (Is3d && CanRender3d())
|
||||
Render3d(MapPos);
|
||||
else
|
||||
Render2d(MapPos);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayer::Render2d(Vec &MapPos)
|
||||
{
|
||||
float XYDiv=GetLayerZPosDiv();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(MapPos.x/XYDiv,MapPos.y/XYDiv,MapPos.z);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CLayer::Render3d(Vec &MapPos)
|
||||
{
|
||||
float ZOfs=GetLayerZPos();
|
||||
float XYDiv=GetLayerZPosDiv();
|
||||
|
||||
@ -50,5 +113,6 @@ float XYDiv=GetLayerZPosDiv();
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -31,10 +31,13 @@ public:
|
||||
// Virtual
|
||||
virtual void Init()=0;
|
||||
virtual char *GetName()=0;
|
||||
virtual void Render(Vec &MapPos);
|
||||
virtual void Render(Vec &MapPos,BOOL Is3d);
|
||||
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;
|
||||
|
||||
// Control
|
||||
|
@ -68,7 +68,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"
|
||||
|
@ -101,6 +101,17 @@ void BuildGLBoxNoNormals(float XMin,float XMax,float YMin,float YMax,float ZMin,
|
||||
glVertex3f( XMax, YMax, ZMax);
|
||||
glVertex3f( XMax, YMax, ZMin);
|
||||
}
|
||||
/**************************************************************************************/
|
||||
|
||||
/**************************************************************************************/
|
||||
void BuildGLQuad(float XMin,float XMax,float YMin,float YMax,float Z)
|
||||
{
|
||||
// Front Face
|
||||
glNormal3f( 0.0f, 0.0f, 1.0f);
|
||||
glVertex3f( XMin, YMin, Z);
|
||||
glVertex3f( XMax, YMin, Z);
|
||||
glVertex3f( XMax, YMax, Z);
|
||||
glVertex3f( XMin, YMax, Z);
|
||||
}
|
||||
|
||||
/**************************************************************************************/
|
||||
/**************************************************************************************/
|
||||
|
@ -10,6 +10,7 @@
|
||||
void DbgMsg(const char * pszFmt,...);
|
||||
void BuildGLBox(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax);
|
||||
void BuildGLBoxNoNormals(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax);
|
||||
void BuildGLQuad(float XMin,float XMax,float YMin,float YMax,float Z);
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user