This commit is contained in:
Daveo 2000-10-25 21:00:54 +00:00
parent a1e872c005
commit de289b4422
6 changed files with 104 additions and 28 deletions

View File

@ -21,6 +21,7 @@
#include "LayerAction.h" #include "LayerAction.h"
#include "LayerFore.h" #include "LayerFore.h"
BOOL Test3dFlag=TRUE;
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
@ -44,11 +45,10 @@ CCore::~CCore()
void CCore::Init(CMapEditView *Wnd) void CCore::Init(CMapEditView *Wnd)
{ {
ParentWindow=Wnd; ParentWindow=Wnd;
// glDisable(GL_DEPTH_TEST);
ActiveLayer=0; ActiveLayer=0;
MapPos.x=MapPos.y=MapPos.z=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++) 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) 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) 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) 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 // check if active doc
if (theApp.GetCurrent()!=ParentWindow->GetDocument()) return; if (theApp.GetCurrent()!=ParentWindow->GetDocument()) return;
// Layers[ActiveLayer].MouseMsg(nFlags,point);
/*
// Handle Movement
CurrentMousePos=point; CurrentMousePos=point;
// Handle Drag Movement
if (nFlags & MK_MBUTTON)
{ {
float XS,YS; float XS,YS;
RECT ThisRect; RECT ThisRect;
ParentWindow->GetWindowRect(&ThisRect); ParentWindow->GetWindowRect(&ThisRect);
XS=MapPos.z*Layers[ActiveLayer]->GetLayerZPos();
XS=MapPos.z/((ThisRect.right-ThisRect.left)); YS=MapPos.z*Layers[ActiveLayer]->GetLayerZPos();
YS=MapPos.z/((ThisRect.bottom-ThisRect.top)); XS/=((ThisRect.right-ThisRect.left));
YS/=((ThisRect.bottom-ThisRect.top));
XOfs=LastMousePos.x-CurrentMousePos.x; XOfs=LastMousePos.x-CurrentMousePos.x;
YOfs=LastMousePos.y-CurrentMousePos.y; YOfs=LastMousePos.y-CurrentMousePos.y;
@ -131,19 +136,11 @@ float YOfs=0;
XOfs*=XS; XOfs*=XS;
YOfs*=YS; YOfs*=YS;
// TRACE2("Move %i %i,",ThisRect.left,ThisRect.top); TRACE2("Move %i %i \n",point.x,point.y);
// TRACE2("Move %i %i \n",ThisRect.right,ThisRect.bottom); UpdateView(+XOfs,-YOfs,0);
} }
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();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -16,6 +16,44 @@
#include "Layer.h" #include "Layer.h"
#include "Utils.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 ZOfs=GetLayerZPos();
float XYDiv=GetLayerZPosDiv(); float XYDiv=GetLayerZPosDiv();
@ -50,5 +113,6 @@ float XYDiv=GetLayerZPosDiv();
glEnd(); glEnd();
} }
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -31,10 +31,13 @@ public:
// Virtual // Virtual
virtual void Init()=0; virtual void Init()=0;
virtual char *GetName()=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 GetLayerZPosDiv()=0;
virtual float GetLayerZPos()=0; virtual float GetLayerZPos()=0;
virtual BOOL CanRender3d()=0;
virtual void SetTestColor()=0; virtual void SetTestColor()=0;
// Control // Control

View File

@ -68,7 +68,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # 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 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 BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL" # ADD BASE RSC /l 0x809 /d "_DEBUG" /d "_AFXDLL"

View File

@ -101,6 +101,17 @@ void BuildGLBoxNoNormals(float XMin,float XMax,float YMin,float YMax,float ZMin,
glVertex3f( XMax, YMax, ZMax); glVertex3f( XMax, YMax, ZMax);
glVertex3f( XMax, YMax, ZMin); 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);
}
/**************************************************************************************/ /**************************************************************************************/
/**************************************************************************************/ /**************************************************************************************/

View File

@ -10,6 +10,7 @@
void DbgMsg(const char * pszFmt,...); void DbgMsg(const char * pszFmt,...);
void BuildGLBox(float XMin,float XMax,float YMin,float YMax,float ZMin,float ZMax); 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 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);
/**************************************************************************************/ /**************************************************************************************/