summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleo2009-03-27 18:10:20 +0000
committerleo2009-03-27 18:10:20 +0000
commit8c3f5c3a3e7ce15a05f0bcda66c4ac4f660859a3 (patch)
tree37b27151733b0baa729343d251f51460b1dafcf6
parent077403b2ccb4e9b66662f2ec5ce40fe18d1cfb4e (diff)
parentc8789184d217f360a36e3a59dc1115ab3555c5dc (diff)
Re-added the 0.75 tag.
git-svn-id: http://svn.leocad.org/tags/leocad-0.75@762 c7d43263-9d01-0410-8a33-9dba5d9f93d6
-rw-r--r--CREDITS.txt3
-rw-r--r--Makefile38
-rw-r--r--common/basewnd.h8
-rw-r--r--common/camera.cpp166
-rw-r--r--common/camera.h2
-rwxr-xr-xcommon/curve.cpp14
-rw-r--r--common/debug.cpp22
-rw-r--r--common/defines.h6
-rw-r--r--common/lc_application.cpp24
-rwxr-xr-xcommon/library.cpp28
-rw-r--r--common/light.cpp404
-rw-r--r--common/light.h6
-rw-r--r--common/minifig.cpp6
-rwxr-xr-xcommon/object.cpp5
-rwxr-xr-xcommon/opengl.cpp86
-rwxr-xr-xcommon/opengl.h67
-rw-r--r--common/piece.cpp146
-rw-r--r--common/pieceinf.cpp1716
-rw-r--r--common/pieceinf.h21
-rw-r--r--common/preview.cpp1
-rw-r--r--common/project.cpp1536
-rw-r--r--common/project.h34
-rw-r--r--common/quant.cpp18
-rw-r--r--common/str.cpp1
-rwxr-xr-xcommon/system.h2
-rw-r--r--common/terrain.cpp45
-rw-r--r--common/texfont.cpp65
-rw-r--r--common/texfont.h4
-rw-r--r--common/texture.cpp19
-rw-r--r--common/tr.cpp58
-rw-r--r--common/tr.h1
-rw-r--r--common/typedefs.h25
-rw-r--r--config.mk62
-rw-r--r--description-pak5
-rw-r--r--iphone/Classes/EAGLView.h52
-rw-r--r--iphone/Classes/EAGLView.m182
-rw-r--r--iphone/Classes/LeoCADAppDelegate.h22
-rw-r--r--iphone/Classes/LeoCADAppDelegate.m40
-rwxr-xr-xiphone/Icon.pngbin3190 -> 0 bytes
-rw-r--r--iphone/Info.plist32
-rwxr-xr-xiphone/LeoCAD.xcodeproj/project.pbxproj522
-rw-r--r--iphone/LeoCAD_Prefix.pch8
-rw-r--r--iphone/MainWindow.xib223
-rw-r--r--iphone/basewnd.cpp59
-rw-r--r--iphone/config.h36
-rw-r--r--iphone/glwindow.cpp63
-rw-r--r--iphone/main.m45
-rw-r--r--iphone/system.cpp259
-rw-r--r--linux/basewnd.cpp13
-rw-r--r--linux/dialogs.cpp243
-rw-r--r--linux/dialogs.h2
-rwxr-xr-xlinux/gtkmisc.cpp38
-rwxr-xr-xlinux/gtkmisc.h32
-rw-r--r--linux/gtktools.cpp20
-rw-r--r--linux/gtktools.h10
-rw-r--r--linux/libdlg.cpp432
-rw-r--r--linux/libdlg.h14
-rw-r--r--linux/main.cpp14
-rw-r--r--linux/menu.cpp4
-rw-r--r--linux/module.mk2
-rw-r--r--linux/pixmaps/ac-brick.xpm2
-rw-r--r--linux/pixmaps/ac-cam.xpm2
-rw-r--r--linux/pixmaps/ac-erase.xpm2
-rw-r--r--linux/pixmaps/ac-light.xpm2
-rw-r--r--linux/pixmaps/ac-move.xpm2
-rw-r--r--linux/pixmaps/ac-next.xpm2
-rw-r--r--linux/pixmaps/ac-paint.xpm2
-rw-r--r--linux/pixmaps/ac-pan.xpm2
-rw-r--r--linux/pixmaps/ac-prev.xpm2
-rw-r--r--linux/pixmaps/ac-roll.xpm2
-rw-r--r--linux/pixmaps/ac-rot.xpm2
-rw-r--r--linux/pixmaps/ac-rotv.xpm2
-rw-r--r--linux/pixmaps/ac-sel.xpm2
-rw-r--r--linux/pixmaps/ac-spot.xpm2
-rw-r--r--linux/pixmaps/ac-zoom.xpm2
-rw-r--r--linux/pixmaps/ac-zoome.xpm2
-rw-r--r--linux/pixmaps/ac-zoomr.xpm2
-rw-r--r--linux/pixmaps/an-anim.xpm2
-rw-r--r--linux/pixmaps/an-first.xpm2
-rw-r--r--linux/pixmaps/an-key.xpm2
-rw-r--r--linux/pixmaps/an-last.xpm2
-rw-r--r--linux/pixmaps/an-next.xpm2
-rw-r--r--linux/pixmaps/an-play.xpm2
-rw-r--r--linux/pixmaps/an-prev.xpm2
-rw-r--r--linux/pixmaps/an-stop.xpm2
-rw-r--r--linux/pixmaps/cr_brick.xpm2
-rw-r--r--linux/pixmaps/cr_cam.xpm2
-rw-r--r--linux/pixmaps/cr_erase.xpm2
-rw-r--r--linux/pixmaps/cr_light.xpm2
-rw-r--r--linux/pixmaps/cr_move.xpm2
-rw-r--r--linux/pixmaps/cr_paint.xpm2
-rw-r--r--linux/pixmaps/cr_pan.xpm2
-rw-r--r--linux/pixmaps/cr_roll.xpm2
-rw-r--r--linux/pixmaps/cr_rot.xpm2
-rw-r--r--linux/pixmaps/cr_rotv.xpm2
-rw-r--r--linux/pixmaps/cr_sel.xpm2
-rw-r--r--linux/pixmaps/cr_selm.xpm2
-rw-r--r--linux/pixmaps/cr_spot.xpm2
-rw-r--r--linux/pixmaps/cr_zoom.xpm2
-rw-r--r--linux/pixmaps/cr_zoomr.xpm2
-rw-r--r--linux/pixmaps/icon32.xpm2
-rw-r--r--linux/pixmaps/info.xpm2
-rw-r--r--linux/pixmaps/photo.xpm2
-rw-r--r--linux/pixmaps/pi-acces.xpm2
-rw-r--r--linux/pixmaps/pi-brick.xpm2
-rw-r--r--linux/pixmaps/pi-extra.xpm2
-rw-r--r--linux/pixmaps/pi-misc.xpm2
-rw-r--r--linux/pixmaps/pi-plate.xpm2
-rw-r--r--linux/pixmaps/pi-slope.xpm2
-rw-r--r--linux/pixmaps/pi-space.xpm2
-rw-r--r--linux/pixmaps/pi-tech.xpm2
-rw-r--r--linux/pixmaps/pi-tile.xpm2
-rw-r--r--linux/pixmaps/pi-train.xpm2
-rw-r--r--linux/pixmaps/st-about.xpm2
-rw-r--r--linux/pixmaps/st-bg.xpm2
-rw-r--r--linux/pixmaps/st-copy.xpm2
-rw-r--r--linux/pixmaps/st-cut.xpm2
-rw-r--r--linux/pixmaps/st-fast.xpm2
-rw-r--r--linux/pixmaps/st-help.xpm2
-rw-r--r--linux/pixmaps/st-new.xpm2
-rw-r--r--linux/pixmaps/st-open.xpm2
-rw-r--r--linux/pixmaps/st-paste.xpm2
-rw-r--r--linux/pixmaps/st-prev.xpm2
-rw-r--r--linux/pixmaps/st-print.xpm2
-rw-r--r--linux/pixmaps/st-redo.xpm2
-rw-r--r--linux/pixmaps/st-save.xpm2
-rw-r--r--linux/pixmaps/st-snap.xpm2
-rw-r--r--linux/pixmaps/st-snapa.xpm2
-rw-r--r--linux/pixmaps/st-undo.xpm2
-rwxr-xr-xlinux/pixmaps/vports01.xpm2
-rwxr-xr-xlinux/pixmaps/vports02.xpm2
-rwxr-xr-xlinux/pixmaps/vports03.xpm2
-rwxr-xr-xlinux/pixmaps/vports04.xpm2
-rwxr-xr-xlinux/pixmaps/vports05.xpm2
-rwxr-xr-xlinux/pixmaps/vports06.xpm2
-rwxr-xr-xlinux/pixmaps/vports07.xpm2
-rwxr-xr-xlinux/pixmaps/vports08.xpm2
-rwxr-xr-xlinux/pixmaps/vports09.xpm2
-rwxr-xr-xlinux/pixmaps/vports10.xpm2
-rwxr-xr-xlinux/pixmaps/vports11.xpm2
-rwxr-xr-xlinux/pixmaps/vports12.xpm2
-rwxr-xr-xlinux/pixmaps/vports13.xpm2
-rwxr-xr-xlinux/pixmaps/vports14.xpm2
-rw-r--r--linux/system.cpp108
-rw-r--r--linux/toolbar.cpp2
-rw-r--r--macosx/system.cpp2
-rw-r--r--win/Cadview.cpp1
-rw-r--r--win/Clrpick.cpp4
-rw-r--r--win/Clrpopup.cpp5
-rw-r--r--win/Colorlst.cpp5
-rw-r--r--win/Figdlg.cpp4
-rw-r--r--win/Flatbar.cpp3
-rw-r--r--win/Libdlg.cpp3
-rw-r--r--win/Piecebar.cpp2
-rw-r--r--win/Piecebar.h2
-rw-r--r--win/Print.cpp7
-rw-r--r--win/Stdafx.h48
-rw-r--r--win/System.cpp7
-rw-r--r--win/Tools.cpp4
-rw-r--r--win/arraydlg.cpp8
-rw-r--r--win/config.h2
-rw-r--r--win/disabtab.cpp2
-rw-r--r--win/rmodel.h2
-rw-r--r--win/terrctrl.cpp24
164 files changed, 2472 insertions, 4950 deletions
diff --git a/CREDITS.txt b/CREDITS.txt
index df579c4..23e189f 100644
--- a/CREDITS.txt
+++ b/CREDITS.txt
@@ -5,8 +5,7 @@ Leonardo Zide <leo@gerf.org>
Contributions:
Christian Höltje <docwhat@gerf.org>
-Joerg Scheurich <rusmufti@helpdesk.bera.rus.uni-stuttgart.de>
Renaud Breard <renaud@islande.net>
Linux man page and Debian packages:
-Pat Mahoney <pat7@gmx.net>
+Pat Mahoney <pat7@gmx.net> \ No newline at end of file
diff --git a/Makefile b/Makefile
index 268b83f..8342fcb 100644
--- a/Makefile
+++ b/Makefile
@@ -4,51 +4,54 @@ include config.mk
### Module directories
MODULES := $(OSDIR) common
-### Look for include files in each of the modules
+### look for include files in
+### each of the modules
CPPFLAGS += $(patsubst %,-I%,$(MODULES)) $(OS)
CPPFLAGS += -g
-### Extra libraries if required
-LIBS :=
+### extra libraries if required
+LIBS :=
-### Each module will add to this
+### each module will add to this
SRC :=
BIN := bin/leocad
-include $(OSDIR)/config.mk
-### Include the description for each module
+### include the description for
+### each module
include $(patsubst %,%/module.mk,$(MODULES))
-### Determine the object files
+### determine the object files
OBJ := \
$(patsubst %.c,%.o,$(filter %.c,$(SRC))) \
$(patsubst %.cpp,%.o,$(filter %.cpp,$(SRC)))
-### Link the program
+### link the program
.PHONY: all static
all: $(BIN)
static: bin/leocad.static
-bin/leocad: $(OBJ) bin Makefile
- @echo Linking $@
- @$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
+bin/leocad: $(OBJ) bin
+ $(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
-bin/leocad.static: $(OBJ) bin Makefile
+bin/leocad.static: $(OBJ) bin
$(CXX) -static -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
bin:
mkdir bin
-### Include the C/C++ include dependencies
+### include the C/C++ include
+### dependencies
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean spotless), )
-include $(OBJ:.o=.d)
endif
-### Calculate C/C++ include dependencies
+### calculate C/C++ include
+### dependencies
%.d: %.c
@[ -s $(OSDIR)/config.h ] || $(MAKE) config
@$(CC) -MM -MT '$(patsubst %.d,%.o, $@)' $(CFLAGS) $(CPPFLAGS) -w $< > $@
@@ -59,13 +62,6 @@ endif
@$(CXX) -MM -MT '$(patsubst %.d,%.o, $@)' $(CXXFLAGS) $(CPPFLAGS) -w $< > $@
@[ -s $@ ] || rm -f $@
-### Main compiler rule
-%.o: %.cpp
- @echo $<
- @[ -s $(OSDIR)/config.h ] || $(MAKE) config
- @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o '$(patsubst %.cpp,%.o, $@)' $<
- @[ -s $@ ] || rm -f $@
-
### Various cleaning functions
.PHONY: clean veryclean spotless all
@@ -80,7 +76,7 @@ spotless: veryclean
rm -rf arch $(OSDIR)/config.mk $(OSDIR)/config.h
-### Dependency stuff is done automatically, so these do nothing.
+### dependency stuff is done automatically, so these do nothing.
.PHONY: dep depend
diff --git a/common/basewnd.h b/common/basewnd.h
index 94a3c5a..f26f4f5 100644
--- a/common/basewnd.h
+++ b/common/basewnd.h
@@ -33,14 +33,6 @@ typedef struct
} BaseMenuItem;
#endif
-#ifdef LC_IPHONE
-typedef void* BaseWndXID;
-typedef struct
- {
- void* Dummy;
- } BaseMenuItem;
-#endif
-
// =============================================================================
// Message Box constants
diff --git a/common/camera.cpp b/common/camera.cpp
index acfa7b9..35d6194 100644
--- a/common/camera.cpp
+++ b/common/camera.cpp
@@ -14,6 +14,8 @@
#define LC_CAMERA_SAVE_VERSION 6 // LeoCAD 0.73
+GLuint Camera::m_nTargetList = 0;
+
static LC_OBJECT_KEY_INFO camera_key_info[LC_CK_COUNT] =
{
{ "Camera Position", 3, LC_CK_EYE },
@@ -192,6 +194,9 @@ Camera::Camera (float ex, float ey, float ez, float tx, float ty, float tz, Came
Camera::~Camera()
{
+ if (m_nList != 0)
+ glDeleteLists (m_nList, 1);
+
delete m_pTarget;
}
@@ -203,7 +208,9 @@ void Camera::Initialize()
m_pNext = NULL;
m_nState = 0;
+ m_nList = 0;
m_nType = LC_CAMERA_USER;
+ m_nList = 0;
m_pTR = NULL;
for (unsigned char i = 0 ; i < sizeof(m_strName) ; i++ )
@@ -528,6 +535,8 @@ void Camera::UpdateBoundingBox()
upvec.Normalize();
upvec.ToFloat(m_fUp);
+ float len = frontvec.Length();
+
Matrix mat;
mat.CreateLookat (m_fEye, m_fTarget, m_fUp);
mat.Invert ();
@@ -537,29 +546,11 @@ void Camera::UpdateBoundingBox()
mat.SetTranslation (m_fTarget[0], m_fTarget[1], m_fTarget[2]);
m_pTarget->BoundingBoxCalculate (&mat);
mat.SetTranslation (0, 0, 0);
-}
-
-void Camera::Render(float fLineWidth)
-{
- // Fix the up vector
- Vector frontvec(m_fEye[0]-m_fTarget[0], m_fEye[1]-m_fTarget[1], m_fEye[2]-m_fTarget[2]);
- float len = frontvec.Length();
- Matrix mat;
- mat.CreateLookat (m_fEye, m_fTarget, m_fUp);
- mat.Invert ();
- mat.SetTranslation (0, 0, 0);
+ if (!m_nList)
+ return;
- if (IsEyeSelected())
- {
- glLineWidth(fLineWidth*2);
- int Color = (m_nState & LC_CAMERA_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED;
- glColor4ub(FlatColorArray[Color][0], FlatColorArray[Color][1], FlatColorArray[Color][2], 255);
- }
- else
- {
- glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
- }
+ glNewList(m_nList, GL_COMPILE);
glPushMatrix();
glTranslatef(m_fEye[0], m_fEye[1], m_fEye[2]);
@@ -587,52 +578,82 @@ void Camera::Render(float fLineWidth)
glVertexPointer (3, GL_FLOAT, 0, verts);
glDrawArrays(GL_LINES, 0, 24);
glDrawArrays(GL_LINE_STRIP, 24, 10);
- glLineWidth(fLineWidth);
+
+// glBegin(GL_LINES);
+// glVertex3f(0,0,0);
+// glVertex3f(0,0,len);
+// glEnd();
glTranslatef(0, 0, -len);
- if (IsTargetSelected())
+ glEndList();
+
+ if (m_nTargetList == 0)
+ {
+ m_nTargetList = glGenLists(1);
+ glNewList (m_nTargetList, GL_COMPILE);
+
+ glEnableClientState(GL_VERTEX_ARRAY);
+ float box[24][3] = {
+ { 0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, 0.2f },
+ { -0.2f, 0.2f, 0.2f }, { -0.2f, -0.2f, 0.2f },
+ { -0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, 0.2f },
+ { 0.2f, -0.2f, 0.2f }, { 0.2f, 0.2f, 0.2f },
+ { 0.2f, 0.2f, -0.2f }, { -0.2f, 0.2f, -0.2f },
+ { -0.2f, 0.2f, -0.2f }, { -0.2f, -0.2f, -0.2f },
+ { -0.2f, -0.2f, -0.2f }, { 0.2f, -0.2f, -0.2f },
+ { 0.2f, -0.2f, -0.2f }, { 0.2f, 0.2f, -0.2f },
+ { 0.2f, 0.2f, 0.2f }, { 0.2f, 0.2f, -0.2f },
+ { -0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, -0.2f },
+ { -0.2f, -0.2f, 0.2f }, { -0.2f, -0.2f, -0.2f },
+ { 0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, -0.2f } };
+ glVertexPointer (3, GL_FLOAT, 0, box);
+ glDrawArrays(GL_LINES, 0, 24);
+ glPopMatrix();
+ glEndList();
+ }
+}
+
+void Camera::Render(float fLineWidth)
+{
+ // Create the display lists if this is the first time we're rendered.
+ if (!m_nList)
+ {
+ m_nList = glGenLists(1);
+ UpdateBoundingBox();
+ }
+
+ if (IsEyeSelected())
{
glLineWidth(fLineWidth*2);
- int Color = (m_nState & LC_CAMERA_TARGET_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED;
- glColor4ub(FlatColorArray[Color][0], FlatColorArray[Color][1], FlatColorArray[Color][2], 255);
+ glColor3ubv(FlatColorArray[(m_nState & LC_CAMERA_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED]);
+ glCallList(m_nList);
+ glLineWidth(fLineWidth);
}
else
{
- glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
+ glColor3f(0.5f, 0.8f, 0.5f);
+ glCallList(m_nList);
}
- glEnableClientState(GL_VERTEX_ARRAY);
- float box[24][3] =
- {
- { 0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, 0.2f },
- { -0.2f, 0.2f, 0.2f }, { -0.2f, -0.2f, 0.2f },
- { -0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, 0.2f },
- { 0.2f, -0.2f, 0.2f }, { 0.2f, 0.2f, 0.2f },
- { 0.2f, 0.2f, -0.2f }, { -0.2f, 0.2f, -0.2f },
- { -0.2f, 0.2f, -0.2f }, { -0.2f, -0.2f, -0.2f },
- { -0.2f, -0.2f, -0.2f }, { 0.2f, -0.2f, -0.2f },
- { 0.2f, -0.2f, -0.2f }, { 0.2f, 0.2f, -0.2f },
- { 0.2f, 0.2f, 0.2f }, { 0.2f, 0.2f, -0.2f },
- { -0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, -0.2f },
- { -0.2f, -0.2f, 0.2f }, { -0.2f, -0.2f, -0.2f },
- { 0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, -0.2f }
- };
- glVertexPointer (3, GL_FLOAT, 0, box);
- glDrawArrays(GL_LINES, 0, 24);
- glPopMatrix();
-
- glLineWidth(fLineWidth);
-
- float Line[2][3] =
+ if (IsTargetSelected())
{
- { m_fEye[0], m_fEye[1], m_fEye[2] },
- { m_fTarget[0], m_fTarget[1], m_fTarget[2] },
- };
+ glLineWidth(fLineWidth*2);
+ glColor3ubv(FlatColorArray[(m_nState & LC_CAMERA_TARGET_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED]);
+ glCallList(m_nTargetList);
+ glLineWidth(fLineWidth);
+ }
+ else
+ {
+ glColor3f(0.5f, 0.8f, 0.5f);
+ glCallList(m_nTargetList);
+ }
- glVertexPointer(3, GL_FLOAT, 0, Line);
- glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
- glDrawArrays(GL_LINES, 0, 2);
+ glColor3f(0.5f, 0.8f, 0.5f);
+ glBegin(GL_LINES);
+ glVertex3fv(m_fEye);
+ glVertex3fv(m_fTarget);
+ glEnd();
if (IsSelected())
{
@@ -650,26 +671,27 @@ void Camera::Render(float fLineWidth)
projection.Invert ();
glMultMatrixf (projection.m);
- // Draw the view frustum.
- float verts[16][3] =
- {
- { 1, 1, 1 }, { -1, 1, 1 },
- { -1, 1, 1 }, { -1, -1, 1 },
- { -1, -1, 1 }, { 1, -1, 1 },
- { 1, -1, 1 }, { 1, 1, 1 },
- { 1, 1, -1 }, { 1, 1, 1 },
- { -1, 1, -1 }, { -1, 1, 1 },
- { -1, -1, -1 }, { -1, -1, 1 },
- { 1, -1, -1 }, { 1, -1, 1 },
- };
-
- glVertexPointer(3, GL_FLOAT, 0, verts);
- glDrawArrays(GL_LINES, 0, 16);
+ // draw the viewing frustum
+ glBegin(GL_LINE_LOOP);
+ glVertex3i(1, 1, 1);
+ glVertex3i(-1, 1, 1);
+ glVertex3i(-1, -1, 1);
+ glVertex3i(1, -1, 1);
+ glEnd();
+
+ glBegin(GL_LINES);
+ glVertex3i(1, 1, -1);
+ glVertex3i(1, 1, 1);
+ glVertex3i(-1, 1, -1);
+ glVertex3i(-1, 1, 1);
+ glVertex3i(-1, -1, -1);
+ glVertex3i(-1, -1, 1);
+ glVertex3i(1, -1, -1);
+ glVertex3i(1, -1, 1);
+ glEnd();
glPopMatrix();
}
-
- glDisableClientState(GL_VERTEX_ARRAY);
}
void Camera::MinIntersectDist(LC_CLICKLINE* pLine)
diff --git a/common/camera.h b/common/camera.h
index 2476471..060086b 100644
--- a/common/camera.h
+++ b/common/camera.h
@@ -181,6 +181,8 @@ protected:
char m_strName[81];
unsigned char m_nState;
unsigned char m_nType;
+ GLuint m_nList;
+ static GLuint m_nTargetList;
// Current position and orientation.
float m_fEye[3];
diff --git a/common/curve.cpp b/common/curve.cpp
index 70433eb..c9646a4 100755
--- a/common/curve.cpp
+++ b/common/curve.cpp
@@ -15,8 +15,6 @@
GLuint CurvePoint::m_nArrowList = 0;
GLuint CurvePoint::m_nSphereList = 0;
-#if 0
-
static LC_OBJECT_KEY_INFO curve_point_key_info[LC_CURVE_POINT_KEY_COUNT] =
{
{ "Control Point Position", 3, LC_CURVE_POINT_KEY_POSITION },
@@ -73,7 +71,6 @@ CurvePoint::CurvePoint (Curve *pParent, const float *pos, const float *dir)
void CurvePoint::Initialize ()
{
-#ifndef LC_OPENGLES
if (m_nSphereList == 0)
{
m_nSphereList = glGenLists (1);
@@ -137,8 +134,7 @@ void CurvePoint::Initialize ()
glEnd();
glEndList();
}
-#endif
-
+
m_nState = LC_CURVE_POINT_CONTINUOUS;
float *values[] = { m_fPos, m_fDir1, m_fDir2, &m_fAngle };
@@ -327,7 +323,6 @@ void Curve::UpdatePosition (unsigned short nTime, bool bAnimation)
for (int i = 0; i < m_Points.GetSize (); i++)
m_Points[i]->UpdatePosition (nTime, bAnimation);
-#ifndef LC_OPENGLES
glNewList (m_nDisplayList, GL_COMPILE);
switch (m_nCurveType)
@@ -338,7 +333,6 @@ void Curve::UpdatePosition (unsigned short nTime, bool bAnimation)
}
glEndList ();
-#endif
}
void Curve::Move (unsigned short nTime, bool bAnimation, bool bAddKey, float dx, float dy, float dz)
@@ -590,7 +584,7 @@ void Curve::TesselateHose ()
}
}
- GLushort *index = (GLushort*)malloc (2 * (steps2+1) * sizeof (GLushort));
+ GLuint *index = (GLuint*)malloc (2 * (steps2+1) * sizeof (GLuint));
for (j = 0; j < steps1; j++)
{
for (k = 0; k < steps2; k++)
@@ -600,7 +594,7 @@ void Curve::TesselateHose ()
}
index[k*2] = index[0];
index[k*2+1] = index[1];
- glDrawElements (GL_TRIANGLE_STRIP, 2*(steps2+1), GL_UNSIGNED_SHORT, index);
+ glDrawElements (GL_TRIANGLE_STRIP, 2*(steps2+1), GL_UNSIGNED_INT, index);
}
free (index);
@@ -710,8 +704,6 @@ void Curve::Render (LC_RENDER_INFO* pInfo)
*/
}
-#endif
-
diff --git a/common/debug.cpp b/common/debug.cpp
index 31e98b6..1e56bb5 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -65,27 +65,33 @@ void AddDebugQuad(const Vector3& pt1, const Vector3& pt2, const Vector3& pt3, co
void RenderDebugPrimitives()
{
- glEnableClientState(GL_VERTEX_ARRAY);
+ glBegin(GL_LINES);
for (int i = 0; i < NumDebugLines; i++)
{
glColor3fv((float*)&DebugLines[i].color);
- glVertexPointer(3, GL_FLOAT, 0, &DebugLines[i].pt1);
- glDrawArrays(GL_LINES, 0, 2);
+ glVertex3fv((float*)&DebugLines[i].pt1);
+ glVertex3fv((float*)&DebugLines[i].pt2);
}
+ glEnd();
+
glDepthMask(GL_FALSE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- for (int q = 0; q < NumDebugQuads; q++)
+ glBegin(GL_QUADS);
+
+ for (i = 0; i < NumDebugQuads; i++)
{
- glColor4fv((float*)&DebugQuads[q].color);
- glVertexPointer(3, GL_FLOAT, 0, &DebugQuads[q].pt1);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glColor4fv((float*)&DebugQuads[i].color);
+ glVertex3fv((float*)&DebugQuads[i].pt1);
+ glVertex3fv((float*)&DebugQuads[i].pt2);
+ glVertex3fv((float*)&DebugQuads[i].pt3);
+ glVertex3fv((float*)&DebugQuads[i].pt4);
}
- glDisableClientState(GL_VERTEX_ARRAY);
+ glEnd();
glDisable(GL_BLEND);
glDepthMask(GL_TRUE);
diff --git a/common/defines.h b/common/defines.h
index 7c7d0bb..c0f0f3a 100644
--- a/common/defines.h
+++ b/common/defines.h
@@ -5,7 +5,7 @@
#define _DEFINES_H_
// Check for supported platforms.
-#if !(defined(LC_WINDOWS) || defined(LC_LINUX) || defined(LC_MACOSX) || defined(LC_IPHONE))
+#if !(defined(LC_WINDOWS) || defined(LC_LINUX) || defined(LC_MACOSX))
#error YOU NEED TO DEFINE YOUR OS
#endif
@@ -53,9 +53,9 @@ int stricmp(const char* str1, const char* str2);
#endif
-#if defined(LC_MACOSX) || defined(LC_IPHONE)
+#ifdef LC_MACOSX
#include <sys/param.h>
-#define LC_MAXPATH MAXPATHLEN
+#define LC_MAXPATH MAXPATHLEN //FILENAME_MAX
#define KEY_SHIFT 0x01
#define KEY_CONTROL 0x02
diff --git a/common/lc_application.cpp b/common/lc_application.cpp
index 81ab761..ef57f5d 100644
--- a/common/lc_application.cpp
+++ b/common/lc_application.cpp
@@ -133,9 +133,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* SysLibPath)
// File to open.
char* ProjectName = NULL;
- // First piece to import.
- int ImportPieceArg = 0;
-
// Parse the command line arguments.
for (int i = 1; i < argc; i++)
{
@@ -183,17 +180,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* SysLibPath)
ImageInstructions = true;
else if (strcmp(Param, "--highlight") == 0)
ImageHighlight = true;
- else if (strcmp(Param, "--importpieces") == 0)
- {
- if ((i == argc) || (argv[i+1][0] == '-'))
- {
- printf("Expected file name after --importpiece.");
- return false;
- }
-
- ImportPieceArg = i+1;
- break;
- }
else if ((strcmp(Param, "-v") == 0) || (strcmp(Param, "--version") == 0))
{
printf("LeoCAD version " LC_VERSION_TEXT LC_VERSION_TAG " for "LC_VERSION_OSNAME"\n");
@@ -228,7 +214,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* SysLibPath)
printf(" --animation: Saves animations frames.\n");
printf(" --instructions: Saves instructions steps.\n");
printf(" --highlight: Highlight pieces in the steps they appear.\n");
- printf(" --importpiece [file]: Import pieces into the library.\n");
printf(" \n");
}
else
@@ -402,15 +387,6 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* SysLibPath)
project->OnNewDocument();
}
- if (ImportPieceArg)
- {
- for (int i = ImportPieceArg; i < argc; i++)
- if (!lcGetPiecesLibrary()->ImportLDrawPiece(argv[i]))
- break;
-
- return false;
- }
-
return true;
}
diff --git a/common/library.cpp b/common/library.cpp
index 6bfb353..f1f06cf 100755
--- a/common/library.cpp
+++ b/common/library.cpp
@@ -114,7 +114,7 @@ bool PiecesLibrary::Load (const char *libpath)
// Load moved files reference.
if (m_pMovedReference != NULL)
free(m_pMovedReference);
- m_pMovedReference = (char*)malloc(18*(movedcount+1));
+ m_pMovedReference = (char*)malloc(18*movedcount);
memset (m_pMovedReference, 0, 18*movedcount);
m_nMovedCount = movedcount;
@@ -1205,11 +1205,7 @@ bool PiecesLibrary::ImportTexture (const char* Name)
p = strrchr(file1, '/');
if (!p)
p = file1;
-#ifdef LC_WINDOWS
strupr(p);
-#else
- strlwr(p);
-#endif
p++;
memset(NewTexName, 0, 9);
@@ -1365,16 +1361,10 @@ bool PiecesLibrary::ImportLDrawPiece (const char* Filename)
if (SaveLDrawPiece (&piece))
Sys_MessageBox ("Piece successfully imported.");
else
- {
- fprintf(stderr, "Error saving library after importing %s.\n", Filename);
Sys_MessageBox ("Error saving library.");
- }
}
else
- {
- fprintf(stderr, "Error reading file %s\n", Filename);
Sys_MessageBox ("Error reading file.");
- }
FreeLDrawPiece(&piece);
@@ -1854,14 +1844,7 @@ static void decodefile(FILE *F, Matrix *mat, unsigned char defcolor, lineinfo_t*
strcat (fn, "p/");
strcat (fn, filename);
-#ifdef LC_WINDOWS
strupr(filename);
-#else
- strlwr(filename);
- for (unsigned int i = 0; i < strlen(filename); i++)
- if (filename[i] == '\\')
- filename[i] = '/';
-#endif
for (val = 0; val < numvalid; val++)
if (strcmp(filename, valid[val]) == 0)
break;
@@ -1899,8 +1882,6 @@ static void decodefile(FILE *F, Matrix *mat, unsigned char defcolor, lineinfo_t*
info = info->next;
fclose(tf);
}
- else
- fprintf(stderr, "failed to load file %s (last attempt %s)\n", filename, fn);
} break;
case 2:
@@ -1999,11 +1980,6 @@ static void decodeconnections(FILE *F, Matrix *mat, unsigned char defcolor, char
strcat (fn, "P/");
strcat (fn, filename);
-#ifdef LC_WINDOWS
- strupr(filename);
-#else
- strlwr(filename);
-#endif
if (color == 16) color = defcolor;
strupr(filename);
@@ -2622,7 +2598,7 @@ bool SaveLDrawPiece(LC_LDRAW_PIECE* piece)
bt |= LC_PIECE_MEDIUM;
if (piece->long_info)
- bt |= LC_PIECE_LONGDATA_FILE;
+ bt |= LC_PIECE_LONGDATA;
newidx.WriteByte(&bt, 1);
diff --git a/common/light.cpp b/common/light.cpp
index 9b81f70..2e545a4 100644
--- a/common/light.cpp
+++ b/common/light.cpp
@@ -10,6 +10,9 @@
#include "vector.h"
#include "matrix.h"
+GLuint Light::m_nSphereList = 0;
+GLuint Light::m_nTargetList = 0;
+
static LC_OBJECT_KEY_INFO light_key_info[LC_LK_COUNT] =
{
{ "Light Position", 3, LC_LK_POSITION },
@@ -109,6 +112,7 @@ void Light::Initialize ()
m_pNext = NULL;
m_nState = 0;
m_pTarget = NULL;
+ m_nList = 0;
memset (m_strName, 0, sizeof (m_strName));
m_fAmbient[3] = 1.0f;
@@ -143,6 +147,9 @@ void Light::Initialize ()
Light::~Light ()
{
+ if (m_nList != 0)
+ glDeleteLists (m_nList, 1);
+
delete m_pTarget;
}
@@ -264,7 +271,158 @@ void Light::UpdatePosition (unsigned short nTime, bool bAnimation)
BoundingBoxCalculate (m_fPos);
if (m_pTarget != NULL)
+ {
m_pTarget->BoundingBoxCalculate (m_fTarget);
+
+ if (m_nList == 0)
+ m_nList = glGenLists(1);
+
+ glNewList (m_nList, GL_COMPILE);
+
+ glPushMatrix ();
+ glTranslatef (m_fPos[0], m_fPos[1], m_fPos[2]);
+
+ Vector frontvec (m_fTarget[0]-m_fPos[0], m_fTarget[1]-m_fPos[1], m_fTarget[2]-m_fPos[2]);
+ float len = frontvec.Length (), up[3] = { 1, 1, 1 };
+
+ if (fabs (frontvec[0]) < fabs (frontvec[1]))
+ {
+ if (fabs (frontvec[0]) < fabs (frontvec[2]))
+ up[0] = -(up[1]*frontvec[1] + up[2]*frontvec[2]);
+ else
+ up[2] = -(up[0]*frontvec[0] + up[1]*frontvec[1]);
+ }
+ else
+ {
+ if (fabs (frontvec[1]) < fabs (frontvec[2]))
+ up[1] = -(up[0]*frontvec[0] + up[2]*frontvec[2]);
+ else
+ up[2] = -(up[0]*frontvec[0] + up[1]*frontvec[1]);
+ }
+
+ Matrix mat;
+ mat.CreateLookat (m_fPos, m_fTarget, up);
+ mat.Invert ();
+ mat.SetTranslation (0, 0, 0);
+
+ glMultMatrixf (mat.m);
+
+ glEnableClientState (GL_VERTEX_ARRAY);
+ float verts[16*3];
+ for (int i = 0; i < 8; i++)
+ {
+ verts[i*6] = verts[i*6+3] = (float)cos ((float)i/4 * PI) * 0.3f;
+ verts[i*6+1] = verts[i*6+4] = (float)sin ((float)i/4 * PI) * 0.3f;
+ verts[i*6+2] = 0.3f;
+ verts[i*6+5] = -0.3f;
+ }
+ glVertexPointer (3, GL_FLOAT, 0, verts);
+ glDrawArrays (GL_LINES, 0, 16);
+ glVertexPointer (3, GL_FLOAT, 6*sizeof(float), verts);
+ glDrawArrays (GL_LINE_LOOP, 0, 8);
+ glVertexPointer (3, GL_FLOAT, 6*sizeof(float), &verts[3]);
+ glDrawArrays (GL_LINE_LOOP, 0, 8);
+
+ glBegin (GL_LINE_LOOP);
+ glVertex3f (-0.5f, -0.5f, -0.3f);
+ glVertex3f ( 0.5f, -0.5f, -0.3f);
+ glVertex3f ( 0.5f, 0.5f, -0.3f);
+ glVertex3f (-0.5f, 0.5f, -0.3f);
+ glEnd ();
+
+ glTranslatef(0, 0, -len);
+ glEndList();
+
+ if (m_nTargetList == 0)
+ {
+ m_nTargetList = glGenLists (1);
+ glNewList (m_nTargetList, GL_COMPILE);
+
+ glEnableClientState (GL_VERTEX_ARRAY);
+ float box[24][3] = {
+ { 0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, 0.2f },
+ { -0.2f, 0.2f, 0.2f }, { -0.2f, -0.2f, 0.2f },
+ { -0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, 0.2f },
+ { 0.2f, -0.2f, 0.2f }, { 0.2f, 0.2f, 0.2f },
+ { 0.2f, 0.2f, -0.2f }, { -0.2f, 0.2f, -0.2f },
+ { -0.2f, 0.2f, -0.2f }, { -0.2f, -0.2f, -0.2f },
+ { -0.2f, -0.2f, -0.2f }, { 0.2f, -0.2f, -0.2f },
+ { 0.2f, -0.2f, -0.2f }, { 0.2f, 0.2f, -0.2f },
+ { 0.2f, 0.2f, 0.2f }, { 0.2f, 0.2f, -0.2f },
+ { -0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, -0.2f },
+ { -0.2f, -0.2f, 0.2f }, { -0.2f, -0.2f, -0.2f },
+ { 0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, -0.2f } };
+ glVertexPointer (3, GL_FLOAT, 0, box);
+ glDrawArrays (GL_LINES, 0, 24);
+ glPopMatrix ();
+ glEndList ();
+ }
+ }
+ else
+ {
+ if (m_nSphereList == 0)
+ m_nSphereList = glGenLists (1);
+ glNewList (m_nSphereList, GL_COMPILE);
+
+ const float radius = 0.2f;
+ const int slices = 6, stacks = 6;
+ float rho, drho, theta, dtheta;
+ float x, y, z;
+ int i, j, imin, imax;
+ drho = 3.1415926536f/(float)stacks;
+ dtheta = 2.0f*3.1415926536f/(float)slices;
+
+ // draw +Z end as a triangle fan
+ glBegin (GL_TRIANGLE_FAN);
+ glVertex3f (0.0, 0.0, radius);
+ for (j = 0; j <= slices; j++)
+ {
+ theta = (j == slices) ? 0.0f : j * dtheta;
+ x = (float)(-sin(theta) * sin(drho));
+ y = (float)(cos(theta) * sin(drho));
+ z = (float)(cos(drho));
+ glVertex3f (x*radius, y*radius, z*radius);
+ }
+ glEnd ();
+
+ imin = 1;
+ imax = stacks-1;
+
+ for (i = imin; i < imax; i++)
+ {
+ rho = i * drho;
+ glBegin (GL_QUAD_STRIP);
+ for (j = 0; j <= slices; j++)
+ {
+ theta = (j == slices) ? 0.0f : j * dtheta;
+ x = (float)(-sin(theta) * sin(rho));
+ y = (float)(cos(theta) * sin(rho));
+ z = (float)(cos(rho));
+ glVertex3f (x*radius, y*radius, z*radius);
+ x = (float)(-sin(theta) * sin(rho+drho));
+ y = (float)(cos(theta) * sin(rho+drho));
+ z = (float)(cos(rho+drho));
+ glVertex3f (x*radius, y*radius, z*radius);
+ }
+ glEnd ();
+ }
+
+ // draw -Z end as a triangle fan
+ glBegin (GL_TRIANGLE_FAN);
+ glVertex3f(0.0, 0.0, -radius);
+ rho = 3.1415926536f - drho;
+ for (j = slices; j >= 0; j--)
+ {
+ theta = (j==slices) ? 0.0f : j * dtheta;
+ x = (float)(-sin(theta) * sin(rho));
+ y = (float)(cos(theta) * sin(rho));
+ z = (float)(cos(rho));
+ glVertex3f (x*radius, y*radius, z*radius);
+ }
+ glEnd ();
+
+ glEndList ();
+ }
}
void Light::Render (float fLineWidth)
@@ -274,42 +432,34 @@ void Light::Render (float fLineWidth)
if (IsEyeSelected())
{
glLineWidth(fLineWidth*2);
- int Color = (m_nState & LC_LIGHT_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED;
- glColor4ub(FlatColorArray[Color][0], FlatColorArray[Color][1], FlatColorArray[Color][2], 255);
- DrawCone();
+ glColor3ubv(FlatColorArray[(m_nState & LC_LIGHT_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED]);
+ glCallList(m_nList);
glLineWidth(fLineWidth);
}
else
{
- glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
- DrawCone();
+ glColor3f(0.5f, 0.8f, 0.5f);
+ glCallList(m_nList);
}
if (IsTargetSelected())
{
glLineWidth(fLineWidth*2);
- int Color = (m_nState & LC_LIGHT_TARGET_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED;
- glColor4ub(FlatColorArray[Color][0], FlatColorArray[Color][1], FlatColorArray[Color][2], 255);
- DrawTarget();
+ glColor3ubv(FlatColorArray[(m_nState & LC_LIGHT_TARGET_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED]);
+ glCallList(m_nTargetList);
glLineWidth(fLineWidth);
}
else
{
- glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
- DrawTarget();
+ glColor3f(0.5f, 0.8f, 0.5f);
+ glCallList(m_nTargetList);
}
- glColor4f(0.5f, 0.8f, 0.5f, 1.0f);
-
- float Line[2][3] =
- {
- { m_fPos[0], m_fPos[1], m_fPos[2] },
- { m_fTarget[0], m_fTarget[1], m_fTarget[2] }
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Line);
- glDrawArrays(GL_LINES, 0, 2);
+ glColor3f(0.5f, 0.8f, 0.5f);
+ glBegin(GL_LINES);
+ glVertex3fv(m_fPos);
+ glVertex3fv(m_fTarget);
+ glEnd();
if (IsSelected())
{
@@ -342,31 +492,28 @@ void Light::Render (float fLineWidth)
projection.Invert ();
glMultMatrixf (projection.m);
- // Draw the light cone.
- float Verts[16][3] =
- {
- { 0.5f, 1.0f, 1.0f },
- { 1.0f, 0.5f, 1.0f },
- { 1.0f, -0.5f, 1.0f },
- { 0.5f, -1.0f, 1.0f },
- { -0.5f, -1.0f, 1.0f },
- { -1.0f, -0.5f, 1.0f },
- { -1.0f, 0.5f, 1.0f },
- { -0.5f, 1.0f, 1.0f },
- { 1.0f, 1.0f, -1.0f },
- { 0.75f, 0.75f, 1.0f },
- { -1.0f, 1.0f, -1.0f },
- { -0.75f, 0.75f, 1.0f },
- { -1.0f, -1.0f, -1.0f },
- { -0.75f, -0.75f, 1.0f },
- { 1.0f, -1.0f, -1.0f },
- { 0.75f, -0.75f, 1.0f }
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINE_LOOP, 0, 8);
- glDrawArrays(GL_LINES, 8, 8);
+ // draw the viewing frustum
+ glBegin (GL_LINE_LOOP);
+ glVertex3f ( 0.5f, 1.0f, 1.0f);
+ glVertex3f ( 1.0f, 0.5f, 1.0f);
+ glVertex3f ( 1.0f, -0.5f, 1.0f);
+ glVertex3f ( 0.5f, -1.0f, 1.0f);
+ glVertex3f (-0.5f, -1.0f, 1.0f);
+ glVertex3f (-1.0f, -0.5f, 1.0f);
+ glVertex3f (-1.0f, 0.5f, 1.0f);
+ glVertex3f (-0.5f, 1.0f, 1.0f);
+ glEnd ();
+
+ glBegin (GL_LINES);
+ glVertex3f (1, 1, -1);
+ glVertex3f (0.75f, 0.75f, 1);
+ glVertex3f (-1, 1, -1);
+ glVertex3f (-0.75f, 0.75f, 1);
+ glVertex3f (-1, -1, -1);
+ glVertex3f (-0.75f, -0.75f, 1);
+ glVertex3f (1, -1, -1);
+ glVertex3f (0.75f, -0.75f, 1);
+ glEnd ();
glPopMatrix();
}
@@ -379,175 +526,18 @@ void Light::Render (float fLineWidth)
if (IsEyeSelected ())
{
glLineWidth (fLineWidth*2);
- int Color = (m_nState & LC_LIGHT_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED;
- glColor4ub(FlatColorArray[Color][0], FlatColorArray[Color][1], FlatColorArray[Color][2], 255);
- DrawSphere();
+ glColor3ubv (FlatColorArray[(m_nState & LC_LIGHT_FOCUSED) != 0 ? LC_COL_FOCUSED : LC_COL_SELECTED]);
+ glCallList (m_nSphereList);
glLineWidth (fLineWidth);
}
else
{
- glColor4f (0.5f, 0.8f, 0.5f, 1.0f);
- DrawSphere();
+ glColor3f (0.5f, 0.8f, 0.5f);
+ glCallList (m_nSphereList);
}
glPopMatrix ();
}
-
- glDisableClientState(GL_VERTEX_ARRAY);
-}
-
-void Light::DrawCone()
-{
- glPushMatrix ();
- glTranslatef (m_fPos[0], m_fPos[1], m_fPos[2]);
-
- Vector frontvec (m_fTarget[0]-m_fPos[0], m_fTarget[1]-m_fPos[1], m_fTarget[2]-m_fPos[2]);
- float len = frontvec.Length (), up[3] = { 1, 1, 1 };
-
- if (fabs (frontvec[0]) < fabs (frontvec[1]))
- {
- if (fabs (frontvec[0]) < fabs (frontvec[2]))
- up[0] = -(up[1]*frontvec[1] + up[2]*frontvec[2]);
- else
- up[2] = -(up[0]*frontvec[0] + up[1]*frontvec[1]);
- }
- else
- {
- if (fabs (frontvec[1]) < fabs (frontvec[2]))
- up[1] = -(up[0]*frontvec[0] + up[2]*frontvec[2]);
- else
- up[2] = -(up[0]*frontvec[0] + up[1]*frontvec[1]);
- }
-
- Matrix mat;
- mat.CreateLookat (m_fPos, m_fTarget, up);
- mat.Invert ();
- mat.SetTranslation (0, 0, 0);
-
- glMultMatrixf (mat.m);
-
- glEnableClientState (GL_VERTEX_ARRAY);
- float verts[16*3];
- for (int i = 0; i < 8; i++)
- {
- verts[i*6] = verts[i*6+3] = (float)cos ((float)i/4 * PI) * 0.3f;
- verts[i*6+1] = verts[i*6+4] = (float)sin ((float)i/4 * PI) * 0.3f;
- verts[i*6+2] = 0.3f;
- verts[i*6+5] = -0.3f;
- }
- glVertexPointer (3, GL_FLOAT, 0, verts);
- glDrawArrays (GL_LINES, 0, 16);
- glVertexPointer (3, GL_FLOAT, 6*sizeof(float), verts);
- glDrawArrays (GL_LINE_LOOP, 0, 8);
- glVertexPointer (3, GL_FLOAT, 6*sizeof(float), &verts[3]);
- glDrawArrays (GL_LINE_LOOP, 0, 8);
-
- float Lines[4][3] =
- {
- { -0.5f, -0.5f, -0.3f },
- { 0.5f, -0.5f, -0.3f },
- { 0.5f, 0.5f, -0.3f },
- { -0.5f, 0.5f, -0.3f }
- };
-
- glVertexPointer(3, GL_FLOAT, 0, Lines);
- glDrawArrays(GL_LINE_LOOP, 0, 4);
-
- glTranslatef(0, 0, -len);
-}
-
-void Light::DrawTarget()
-{
- glEnableClientState (GL_VERTEX_ARRAY);
- float box[24][3] =
- {
- { 0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, 0.2f },
- { -0.2f, 0.2f, 0.2f }, { -0.2f, -0.2f, 0.2f },
- { -0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, 0.2f },
- { 0.2f, -0.2f, 0.2f }, { 0.2f, 0.2f, 0.2f },
- { 0.2f, 0.2f, -0.2f }, { -0.2f, 0.2f, -0.2f },
- { -0.2f, 0.2f, -0.2f }, { -0.2f, -0.2f, -0.2f },
- { -0.2f, -0.2f, -0.2f }, { 0.2f, -0.2f, -0.2f },
- { 0.2f, -0.2f, -0.2f }, { 0.2f, 0.2f, -0.2f },
- { 0.2f, 0.2f, 0.2f }, { 0.2f, 0.2f, -0.2f },
- { -0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, -0.2f },
- { -0.2f, -0.2f, 0.2f }, { -0.2f, -0.2f, -0.2f },
- { 0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, -0.2f }
- };
- glVertexPointer (3, GL_FLOAT, 0, box);
- glDrawArrays (GL_LINES, 0, 24);
- glPopMatrix ();
-}
-
-void Light::DrawSphere()
-{
- glEnableClientState (GL_VERTEX_ARRAY);
-
- const float radius = 0.2f;
- const int slices = 6, stacks = 6;
- float rho, drho, theta, dtheta;
- int i, j, imin, imax;
- drho = 3.1415926536f/(float)stacks;
- dtheta = 2.0f*3.1415926536f/(float)slices;
-
- // draw +Z end as a triangle fan
- float Cap[slices+2][3];
-
- Cap[0][0] = 0.0f;
- Cap[0][1] = 0.0f;
- Cap[0][2] = radius;
-
- for (j = 0; j <= slices; j++)
- {
- theta = (j == slices) ? 0.0f : j * dtheta;
- Cap[j+1][0] = (float)(-sin(theta) * sin(drho)) * radius;
- Cap[j+1][1] = (float)(cos(theta) * sin(drho)) * radius;
- Cap[j+1][2] = (float)(cos(drho)) * radius;
- }
-
- glVertexPointer(3, GL_FLOAT, 0, Cap);
- glDrawArrays(GL_TRIANGLE_FAN, 0, slices+2);
-
- imin = 1;
- imax = stacks-1;
-
- float Center[(slices+1)*2][3];
- glVertexPointer(3, GL_FLOAT, 0, Center);
-
- for (i = imin; i < imax; i++)
- {
- rho = i * drho;
-
- for (j = 0; j <= slices; j++)
- {
- theta = (j == slices) ? 0.0f : j * dtheta;
- Center[j*2][0] = (float)(-sin(theta) * sin(rho)) * radius;
- Center[j*2][1] = (float)(cos(theta) * sin(rho)) * radius;
- Center[j*2][2] = (float)(cos(rho)) * radius;
- Center[j*2+1][0] = (float)(-sin(theta) * sin(rho+drho)) * radius;
- Center[j*2+1][1] = (float)(cos(theta) * sin(rho+drho)) * radius;
- Center[j*2+1][2] = (float)(cos(rho+drho)) * radius;
- }
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, (slices+1)*2);
- }
-
- // draw -Z end as a triangle fan
- Cap[0][0] = 0.0f;
- Cap[0][1] = 0.0f;
- Cap[0][2] = -radius;
-
- rho = 3.1415926536f - drho;
- for (j = slices; j >= 0; j--)
- {
- theta = (j==slices) ? 0.0f : j * dtheta;
- Cap[j+1][0] = (float)(-sin(theta) * sin(rho)) * radius;
- Cap[j+1][1] = (float)(cos(theta) * sin(rho)) * radius;
- Cap[j+1][2] = (float)(cos(rho)) * radius;
- }
-
- glVertexPointer(3, GL_FLOAT, 0, Cap);
- glDrawArrays(GL_TRIANGLE_FAN, 0, slices+2);
}
void Light::Setup (int index)
diff --git a/common/light.h b/common/light.h
index 65a63f7..da1cdb6 100644
--- a/common/light.h
+++ b/common/light.h
@@ -118,9 +118,9 @@ protected:
char m_strName[81];
bool m_bEnabled;
- void DrawCone();
- void DrawTarget();
- void DrawSphere();
+ GLuint m_nList;
+ static GLuint m_nSphereList;
+ static GLuint m_nTargetList;
// Temporary parameters
float m_fPos[4];
diff --git a/common/minifig.cpp b/common/minifig.cpp
index 805b066..9098e49 100644
--- a/common/minifig.cpp
+++ b/common/minifig.cpp
@@ -458,8 +458,8 @@ MinifigWizard::MinifigWizard (GLWindow *share)
char *ptr, buf[32];
m_MinifigCount = Sys_ProfileLoadInt ("MinifigWizard", "Count", 0);
- m_MinifigNames = (char**)realloc(m_MinifigNames, sizeof(char**) * (m_MinifigCount+1));
- m_MinifigTemplates = (char**)realloc(m_MinifigTemplates, sizeof(char**) * (m_MinifigCount+1));
+ m_MinifigNames = (char**)realloc (m_MinifigNames, sizeof (char**)*m_MinifigCount);
+ m_MinifigTemplates = (char**)realloc (m_MinifigTemplates, sizeof (char**)*m_MinifigCount);
for (i = 0; i < m_MinifigCount; i++)
{
@@ -829,7 +829,7 @@ void MinifigWizard::Calculate ()
m3.Translate (pos[LC_MFW_LEFT_SHOE][0]-pos[LC_MFW_LEFT_LEG][0],
pos[LC_MFW_LEFT_SHOE][1]-pos[LC_MFW_LEFT_LEG][1],
pos[LC_MFW_LEFT_SHOE][2]-pos[LC_MFW_LEFT_LEG][2]);
- if (m_Info[LC_MFW_LEFT_LEG] && strcmp(m_Info[LC_MFW_LEFT_LEG]->m_strName, "773") == 0)
+ if (strcmp (m_Info[LC_MFW_LEFT_LEG]->m_strName, "773") == 0)
m3.Translate (-0.8f, 0, 0);
mat.CreateOld (0,0,0,rot[LC_MFW_LEFT_SHOE][0]-rot[LC_MFW_LEFT_LEG][0],
rot[LC_MFW_LEFT_SHOE][1]-rot[LC_MFW_LEFT_LEG][1],
diff --git a/common/object.cpp b/common/object.cpp
index 88e1f6c..1b8a91c 100755
--- a/common/object.cpp
+++ b/common/object.cpp
@@ -250,10 +250,7 @@ void Object::CalculateKeys (unsigned short nTime, bool bAnimation)
int i, empty = m_nKeyInfoCount;
for (i = 0; i < m_nKeyInfoCount; i++)
- {
next[i] = NULL;
- prev[i] = NULL;
- }
if (bAnimation)
node = m_pAnimationKeys;
@@ -284,8 +281,6 @@ void Object::CalculateKeys (unsigned short nTime, bool bAnimation)
{
LC_OBJECT_KEY *n = next[i], *p = prev[i];
- if (p == NULL) continue;
-
if (bAnimation && (n != NULL) && (p->time != nTime))
{
float t = (float)(nTime - p->time)/(n->time - p->time);
diff --git a/common/opengl.cpp b/common/opengl.cpp
index 0a07dbe..c0c56d7 100755
--- a/common/opengl.cpp
+++ b/common/opengl.cpp
@@ -12,8 +12,6 @@ void Sys_GLCloseLibrary ();
void* Sys_GLGetProc (const char *symbol);
void* Sys_GLGetExtension (const char *symbol);
-#ifdef LC_OPENGL_DYNAMIC
-
// =============================================================================
// OpenGL Function pointers
@@ -354,8 +352,6 @@ PFNGLLOADNAME pfnglLoadName;
PFNGLPUSHNAME pfnglPushName;
PFNGLPOPNAME pfnglPopName;
-#endif // LC_OPENGL_DYNAMIC
-
PFNGLACTIVETEXTUREARB pfnglActiveTextureARB;
PFNGLCLIENTACTIVETEXTUREARB pfnglClientActiveTextureARB;
PFNGLMULTITEXCOORD1DARB pfnglMultiTexCoord1dARB;
@@ -402,7 +398,6 @@ void GL_Shutdown ()
{
Sys_GLCloseLibrary ();
-#ifdef LC_OPENGL_DYNAMIC
pfnglClearIndex = NULL;
pfnglClearColor = NULL;
pfnglClear = NULL;
@@ -740,8 +735,6 @@ void GL_Shutdown ()
pfnglPushName = NULL;
pfnglPopName = NULL;
-#endif // LC_OPENGL_DYNAMIC
-
pfnglActiveTextureARB = NULL;
pfnglClientActiveTextureARB = NULL;
pfnglMultiTexCoord1dARB = NULL;
@@ -790,8 +783,6 @@ bool GL_Initialize (const char* libname)
return false;
}
-#ifdef LC_OPENGL_DYNAMIC
-
pfnglClearIndex = (PFNGLCLEARINDEX) Sys_GLGetProc ("glClearIndex");
pfnglClearColor = (PFNGLCLEARCOLOR) Sys_GLGetProc ("glClearColor");
pfnglClear = (PFNGLCLEAR) Sys_GLGetProc ("glClear");
@@ -1129,8 +1120,6 @@ bool GL_Initialize (const char* libname)
pfnglPushName = (PFNGLPUSHNAME) Sys_GLGetProc ("glPushName");
pfnglPopName = (PFNGLPOPNAME) Sys_GLGetProc ("glPopName");
-#endif // LC_OPENGL_DYNAMIC
-
return true;
}
@@ -1268,19 +1257,19 @@ bool GL_InitializeExtensions ()
#include <math.h>
#ifndef M_PI
-#define M_PI 3.14159265f
+#define M_PI 3.14159265
#endif
-void gluLookAt(GLfloat ex, GLfloat ey, GLfloat ez, GLfloat cx, GLfloat cy, GLfloat cz,
- GLfloat ux, GLfloat uy, GLfloat uz)
+void gluLookAt (GLdouble ex, GLdouble ey, GLdouble ez, GLdouble cx, GLdouble cy, GLdouble cz,
+ GLdouble ux, GLdouble uy, GLdouble uz)
{
- GLfloat x[3], y[3], z[3] = { ex-cx, ey-cy, ez-cz };
- GLfloat inv;
+ GLdouble x[3], y[3], z[3] = { ex-cx, ey-cy, ez-cz };
+ GLdouble inv;
inv = sqrt (z[0]*z[0] + z[1]*z[1] + z[2]*z[2]);
if (inv)
{
- inv = 1.0f/inv;
+ inv = 1.0/inv;
z[0] *= inv;
z[1] *= inv;
z[2] *= inv;
@@ -1311,15 +1300,15 @@ void gluLookAt(GLfloat ex, GLfloat ey, GLfloat ez, GLfloat cx, GLfloat cy, GLflo
}
{
- GLfloat m[16] = { x[0], y[0], z[0], 0, x[1], y[1], z[1], 0, x[2], y[2], z[2], 0, 0, 0, 0, 1 };
- glMultMatrixf(m);
- glTranslatef(-ex, -ey, -ez);
+ GLdouble m[16] = { x[0], y[0], z[0], 0, x[1], y[1], z[1], 0, x[2], y[2], z[2], 0, 0, 0, 0, 1 };
+ glMultMatrixd(m);
+ glTranslated(-ex, -ey, -ez);
}
}
-void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
+void gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{
- GLfloat y = zNear * tan (fovy * M_PI / 360.0f);
+ GLdouble y = zNear * tan (fovy * M_PI / 360.0);
glFrustum (-y*aspect, y*aspect, -y, y, zNear, zFar);
}
@@ -1329,7 +1318,8 @@ void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
* in - the 4x1 vector
* Output: out - the resulting 4x1 vector.
*/
-static void transform_point(GLfloat out[4], const GLfloat m[16], const GLfloat in[4])
+static void transform_point( GLdouble out[4], const GLdouble m[16],
+ const GLdouble in[4] )
{
#define M(row,col) m[col*4+row]
out[0] = M(0,0) * in[0] + M(0,1) * in[1] + M(0,2) * in[2] + M(0,3) * in[3];
@@ -1347,10 +1337,10 @@ static void transform_point(GLfloat out[4], const GLfloat m[16], const GLfloat i
* Input: a, b - matrices to multiply
* Output: product - product of a and b
*/
-static void matmul(GLfloat *product, const GLfloat *a, const GLfloat *b)
+static void matmul( GLdouble *product, const GLdouble *a, const GLdouble *b )
{
/* This matmul was contributed by Thomas Malik */
- GLfloat temp[16];
+ GLdouble temp[16];
GLint i;
#define A(row,col) a[(col<<2)+row]
@@ -1369,7 +1359,7 @@ static void matmul(GLfloat *product, const GLfloat *a, const GLfloat *b)
#undef A
#undef B
#undef T
- memcpy( product, temp, 16*sizeof(GLfloat) );
+ memcpy( product, temp, 16*sizeof(GLdouble) );
}
@@ -1379,15 +1369,15 @@ static void matmul(GLfloat *product, const GLfloat *a, const GLfloat *b)
* Code contributed by Jacques Leroy jle@star.be
* Return GL_TRUE for success, GL_FALSE for failure (singular matrix)
*/
-static GLboolean invert_matrix(const GLfloat *m, GLfloat *out)
+static GLboolean invert_matrix( const GLdouble *m, GLdouble *out )
{
/* NB. OpenGL Matrices are COLUMN major. */
-#define SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; }
+#define SWAP_ROWS(a, b) { GLdouble *_tmp = a; (a)=(b); (b)=_tmp; }
#define MAT(m,r,c) (m)[(c)*4+(r)]
- GLfloat wtmp[4][8];
- GLfloat m0, m1, m2, m3, s;
- GLfloat *r0, *r1, *r2, *r3;
+ GLdouble wtmp[4][8];
+ GLdouble m0, m1, m2, m3, s;
+ GLdouble *r0, *r1, *r2, *r3;
r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
@@ -1454,11 +1444,11 @@ static GLboolean invert_matrix(const GLfloat *m, GLfloat *out)
/* last check */
if (0.0 == r3[3]) return GL_FALSE;
- s = 1.0f/r3[3]; /* now back substitute row 3 */
+ s = 1.0/r3[3]; /* now back substitute row 3 */
r3[4] *= s; r3[5] *= s; r3[6] *= s; r3[7] *= s;
m2 = r2[3]; /* now back substitute row 2 */
- s = 1.0f/r2[2];
+ s = 1.0/r2[2];
r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
m1 = r1[3];
@@ -1469,7 +1459,7 @@ static GLboolean invert_matrix(const GLfloat *m, GLfloat *out)
r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
m1 = r1[2]; /* now back substitute row 1 */
- s = 1.0f/r1[1];
+ s = 1.0/r1[1];
r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
m0 = r0[2];
@@ -1477,7 +1467,7 @@ static GLboolean invert_matrix(const GLfloat *m, GLfloat *out)
r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
m0 = r0[1]; /* now back substitute row 0 */
- s = 1.0f/r0[0];
+ s = 1.0/r0[0];
r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
@@ -1499,12 +1489,13 @@ static GLboolean invert_matrix(const GLfloat *m, GLfloat *out)
/* projection du point (objx,objy,obz) sur l'ecran (winx,winy,winz) */
-GLint gluProject(GLfloat objx, GLfloat objy, GLfloat objz,
- const GLfloat model[16],const GLfloat proj[16], const GLint viewport[4],
- GLfloat *winx, GLfloat *winy, GLfloat *winz)
+GLint gluProject(GLdouble objx,GLdouble objy,GLdouble objz,
+ const GLdouble model[16],const GLdouble proj[16],
+ const GLint viewport[4],
+ GLdouble *winx,GLdouble *winy,GLdouble *winz)
{
/* matrice de transformation */
- GLfloat in[4],out[4];
+ GLdouble in[4],out[4];
/* initilise la matrice et le vecteur a transformer */
in[0]=objx; in[1]=objy; in[2]=objz; in[3]=1.0;
@@ -1528,18 +1519,19 @@ GLint gluProject(GLfloat objx, GLfloat objy, GLfloat objz,
/* transformation du point ecran (winx,winy,winz) en point objet */
-GLint gluUnProject(GLfloat winx, GLfloat winy, GLfloat winz,
- const GLfloat model[16],const GLfloat proj[16], const GLint viewport[4],
- GLfloat *objx, GLfloat *objy, GLfloat *objz)
+GLint gluUnProject(GLdouble winx,GLdouble winy,GLdouble winz,
+ const GLdouble model[16],const GLdouble proj[16],
+ const GLint viewport[4],
+ GLdouble *objx,GLdouble *objy,GLdouble *objz)
{
/* matrice de transformation */
- GLfloat m[16], A[16];
- GLfloat in[4],out[4];
+ GLdouble m[16], A[16];
+ GLdouble in[4],out[4];
/* transformation coordonnees normalisees entre -1 et 1 */
- in[0]=(winx-viewport[0])*2/viewport[2] - 1.0f;
- in[1]=(winy-viewport[1])*2/viewport[3] - 1.0f;
- in[2]=2*winz - 1.0f;
+ in[0]=(winx-viewport[0])*2/viewport[2] - 1.0;
+ in[1]=(winy-viewport[1])*2/viewport[3] - 1.0;
+ in[2]=2*winz - 1.0;
in[3]=1.0;
/* calcul transformation inverse */
diff --git a/common/opengl.h b/common/opengl.h
index d438f1d..6445b5c 100755
--- a/common/opengl.h
+++ b/common/opengl.h
@@ -13,7 +13,6 @@
#include <GL/gl.h>
#include <GL/glx.h>
#include "linux_gl.h"
-#define LC_OPENGL_DYNAMIC 1
#endif
#ifdef LC_MACOSX
@@ -21,34 +20,19 @@
#include <AGL/agl.h>
#endif
-#ifdef LC_IPHONE
-#import <UIKit/UIKit.h>
-#import <OpenGLES/EAGL.h>
-#import <OpenGLES/ES1/gl.h>
-#import <OpenGLES/ES1/glext.h>
-#define LC_OPENGLES 1
-#endif
-
-#ifdef LC_OPENGLES
-
-typedef GLfloat GLdouble;
-
-#define glFrustum(l, r, b, t, n, f) glFrustumf(l, r, b, t, n, f)
-#define glOrtho(l, r, b, t, n, f) glOrthof(l, r, b, t, n, f)
-
-#endif
-
//#include <GL/glu.h> // TODO: remove all glu calls
-void gluLookAt(GLfloat eyex, GLfloat eyey, GLfloat eyez,
- GLfloat centerx, GLfloat centery, GLfloat centerz,
- GLfloat upx, GLfloat upy, GLfloat upz);
-void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);
-GLint gluProject(GLfloat objx, GLfloat objy, GLfloat objz,
- const GLfloat model[16], const GLfloat proj[16], const GLint viewport[4],
- GLfloat *winx, GLfloat *winy, GLfloat *winz);
-GLint gluUnProject(GLfloat winx, GLfloat winy, GLfloat winz,
- const GLfloat model[16], const GLfloat proj[16], const GLint viewport[4],
- GLfloat *objx, GLfloat *objy, GLfloat *objz);
+void gluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez,
+ GLdouble centerx, GLdouble centery, GLdouble centerz,
+ GLdouble upx, GLdouble upy, GLdouble upz);
+void gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
+GLint gluProject (GLdouble objx, GLdouble objy, GLdouble objz,
+ const GLdouble model[16], const GLdouble proj[16],
+ const GLint viewport[4],
+ GLdouble *winx, GLdouble *winy, GLdouble *winz);
+GLint gluUnProject (GLdouble winx, GLdouble winy, GLdouble winz,
+ const GLdouble model[16], const GLdouble proj[16],
+ const GLint viewport[4],
+ GLdouble *objx, GLdouble *objy, GLdouble *objz);
bool GL_Initialize (const char* libname);
void GL_Shutdown ();
@@ -59,8 +43,6 @@ bool GL_HasCompiledVertexArrays ();
bool GL_HasClampToEdge ();
bool GL_HasPointParameters ();
-#ifdef LC_OPENGL_DYNAMIC
-
// =============================================================================
// OpenGL functions typedefs
@@ -428,8 +410,6 @@ typedef void (APIENTRY *PFNGLLOADNAME) (GLuint name);
typedef void (APIENTRY *PFNGLPUSHNAME) (GLuint name);
typedef void (APIENTRY *PFNGLPOPNAME) (void);
-#endif // LC_OPENGL_DYNAMIC
-
// GL_ARB_multitexture
typedef void (APIENTRY *PFNGLACTIVETEXTUREARB) (GLenum texture);
typedef void (APIENTRY *PFNGLCLIENTACTIVETEXTUREARB) (GLenum texture);
@@ -536,8 +516,6 @@ typedef void (APIENTRY *PFNGLUNLOCKARRAYSEXT) (void);
// =============================================================================
// OpenGL extern declarations
-#ifdef LC_OPENGL_DYNAMIC
-
extern PFNGLCLEARINDEX pfnglClearIndex;
extern PFNGLCLEARCOLOR pfnglClearColor;
extern PFNGLCLEAR pfnglClear;
@@ -875,8 +853,6 @@ extern PFNGLLOADNAME pfnglLoadName;
extern PFNGLPUSHNAME pfnglPushName;
extern PFNGLPOPNAME pfnglPopName;
-#endif // LC_OPENGL_DYNAMIC
-
extern PFNGLACTIVETEXTUREARB pfnglActiveTextureARB;
extern PFNGLCLIENTACTIVETEXTUREARB pfnglClientActiveTextureARB;
extern PFNGLMULTITEXCOORD1DARB pfnglMultiTexCoord1dARB;
@@ -919,8 +895,6 @@ extern PFNGLUNLOCKARRAYSEXT pfnglUnlockArraysEXT;
// =============================================================================
// Replace OpenGL function names with the dynamic functions
-#ifdef LC_OPENGL_DYNAMIC
-
#define glClearIndex pfnglClearIndex
#define glClearColor pfnglClearColor
#define glClear pfnglClear
@@ -1258,8 +1232,6 @@ extern PFNGLUNLOCKARRAYSEXT pfnglUnlockArraysEXT;
#define glPushName pfnglPushName
#define glPopName pfnglPopName
-#endif // LC_OPENGL_DYNAMIC
-
#define glActiveTextureARB pfnglActiveTextureARB
#define glClientActiveTextureARB pfnglClientActiveTextureARB
#define glMultiTexCoord1dARB pfnglMultiTexCoord1dARB
@@ -1299,19 +1271,4 @@ extern PFNGLUNLOCKARRAYSEXT pfnglUnlockArraysEXT;
#define glLockArraysEXT pfnglLockArraysEXT
#define glUnlockArraysEXT pfnglUnlockArraysEXT
-inline void glEnableLineStipple()
-{
-#ifndef LC_OPENGLES
- glEnable(GL_LINE_STIPPLE);
- glLineStipple(5, 0x5555);
-#endif
-}
-
-inline void glDisableLineStipple()
-{
-#ifndef LC_OPENGLES
- glDisable(GL_LINE_STIPPLE);
-#endif
-}
-
#endif // _OPENGL_H_
diff --git a/common/piece.cpp b/common/piece.cpp
index 71b5af1..42519e7 100644
--- a/common/piece.cpp
+++ b/common/piece.cpp
@@ -31,9 +31,9 @@ inline static void SetCurrentColor(unsigned char nColor, bool* bTrans, bool bLig
bool Transparent = (nColor > 13 && nColor < 22);
if (bLighting || Transparent)
- glColor4ub(ColorArray[nColor][0], ColorArray[nColor][1], ColorArray[nColor][2], ColorArray[nColor][3]);
+ glColor4ubv(ColorArray[nColor]);
else
- glColor4ub(FlatColorArray[nColor][0], FlatColorArray[nColor][1], FlatColorArray[nColor][2], 255);
+ glColor3ubv(FlatColorArray[nColor]);
if (nColor > 27)
return;
@@ -483,6 +483,21 @@ void Piece::MinIntersectDist(LC_CLICKLINE* pLine)
{
info++;
+ for (i = 0; i < *info; i += 4)
+ {
+ Vector3 v1(verts[info[i+1]*3], verts[info[i+1]*3+1], verts[info[i+1]*3+2]);
+ Vector3 v2(verts[info[i+2]*3], verts[info[i+2]*3+1], verts[info[i+2]*3+2]);
+ Vector3 v3(verts[info[i+3]*3], verts[info[i+3]*3+1], verts[info[i+3]*3+2]);
+ Vector3 v4(verts[info[i+4]*3], verts[info[i+4]*3+1], verts[info[i+4]*3+2]);
+
+ if (LineQuadMinIntersection(v1, v2, v3, v4, Start, End, pLine->mindist, Intersection))
+ {
+ pLine->pClosest = this;
+ }
+ }
+
+ info += *info + 1;
+
for (i = 0; i < *info; i += 3)
{
Vector3 v1(verts[info[i+1]*3], verts[info[i+1]*3+1], verts[info[i+1]*3+2]);
@@ -509,6 +524,21 @@ void Piece::MinIntersectDist(LC_CLICKLINE* pLine)
{
info++;
+ for (i = 0; i < *info; i += 4)
+ {
+ Vector3 v1(verts[info[i+1]*3], verts[info[i+1]*3+1], verts[info[i+1]*3+2]);
+ Vector3 v2(verts[info[i+2]*3], verts[info[i+2]*3+1], verts[info[i+2]*3+2]);
+ Vector3 v3(verts[info[i+3]*3], verts[info[i+3]*3+1], verts[info[i+3]*3+2]);
+ Vector3 v4(verts[info[i+4]*3], verts[info[i+4]*3+1], verts[info[i+4]*3+2]);
+
+ if (LineQuadMinIntersection(v1, v2, v3, v4, Start, End, pLine->mindist, Intersection))
+ {
+ pLine->pClosest = this;
+ }
+ }
+
+ info += *info + 1;
+
for (i = 0; i < *info; i += 3)
{
Vector3 v1(verts[info[i+1]*3], verts[info[i+1]*3+1], verts[info[i+1]*3+2]);
@@ -672,6 +702,18 @@ bool Piece::IntersectsVolume(const Vector4* Planes, int NumPlanes)
{
info++;
+ for (i = 0; i < *info; i += 4)
+ {
+ if (PolygonIntersectsPlanes(&verts[info[i+1]*3], &verts[info[i+2]*3],
+ &verts[info[i+3]*3], &verts[info[i+4]*3], LocalPlanes, NumPlanes))
+ {
+ ret = true;
+ break;
+ }
+ }
+
+ info += *info + 1;
+
for (i = 0; i < *info; i += 3)
{
if (PolygonIntersectsPlanes(&verts[info[i+1]*3], &verts[info[i+2]*3],
@@ -696,6 +738,18 @@ bool Piece::IntersectsVolume(const Vector4* Planes, int NumPlanes)
{
info++;
+ for (i = 0; i < *info; i += 4)
+ {
+ if (PolygonIntersectsPlanes(&verts[info[i+1]*3], &verts[info[i+2]*3],
+ &verts[info[i+3]*3], &verts[info[i+4]*3], LocalPlanes, NumPlanes))
+ {
+ ret = true;
+ break;
+ }
+ }
+
+ info += *info + 1;
+
for (i = 0; i < *info; i += 3)
{
if (PolygonIntersectsPlanes(&verts[info[i+1]*3], &verts[info[i+2]*3],
@@ -824,7 +878,7 @@ void Piece::BuildDrawInfo()
DRAWGROUP* dg;
bool add;
unsigned short group, colcount, i, j;
- unsigned long count[LC_COL_DEFAULT+1][2], vert;
+ unsigned long count[LC_COL_DEFAULT+1][3], vert;
memset (count, 0, sizeof(count));
// Get the vertex count
@@ -859,6 +913,8 @@ void Piece::BuildDrawInfo()
p += *p + 1;
count[curcol][1] += *p;
p += *p + 1;
+ count[curcol][2] += *p;
+ p += *p + 1;
}
}
else
@@ -876,6 +932,8 @@ void Piece::BuildDrawInfo()
p += *p + 1;
count[curcol][1] += *p;
p += *p + 1;
+ count[curcol][2] += *p;
+ p += *p + 1;
}
}
}
@@ -884,12 +942,12 @@ void Piece::BuildDrawInfo()
colcount = 0;
vert = 0;
for (i = 0; i < LC_COL_DEFAULT+1; i++)
- if (count[i][0] || count[i][1])
+ if (count[i][0] || count[i][1] || count[i][2])
{
colcount++;
- vert += count[i][0] + count[i][1];
+ vert += count[i][0] + count[i][1] + count[i][2];
}
- vert += (colcount*3)+1;
+ vert += (colcount*4)+1;
// Build the info
if (m_pPieceInfo->m_nFlags & LC_PIECE_LONGDATA)
@@ -902,12 +960,12 @@ void Piece::BuildDrawInfo()
for (i = LC_COL_DEFAULT; i != LC_COL_EDGES+1;)
{
- if (count[i][0] || count[i][1])
+ if (count[i][0] || count[i][1] || count[i][2])
{
*drawinfo = i;
drawinfo++;
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 3; j++)
{
*drawinfo = count[i][j];
drawinfo++;
@@ -956,12 +1014,20 @@ void Piece::BuildDrawInfo()
drawinfo += *p;
}
p += *p + 1;
- }
+
+ if (j == 2)
+ {
+ memcpy(drawinfo, p+1, (*p)*sizeof(unsigned long));
+ drawinfo += *p;
+ }
+ p += *p + 1;
+ }
else
{
p++;
p += *p + 1;
p += *p + 1;
+ p += *p + 1;
}
}
}
@@ -983,12 +1049,12 @@ void Piece::BuildDrawInfo()
for (i = LC_COL_DEFAULT; i != LC_COL_EDGES+1;)
{
- if (count[i][0] || count[i][1])
+ if (count[i][0] || count[i][1] || count[i][2])
{
*drawinfo = i;
drawinfo++;
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 3; j++)
{
*drawinfo = (unsigned short)count[i][j];
drawinfo++;
@@ -1037,12 +1103,20 @@ void Piece::BuildDrawInfo()
drawinfo += *p;
}
p += *p + 1;
+
+ if (j == 2)
+ {
+ memcpy(drawinfo, p+1, (*p)*sizeof(unsigned short));
+ drawinfo += *p;
+ }
+ p += *p + 1;
}
else
{
p++;
p += *p + 1;
p += *p + 1;
+ p += *p + 1;
}
}
}
@@ -1063,23 +1137,20 @@ void Piece::RenderBox(bool bHilite, float fLineWidth)
glTranslatef(m_fPosition[0], m_fPosition[1], m_fPosition[2]);
glRotatef(m_fRotation[3], m_fRotation[0], m_fRotation[1], m_fRotation[2]);
-#ifndef LC_OPENGLES
if (bHilite && ((m_nState & LC_PIECE_SELECTED) != 0))
{
- int Color = m_nState & LC_PIECE_FOCUSED ? LC_COL_FOCUSED : LC_COL_SELECTED;
- glColor4ub(FlatColorArray[Color][0], FlatColorArray[Color][1], FlatColorArray[Color][2], 255);
+ glColor3ubv(FlatColorArray[m_nState & LC_PIECE_FOCUSED ? LC_COL_FOCUSED : LC_COL_SELECTED]);
glLineWidth(2*fLineWidth);
glPushAttrib(GL_POLYGON_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- m_pPieceInfo->RenderBox();
+ glCallList(m_pPieceInfo->GetBoxDisplayList());
glPopAttrib();
glLineWidth(fLineWidth);
}
else
-#endif
{
- glColor4ub(FlatColorArray[m_nColor][0], FlatColorArray[m_nColor][1], FlatColorArray[m_nColor][2], 255);
- m_pPieceInfo->RenderBox();
+ glColor3ubv(FlatColorArray[m_nColor]);
+ glCallList(m_pPieceInfo->GetBoxDisplayList());
}
glPopMatrix();
}
@@ -1103,23 +1174,21 @@ void Piece::Render(bool bLighting, bool bEdges, unsigned char* nLastColor, bool*
}
glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, m_pPieceInfo->m_pTextures[sh].vertex);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, m_pPieceInfo->m_pTextures[sh].coords);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glBegin(GL_QUADS);
+ glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[0]);
+ glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[0]);
+ glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[1]);
+ glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[1]);
+ glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[2]);
+ glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[2]);
+ glTexCoord2fv(m_pPieceInfo->m_pTextures[sh].coords[3]);
+ glVertex3fv(m_pPieceInfo->m_pTextures[sh].vertex[3]);
+ glEnd();
glDisable(GL_TEXTURE_2D);
}
- glEnableClientState(GL_VERTEX_ARRAY);
-
if (m_pPieceInfo->m_nFlags & LC_PIECE_LONGDATA)
{
-#ifndef LC_OPENGLES
unsigned long colors, *info = (unsigned long*)m_pDrawInfo;
colors = *info;
info++;
@@ -1148,6 +1217,14 @@ void Piece::Render(bool bLighting, bool bEdges, unsigned char* nLastColor, bool*
if (*info)
{
+ glDrawElements(GL_QUADS, *info, GL_UNSIGNED_INT, info+1);
+ info += *info + 1;
+ }
+ else
+ info++;
+
+ if (*info)
+ {
glDrawElements(GL_TRIANGLES, *info, GL_UNSIGNED_INT, info+1);
info += *info + 1;
}
@@ -1181,7 +1258,6 @@ void Piece::Render(bool bLighting, bool bEdges, unsigned char* nLastColor, bool*
if (lock)
glUnlockArraysEXT();
}
-#endif
}
else
{
@@ -1213,6 +1289,14 @@ void Piece::Render(bool bLighting, bool bEdges, unsigned char* nLastColor, bool*
if (*info)
{
+ glDrawElements(GL_QUADS, *info, GL_UNSIGNED_SHORT, info+1);
+ info += *info + 1;
+ }
+ else
+ info++;
+
+ if (*info)
+ {
glDrawElements(GL_TRIANGLES, *info, GL_UNSIGNED_SHORT, info+1);
info += *info + 1;
}
diff --git a/common/pieceinf.cpp b/common/pieceinf.cpp
index cab91d4..eee37e4 100644
--- a/common/pieceinf.cpp
+++ b/common/pieceinf.cpp
@@ -17,7 +17,7 @@
#include "library.h"
#include "lc_application.h"
-#define SIDES 8
+#define SIDES 16
static float sintbl[SIDES];
static float costbl[SIDES];
@@ -217,6 +217,7 @@ void PieceInfo::LoadIndex (File& file)
m_pGroups = NULL;
m_nTextureCount = 0;
m_pTextures = NULL;
+ m_nBoxList = 0;
file.Read (m_strName, 8);
m_strName[8] = '\0';
@@ -266,651 +267,1246 @@ void PieceInfo::DeRef()
FreeInformation();
}
-void PieceInfo::RenderBox()
+void PieceInfo::CreateBoxDisplayList()
{
- float Verts[8][3] =
+ if (m_nBoxList)
+ return;
+
+ // Create a display for the bounding box.
+ m_nBoxList = glGenLists(1);
+ glNewList(m_nBoxList, GL_COMPILE);
+ glEnableClientState(GL_VERTEX_ARRAY);
+
+ float box[24][3] =
{
{ m_fDimensions[0], m_fDimensions[1], m_fDimensions[2] },
{ m_fDimensions[3], m_fDimensions[1], m_fDimensions[2] },
{ m_fDimensions[3], m_fDimensions[4], m_fDimensions[2] },
{ m_fDimensions[0], m_fDimensions[4], m_fDimensions[2] },
{ m_fDimensions[0], m_fDimensions[1], m_fDimensions[5] },
+ { m_fDimensions[0], m_fDimensions[4], m_fDimensions[5] },
+ { m_fDimensions[3], m_fDimensions[4], m_fDimensions[5] },
+ { m_fDimensions[3], m_fDimensions[1], m_fDimensions[5] },
+ { m_fDimensions[3], m_fDimensions[4], m_fDimensions[2] },
+ { m_fDimensions[3], m_fDimensions[1], m_fDimensions[2] },
+ { m_fDimensions[3], m_fDimensions[1], m_fDimensions[5] },
+ { m_fDimensions[3], m_fDimensions[4], m_fDimensions[5] },
+ { m_fDimensions[0], m_fDimensions[4], m_fDimensions[5] },
+ { m_fDimensions[0], m_fDimensions[1], m_fDimensions[5] },
+ { m_fDimensions[0], m_fDimensions[1], m_fDimensions[2] },
+ { m_fDimensions[0], m_fDimensions[4], m_fDimensions[2] },
+ { m_fDimensions[0], m_fDimensions[1], m_fDimensions[5] },
{ m_fDimensions[3], m_fDimensions[1], m_fDimensions[5] },
+ { m_fDimensions[3], m_fDimensions[1], m_fDimensions[2] },
+ { m_fDimensions[0], m_fDimensions[1], m_fDimensions[2] },
+ { m_fDimensions[0], m_fDimensions[4], m_fDimensions[2] },
+ { m_fDimensions[3], m_fDimensions[4], m_fDimensions[2] },
{ m_fDimensions[3], m_fDimensions[4], m_fDimensions[5] },
{ m_fDimensions[0], m_fDimensions[4], m_fDimensions[5] }
};
- unsigned short Indices[] =
- {
- 0, 4, 1, 5, 2, 6, 3, 7,
- 1, 2, 0, 3, 4, 7, 5, 6,
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
-
- glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_SHORT, Indices);
- glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_SHORT, Indices+8);
-
- glDisableClientState(GL_VERTEX_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, box);
+ glDrawArrays(GL_QUADS, 0, 24);
+ glEndList();
}
-inline lcuint16 EndianSwap(lcuint16 Val)
+void PieceInfo::LoadInformation()
{
- return LCUINT16(Val);
-}
+ FileDisk bin;
+ char filename[LC_MAXPATH];
+ CONNECTIONINFO* pConnection;
+ DRAWGROUP* pGroup;
+ void* buf;
+ lcuint32 verts, *longs, fixverts;
+ lcuint16 *ushorts, sh;
+ lcuint8 *bytes, *tmp, bt;
+ float scale, shift;
+ lcint16* shorts;
+ int i, j;
+
+ // We don't want memory leaks.
+ FreeInformation ();
-inline lcuint32 EndianSwap(lcuint32 Val)
-{
- return LCUINT32(Val);
-}
+ // Open pieces.bin and buffer the information we need.
+ strcpy (filename, lcGetPiecesLibrary()->GetLibraryPath());
+ strcat (filename, "pieces.bin");
+ if (!bin.Open (filename, "rb"))
+ return;
+
+ buf = malloc(m_nSize);
+ bin.Seek(m_nOffset, SEEK_SET);
+ bin.Read(buf, m_nSize);
+ bin.Close();
+
+ shift = 1.0f/(1<<14);
+ scale = 0.01f;
+ if (m_nFlags & LC_PIECE_MEDIUM) scale = 0.001f;
+ if (m_nFlags & LC_PIECE_SMALL) scale = 0.0001f;
+ longs = (lcuint32*)buf;
+ fixverts = verts = LCUINT32(*longs);
+ bytes = (unsigned char*)(longs + 1);
+ bytes += verts * sizeof(lcint16) * 3;
+
+ // Read connections
+ m_nConnectionCount = LCUINT16(*((lcuint16*)bytes));
+ bytes += sizeof (lcuint16);
+ m_pConnections = (CONNECTIONINFO*)malloc (m_nConnectionCount * sizeof(CONNECTIONINFO));
+
+ sh = m_nConnectionCount;
+ for (pConnection = m_pConnections; sh--; pConnection++)
+ {
+ pConnection->type = *bytes;
+ bytes++;
+
+ shorts = (lcint16*)bytes;
+ pConnection->center[0] = (float)(LCINT16(*shorts))*scale;
+ shorts++;
+ pConnection->center[1] = (float)(LCINT16(*shorts))*scale;
+ shorts++;
+ pConnection->center[2] = (float)(LCINT16(*shorts))*scale;
+ shorts++;
+ pConnection->normal[0] = (float)(LCINT16(*shorts))*shift;
+ shorts++;
+ pConnection->normal[1] = (float)(LCINT16(*shorts))*shift;
+ shorts++;
+ pConnection->normal[2] = (float)(LCINT16(*shorts))*shift;
+ shorts++;
+
+ bytes = (unsigned char*)shorts;
+ }
-template<class S, class D>
-static void WriteMeshDrawInfo(lcuint8*& Data, DRAWGROUP* Group)
-{
- S* SrcPtr = (S*)Data;
- int NumColors = EndianSwap(*SrcPtr);
- SrcPtr++;
+ // Load textures
+ m_nTextureCount = *bytes;
+ if (m_nTextureCount > 0)
+ m_pTextures = (TEXTURE*)malloc(m_nTextureCount*sizeof(TEXTURE));
+ bytes++;
- // Count the number of indices needed.
- int TotalLines = 0, TotalTris = 0, TotalQuads = 0;
+ for (sh = 0; sh < m_nTextureCount; sh++)
+ {
+ char name[9];
+ TEXTURE* tex = &m_pTextures[sh];
+ tex->color = ConvertColor(*bytes);
+ bytes++;
- for (int i = 0; i < NumColors; i++)
- {
- SrcPtr++;
-
- int NumQuads = EndianSwap(*SrcPtr);
- SrcPtr += NumQuads + 1;
- TotalQuads += NumQuads;
- int NumTris = EndianSwap(*SrcPtr);
- SrcPtr += NumTris + 1;
- TotalTris += NumTris;
- int NumLines = EndianSwap(*SrcPtr);
- SrcPtr += NumLines + 1;
- TotalLines += NumLines;
- }
+ strcpy(name, (char*)bytes);
+ tex->texture = lcGetPiecesLibrary()->FindTexture(name);
- int TotalIndices = TotalLines + TotalTris + TotalQuads / 4 * 6 + 1 + 3 * NumColors;
+ shorts = (lcint16*)(bytes + 8);
+ for (i = 0; i < 4; i++)
+ {
+ tex->vertex[i][0] = (float)LCINT16(shorts[0])*scale;
+ tex->vertex[i][1] = (float)LCINT16(shorts[1])*scale;
+ tex->vertex[i][2] = (float)LCINT16(shorts[2])*scale;
+ shorts += 3;
+ }
- Group->drawinfo = malloc(TotalIndices * sizeof(D));
- D* DestPtr = (D*)Group->drawinfo;
+ for (i = 0; i < 4; i++)
+ {
+ tex->coords[i][0] = (float)LCINT16(shorts[0]);
+ tex->coords[i][1] = (float)LCINT16(shorts[1]);
+ shorts += 2;
+ }
- SrcPtr = (S*)Data;
- SrcPtr++;
- *DestPtr = NumColors;
- DestPtr++;
+ bytes += 8 + 20*sizeof(lcuint16);
+ }
- for (int Color = 0; Color < NumColors; Color++)
- {
- *DestPtr = ConvertColor(EndianSwap(*SrcPtr));
- DestPtr++;
- SrcPtr++;
+ // Read groups
+ m_nGroupCount = LCUINT16(*((lcuint16*)bytes));
+ bytes += sizeof(lcuint16);
+ m_pGroups = (DRAWGROUP*)malloc(sizeof(DRAWGROUP)*m_nGroupCount);
+ memset(m_pGroups, 0, sizeof(DRAWGROUP)*m_nGroupCount);
+
+ // First we need to know the number of vertexes
+ tmp = bytes;
+ sh = m_nGroupCount;
+ lcuint32 quads = 0, fixquads = 0;
+ while (sh--)
+ {
+ bt = *bytes;
+ bytes++;
+ bytes += bt*sizeof(lcuint16);
- D* TriPtr = DestPtr;
- DestPtr++;
+ while (*bytes)
+ {
+ if (*bytes == LC_MESH)
+ {
+ if ((fixverts > 65535) || (m_nFlags & LC_PIECE_LONGDATA))
+ {
+ lcuint32 colors, *p;
+ p = (lcuint32*)(bytes + 1);
+ colors = LCUINT32(*p);
+ p++;
- int NumQuads = EndianSwap(*SrcPtr);
- SrcPtr++;
+ while (colors--)
+ {
+ p++; // color code
+ quads += LCUINT32(*p);
+ fixquads += LCUINT32(*p);
+ p += LCUINT32(*p) + 1;
+ p += LCUINT32(*p) + 1;
+ p += LCUINT32(*p) + 1;
+ }
- for (int i = 0; i < NumQuads; i += 4)
- {
- DestPtr[0] = EndianSwap(SrcPtr[0]);
- DestPtr[1] = EndianSwap(SrcPtr[1]);
- DestPtr[2] = EndianSwap(SrcPtr[2]);
- DestPtr[3] = EndianSwap(SrcPtr[0]);
- DestPtr[4] = EndianSwap(SrcPtr[2]);
- DestPtr[5] = EndianSwap(SrcPtr[3]);
- DestPtr += 6;
- SrcPtr += 4;
- }
+ bytes = (unsigned char*)p;
+ }
+ else
+ {
+ lcuint16 colors, *p;
+ p = (lcuint16*)(bytes + 1);
+ colors = LCUINT16(*p);
+ p++;
- int NumTris = EndianSwap(*SrcPtr);
- SrcPtr++;
+ while (colors--)
+ {
+ p++; // color code
+ quads += LCUINT16(*p);
+ fixquads += LCUINT16(*p);
+ p += LCUINT16(*p) + 1;
+ p += LCUINT16(*p) + 1;
+ p += LCUINT16(*p) + 1;
+ }
- for (int i = 0; i < NumTris; i++, SrcPtr++, DestPtr++)
- *DestPtr = EndianSwap(*SrcPtr);
+ bytes = (unsigned char*)p;
+ }
+ }
- *TriPtr = NumTris + NumQuads / 4 * 6;
+ if (*bytes == LC_STUD)
+ {
+ verts += (2*SIDES)+1;
+ quads += 4*SIDES;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ }
- int NumLines = EndianSwap(*SrcPtr);
- SrcPtr++;
- *DestPtr = NumLines;
- DestPtr++;
+ if (*bytes == LC_STUD2)
+ {
+ verts += 4*SIDES;
+ quads += 12*SIDES;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ }
- for (int i = 0; i < NumLines; i++, SrcPtr++, DestPtr++)
- *DestPtr = EndianSwap(*SrcPtr);
- }
+ if (*bytes == LC_STUD3)
+ {
+ verts += (2*SIDES)+1;
+ quads += 4*SIDES;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ }
- Data = (lcuint8*)SrcPtr;
-}
+ if (*bytes == LC_STUD4)
+ {
+ verts += 4*SIDES;
+ quads += 12*SIDES;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ }
+ }
+ bytes++; // should be 0
+ }
-template<class T>
-static void WriteStudDrawInfo(int Color, float* Verts, int BaseVertex, DRAWGROUP* Group, float Radius)
-{
- // Build vertices.
- for (int i = 0; i < SIDES; i++)
+ m_fVertexArray = (float*)malloc(3*sizeof(float)*verts);
+ m_nVertexCount = verts;
+ if ((verts > 65535) || (quads > 65535) || (fixquads > 65535))
{
- *Verts++ = Radius * costbl[i];
- *Verts++ = Radius * sintbl[i];
- *Verts++ = 0.0f;
-
- *Verts++ = Radius * costbl[i];
- *Verts++ = Radius * sintbl[i];
- *Verts++ = LC_STUD_HEIGHT;
+ if ((m_nFlags & LC_PIECE_LONGDATA) == 0)
+ {
+ m_nFlags |= LC_PIECE_LONGDATA | LC_PIECE_LONGDATA_RUNTIME;
+ }
}
+ else
+ m_nFlags &= ~(LC_PIECE_LONGDATA | LC_PIECE_LONGDATA_RUNTIME);
- *Verts++ = 0.0f;
- *Verts++ = 0.0f;
- *Verts++ = LC_STUD_HEIGHT;
-
- // Build indices.
- int NumIndices = 1 + 2 * 3 + 9 * SIDES + 4 * SIDES;
+ // Copy the 'fixed' vertexes
+ shorts = (lcint16*)(longs + 1);
+ for (verts = 0; verts < LCUINT32(*longs); verts++)
+ {
+ m_fVertexArray[verts*3] = (float)LCINT16(*shorts)*scale;
+ shorts++;
+ m_fVertexArray[verts*3+1] = (float)LCINT16(*shorts)*scale;
+ shorts++;
+ m_fVertexArray[verts*3+2] = (float)LCINT16(*shorts)*scale;
+ shorts++;
+ }
- Group->drawinfo = malloc(sizeof(T) * NumIndices);
- T* Indices = (T*)Group->drawinfo;
+ // Read groups
+ bytes = tmp;
+ sh = m_nGroupCount;
+ for (pGroup = m_pGroups; sh--; pGroup++)
+ {
+ bt = *bytes;
+ bytes++;
- *Indices++ = 2;
- *Indices++ = Color;
- *Indices++ = 9 * SIDES;
+ pGroup->connections[bt] = 0xFFFF;
+ while(bt--)
+ {
+ lcuint16 tmp = LCUINT16(*((lcuint16*)bytes));
+ pGroup->connections[bt] = tmp;
+ bytes += sizeof(lcuint16);
+ }
- int v0 = BaseVertex + 2 * SIDES;
+ // Currently there's only one type of drawinfo (mesh or stud)
+ // per group but this will change in the future.
+ switch (*bytes)
+ {
+ case LC_MESH:
+ if ((fixverts > 65535) || (fixquads > 65535))
+ {
+ lcuint32 colors, *p;
+ bytes++;
+ p = (lcuint32*)bytes;
+ *p = LCUINT32(*p);
+ colors = *p;
+ p++;
- // Triangles.
- for (int i = 0; i < SIDES; i++)
- {
- int i1 = BaseVertex + (i % SIDES) * 2;
- int i2 = BaseVertex + ((i + 1) % SIDES) * 2;
+ while (colors--)
+ {
+ *p = ConvertColor(LCUINT32(*p));
+ p++; // color code
+#ifdef LC_BIG_ENDIAN
+ int f;
+ f = LCUINT32(*p) + 1;
+ while (f--) { *p = LCUINT32(*p); p++; };
+ f = LCUINT32(*p) + 1;
+ while (f--) { *p = LCUINT32(*p); p++; };
+ f = LCUINT32(*p) + 1;
+ while (f--) { *p = LCUINT32(*p); p++; };
+#else
+ p += LCUINT32(*p) + 1;
+ p += LCUINT32(*p) + 1;
+ p += LCUINT32(*p) + 1;
+#endif
+ }
- int v1 = i1;
- int v2 = i1 + 1;
- int v3 = i2;
- int v4 = i2 + 1;
+ i = (unsigned char*)p - bytes;
+ pGroup->drawinfo = malloc(i);
+ memcpy(pGroup->drawinfo, bytes, i);
+ bytes = (unsigned char*)p;
+ }
+ else
+ {
+ lcuint16 colors, *p;
+ bytes++;
+ p = (lcuint16*)bytes;
+ *p = LCUINT16(*p);
+ colors = *p;
+ p++;
- *Indices++ = v0;
- *Indices++ = v2;
- *Indices++ = v4;
+ while (colors--)
+ {
+ *p = ConvertColor(LCUINT16(*p));
+ p++; // color code
+#ifdef LC_BIG_ENDIAN
+ int f;
+ f = LCUINT16(*p) + 1;
+ while (f--) { *p = LCUINT16(*p); p++; };
+ f = LCUINT16(*p) + 1;
+ while (f--) { *p = LCUINT16(*p); p++; };
+ f = LCUINT16(*p) + 1;
+ while (f--) { *p = LCUINT16(*p); p++; };
+#else
+ p += *p + 1;
+ p += *p + 1;
+ p += *p + 1;
+#endif
+ }
- *Indices++ = v1;
- *Indices++ = v3;
- *Indices++ = v2;
+ i = (unsigned char*)p - bytes;
- *Indices++ = v3;
- *Indices++ = v4;
- *Indices++ = v2;
- }
+ if (m_nFlags & LC_PIECE_LONGDATA)
+ {
+ pGroup->drawinfo = malloc(i*sizeof(lcuint32)/sizeof(lcuint16));
+ longs = (lcuint32*)pGroup->drawinfo;
- *Indices++ = 0;
+ for (ushorts = (lcuint16*)bytes; ushorts != p; ushorts++, longs++)
+ *longs = *ushorts;//LCUINT16(*ushorts);
+ }
+ else
+ {
+ pGroup->drawinfo = malloc(i);
+ memcpy(pGroup->drawinfo, bytes, i);
+ }
- // Lines.
- *Indices++ = LC_COL_EDGES;
- *Indices++ = 0;
- *Indices++ = 4 * SIDES;
+ bytes = (unsigned char*)p;
+ }
+ break;
- for (int i = 0; i < SIDES; i++)
+ case LC_STUD:
+ {
+ int size;
+ Matrix mat;
+
+ for (i = 0; i < 12; i++)
+ ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
+ mat.FromPacked ((float*)(bytes+2));
+ lcuint16 color = ConvertColor(*(bytes+1));
+
+ // Create the vertexes
+ for (i = 0; i < SIDES; i++)
+ {
+ m_fVertexArray[(verts+i+SIDES)*3] =
+ m_fVertexArray[(verts+i)*3] =
+ LC_STUD_RADIUS * costbl[i];
+ m_fVertexArray[(verts+i+SIDES)*3+1] =
+ m_fVertexArray[(verts+i)*3+1] =
+ LC_STUD_RADIUS * sintbl[i];
+ m_fVertexArray[(verts+i)*3+2] = 0;
+ m_fVertexArray[(verts+i+SIDES)*3+2] = LC_STUD_HEIGHT;
+ }
+ m_fVertexArray[(verts+2*SIDES)*3] = 0;
+ m_fVertexArray[(verts+2*SIDES)*3+1] = 0;
+ m_fVertexArray[(verts+2*SIDES)*3+2] = LC_STUD_HEIGHT;
+
+ mat.TransformPoints(&m_fVertexArray[verts*3], 2*SIDES+1);
+ // colors + 2*num_prim + sides*prims
+ size = 9+SIDES*11;
+
+ if (m_nFlags & LC_PIECE_LONGDATA)
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint32)*size);
+ longs = (lcuint32*)pGroup->drawinfo;
+
+ longs[0] = 2; // colors
+ longs[1] = color;
+ longs[2] = SIDES*4;
+ j = 3;
+
+ for (i = 0; i < SIDES; i++)
{
- int i1 = BaseVertex + (i % SIDES) * 2;
- int i2 = BaseVertex + ((i + 1) % SIDES) * 2;
-
- int v1 = i1;
- int v2 = i1 + 1;
- int v3 = i2;
- int v4 = i2 + 1;
-
- *Indices++ = v1;
- *Indices++ = v3;
-
- *Indices++ = v2;
- *Indices++ = v4;
+ longs[3+i*4] = (lcuint32)verts + i;
+ if (i == SIDES-1)
+ {
+ longs[4+i*4] = (lcuint32)verts;
+ longs[5+i*4] = (lcuint32)verts + SIDES;
+ }
+ else
+ {
+ longs[4+i*4] = (lcuint32)verts + i + 1;
+ longs[5+i*4] = (lcuint32)verts + SIDES + i + 1;
+ }
+ longs[6+i*4] = (lcuint32)verts + SIDES + i;
}
-}
+ j += 4*SIDES;
+ longs[j] = SIDES*3;
+ j++;
-template<class T>
-static void WriteHollowStudDrawInfo(int Color, float* Verts, int BaseVertex, DRAWGROUP* Group, float InnerRadius, float OuterRadius)
-{
- // Build vertices.
- for (int i = 0; i < SIDES; i++)
+ for (i = 0; i < SIDES; i++)
{
- // Outside.
- *Verts++ = OuterRadius * costbl[i];
- *Verts++ = OuterRadius * sintbl[i];
- *Verts++ = 0.0f;
-
- *Verts++ = OuterRadius * costbl[i];
- *Verts++ = OuterRadius * sintbl[i];
- *Verts++ = LC_STUD_HEIGHT;
-
- // Inside.
- *Verts++ = InnerRadius * costbl[i];
- *Verts++ = InnerRadius * sintbl[i];
- *Verts++ = LC_STUD_HEIGHT;
-
- *Verts++ = InnerRadius * costbl[i];
- *Verts++ = InnerRadius * sintbl[i];
- *Verts++ = 0.0f;
+ longs[j+i*3] = (lcuint16)verts + 2*SIDES;
+ longs[1+j+i*3] = (lcuint16)verts + SIDES + i;
+ if (i == SIDES-1)
+ longs[2+j+i*3] = (lcuint16)verts + SIDES;
+ else
+ longs[2+j+i*3] = (lcuint16)verts + SIDES + i + 1;
}
- // Build indices.
- int NumIndices = 1 + 2 * 3 + 18 * SIDES + 8 * SIDES;
-
- Group->drawinfo = malloc(sizeof(T) * NumIndices);
- T* Indices = (T*)Group->drawinfo;
+ j += 3*SIDES;
+ longs[j] = 0; j++; // lines
+ longs[j] = LC_COL_EDGES; j++; // color
+ longs[j] = 0; j++; // quads
+ longs[j] = 0; j++; // tris
+ longs[j] = 4*SIDES; j++;
- *Indices++ = 2;
- *Indices++ = Color;
- *Indices++ = 18 * SIDES;
-
- // Triangles.
- for (int i = 0; i < SIDES; i++)
+ for (i = 0; i < SIDES; i++)
{
- int i1 = BaseVertex + (i % SIDES) * 4;
- int i2 = BaseVertex + ((i + 1) % SIDES) * 4;
-
- int v1 = i1;
- int v2 = i1 + 1;
- int v3 = i1 + 2;
- int v4 = i1 + 3;
- int v5 = i2;
- int v6 = i2 + 1;
- int v7 = i2 + 2;
- int v8 = i2 + 3;
-
- *Indices++ = v1;
- *Indices++ = v5;
- *Indices++ = v2;
-
- *Indices++ = v5;
- *Indices++ = v6;
- *Indices++ = v2;
-
- *Indices++ = v2;
- *Indices++ = v6;
- *Indices++ = v3;
-
- *Indices++ = v6;
- *Indices++ = v7;
- *Indices++ = v3;
-
- *Indices++ = v3;
- *Indices++ = v7;
- *Indices++ = v4;
-
- *Indices++ = v7;
- *Indices++ = v8;
- *Indices++ = v4;
+ longs[j+i*4] = (lcuint32)verts + i;
+ if (i == SIDES-1)
+ longs[1+j+i*4] = (lcuint32)verts;
+ else
+ longs[1+j+i*4] = (lcuint32)verts + i + 1;
+
+ longs[2+j+i*4] = longs[j+i*4] + SIDES;
+ longs[3+j+i*4] = longs[1+j+i*4] + SIDES;
}
-
- *Indices++ = 0;
-
- // Lines.
- *Indices++ = LC_COL_EDGES;
- *Indices++ = 0;
- *Indices++ = 8 * SIDES;
-
- for (int i = 0; i < SIDES; i++)
+ }
+ else
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint16)*size);
+ ushorts = (lcuint16*)pGroup->drawinfo;
+
+ ushorts[0] = 2; // colors
+ ushorts[1] = color;
+ ushorts[2] = SIDES*4;
+ j = 3;
+
+ for (i = 0; i < SIDES; i++)
{
- int i1 = BaseVertex + (i % SIDES) * 4;
- int i2 = BaseVertex + ((i + 1) % SIDES) * 4;
+ ushorts[3+i*4] = (lcuint16)(verts + i);
+ if (i == SIDES-1)
+ {
+ ushorts[4+i*4] = (lcuint16)verts;
+ ushorts[5+i*4] = (lcuint16)verts + SIDES;
+ }
+ else
+ {
+ ushorts[4+i*4] = (lcuint16)verts + i + 1;
+ ushorts[5+i*4] = (lcuint16)verts + SIDES + i + 1;
+ }
+ ushorts[6+i*4] = (lcuint16)verts + SIDES + i;
+ }
+ j += 4*SIDES;
+ ushorts[j] = SIDES*3;
+ j++;
- int v1 = i1;
- int v2 = i1 + 1;
- int v3 = i1 + 2;
- int v4 = i1 + 3;
- int v5 = i2;
- int v6 = i2 + 1;
- int v7 = i2 + 2;
- int v8 = i2 + 3;
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*3] = (lcuint16)verts + 2*SIDES;
+ ushorts[1+j+i*3] = (lcuint16)verts + SIDES + i;
+ if (i == SIDES-1)
+ ushorts[2+j+i*3] = (lcuint16)verts + SIDES;
+ else
+ ushorts[2+j+i*3] = (lcuint16)verts + SIDES + i + 1;
+ }
- *Indices++ = v1;
- *Indices++ = v5;
+ j += 3*SIDES;
+ ushorts[j] = 0; j++; // lines
+ ushorts[j] = LC_COL_EDGES; j++; // color
+ ushorts[j] = 0; j++; // quads
+ ushorts[j] = 0; j++; // tris
+ ushorts[j] = 4*SIDES; j++;
- *Indices++ = v2;
- *Indices++ = v6;
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)verts + i;
+ if (i == SIDES-1)
+ ushorts[1+j+i*4] = (lcuint16)verts;
+ else
+ ushorts[1+j+i*4] = (lcuint16)verts + i + 1;
+
+ ushorts[2+j+i*4] = ushorts[j+i*4] + SIDES;
+ ushorts[3+j+i*4] = ushorts[1+j+i*4] + SIDES;
+ }
+ }
- *Indices++ = v3;
- *Indices++ = v7;
+ verts += 2*SIDES+1;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ } break;
- *Indices++ = v4;
- *Indices++ = v8;
+ case LC_STUD2:
+ {
+ int size;
+ Matrix mat;
+
+ for (i = 0; i < 12; i++)
+ ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
+ mat.FromPacked ((float*)(bytes+2));
+ lcuint16 color = ConvertColor(*(bytes+1));
+
+ // Create the vertexes
+ for (i = 0; i < SIDES; i++)
+ {
+ // outside
+ m_fVertexArray[(verts+i+SIDES)*3] =
+ m_fVertexArray[(verts+i)*3] =
+ LC_STUD_RADIUS * costbl[i];
+ m_fVertexArray[(verts+i+SIDES)*3+1] =
+ m_fVertexArray[(verts+i)*3+1] =
+ LC_STUD_RADIUS * sintbl[i];
+ m_fVertexArray[(verts+i)*3+2] = LC_STUD_HEIGHT;
+ m_fVertexArray[(verts+i+SIDES)*3+2] = 0;
+
+ // inside
+ m_fVertexArray[(verts+i+2*SIDES)*3] =
+ m_fVertexArray[(verts+i+3*SIDES)*3] =
+ 0.16f * costbl[i];
+ m_fVertexArray[(verts+i+2*SIDES)*3+1] =
+ m_fVertexArray[(verts+i+3*SIDES)*3+1] =
+ 0.16f * sintbl[i];
+ m_fVertexArray[(verts+i+3*SIDES)*3+2] = LC_STUD_HEIGHT;
+ m_fVertexArray[(verts+i+2*SIDES)*3+2] = 0;
+ }
+
+ mat.TransformPoints(&m_fVertexArray[verts*3], 4*SIDES);
+ // colors + 2*num_prim + sides*prims
+ size = 9+SIDES*20;
+
+ if (m_nFlags & LC_PIECE_LONGDATA)
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint32)*size);
+ longs = (lcuint32*)pGroup->drawinfo;
+
+ longs[0] = 2; // colors
+ longs[1] = color;
+ longs[2] = SIDES*12;
+ j = 3;
+
+ // outside
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)(verts + SIDES + i);
+ if (i == SIDES-1)
+ {
+ longs[j+1+i*4] = (lcuint32)verts + SIDES;
+ longs[j+2+i*4] = (lcuint32)verts;
+ }
+ else
+ {
+ longs[j+1+i*4] = (lcuint32)verts + SIDES + i + 1;
+ longs[j+2+i*4] = (lcuint32)verts + i + 1;
+ }
+ longs[j+3+i*4] = (lcuint32)verts + i;
}
-}
+ j += 4*SIDES;
-void PieceInfo::LoadInformation()
-{
- FileDisk bin;
- char filename[LC_MAXPATH];
- CONNECTIONINFO* pConnection;
- DRAWGROUP* pGroup;
- void* buf;
- lcuint32 verts, *longs, fixverts;
- lcuint16 sh;
- lcuint8 *bytes, *tmp, bt;
- float scale, shift;
- lcint16* shorts;
- int i;
-
- // We don't want memory leaks.
- FreeInformation ();
-
- // Open pieces.bin and buffer the information we need.
- strcpy (filename, lcGetPiecesLibrary()->GetLibraryPath());
- strcat (filename, "pieces.bin");
- if (!bin.Open (filename, "rb"))
- return;
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)(verts + 2*SIDES + i);
+ if (i == SIDES-1)
+ {
+ longs[j+1+i*4] = (lcuint32)verts + 2*SIDES;
+ longs[j+2+i*4] = (lcuint32)verts + 3*SIDES;
+ }
+ else
+ {
+ longs[j+1+i*4] = (lcuint32)verts + 2*SIDES + i + 1;
+ longs[j+2+i*4] = (lcuint32)verts + 3*SIDES + i + 1;
+ }
+ longs[j+3+i*4] = (lcuint32)verts + 3*SIDES + i;
+ }
+ j += 4*SIDES;
- buf = malloc(m_nSize);
- bin.Seek(m_nOffset, SEEK_SET);
- bin.Read(buf, m_nSize);
- bin.Close();
-
- shift = 1.0f/(1<<14);
- scale = 0.01f;
- if (m_nFlags & LC_PIECE_MEDIUM) scale = 0.001f;
- if (m_nFlags & LC_PIECE_SMALL) scale = 0.0001f;
- longs = (lcuint32*)buf;
- fixverts = verts = LCUINT32(*longs);
- bytes = (unsigned char*)(longs + 1);
- bytes += verts * sizeof(lcint16) * 3;
-
- // Read connections
- m_nConnectionCount = LCUINT16(*((lcuint16*)bytes));
- bytes += sizeof (lcuint16);
- m_pConnections = (CONNECTIONINFO*)malloc((m_nConnectionCount+1) * sizeof(CONNECTIONINFO));
-
- sh = m_nConnectionCount;
- for (pConnection = m_pConnections; sh--; pConnection++)
+ // ring
+ for (i = 0; i < SIDES; i++)
{
- pConnection->type = *bytes;
- bytes++;
-
- shorts = (lcint16*)bytes;
- pConnection->center[0] = (float)(LCINT16(*shorts))*scale;
- shorts++;
- pConnection->center[1] = (float)(LCINT16(*shorts))*scale;
- shorts++;
- pConnection->center[2] = (float)(LCINT16(*shorts))*scale;
- shorts++;
- pConnection->normal[0] = (float)(LCINT16(*shorts))*shift;
- shorts++;
- pConnection->normal[1] = (float)(LCINT16(*shorts))*shift;
- shorts++;
- pConnection->normal[2] = (float)(LCINT16(*shorts))*shift;
- shorts++;
-
- bytes = (unsigned char*)shorts;
+ longs[j+i*4] = (lcuint32)(verts + i);
+ if (i == SIDES-1)
+ {
+ longs[j+1+i*4] = (lcuint32)verts;
+ longs[j+2+i*4] = (lcuint32)verts + 3*SIDES;
+ }
+ else
+ {
+ longs[j+1+i*4] = (lcuint32)verts + i + 1;
+ longs[j+2+i*4] = (lcuint32)verts + 3*SIDES + i + 1;
+ }
+ longs[j+3+i*4] = (lcuint32)verts + 3*SIDES + i;
}
+ j += 4*SIDES;
- // Load textures
- m_nTextureCount = *bytes;
- if (m_nTextureCount > 0)
- m_pTextures = (TEXTURE*)malloc(m_nTextureCount*sizeof(TEXTURE));
- bytes++;
+ longs[j] = 0; j++; // tris
+ longs[j] = 0; j++; // lines
+ longs[j] = LC_COL_EDGES; j++; // color
+ longs[j] = 0; j++; // quads
+ longs[j] = 0; j++; // tris
+ longs[j] = 8*SIDES; j++;
- for (sh = 0; sh < m_nTextureCount; sh++)
+ // outside
+ for (i = 0; i < SIDES; i++)
{
- char name[9];
- TEXTURE* tex = &m_pTextures[sh];
- tex->color = ConvertColor(*bytes);
- bytes++;
-
- strcpy(name, (char*)bytes);
- tex->texture = lcGetPiecesLibrary()->FindTexture(name);
+ longs[j+i*4] = (lcuint32)verts + i;
+ if (i == SIDES-1)
+ longs[1+j+i*4] = (lcuint32)verts;
+ else
+ longs[1+j+i*4] = (lcuint32)verts + i + 1;
+
+ longs[2+j+i*4] = longs[j+i*4] + SIDES;
+ longs[3+j+i*4] = longs[1+j+i*4] + SIDES;
+ }
+ j += 4*SIDES;
- shorts = (lcint16*)(bytes + 8);
- for (i = 0; i < 4; i++)
- {
- tex->vertex[i][0] = (float)LCINT16(shorts[0])*scale;
- tex->vertex[i][1] = (float)LCINT16(shorts[1])*scale;
- tex->vertex[i][2] = (float)LCINT16(shorts[2])*scale;
- shorts += 3;
- }
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)verts + 2*SIDES + i;
+ if (i == SIDES-1)
+ longs[1+j+i*4] = (lcuint32)verts + 2*SIDES;
+ else
+ longs[1+j+i*4] = (lcuint32)verts + 2*SIDES + i + 1;
+
+ longs[2+j+i*4] = longs[j+i*4] + SIDES;
+ longs[3+j+i*4] = longs[1+j+i*4] + SIDES;
+ }
+ }
+ else
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint16)*size);
+ ushorts = (lcuint16*)pGroup->drawinfo;
+
+ ushorts[0] = 2; // colors
+ ushorts[1] = color;
+ ushorts[2] = SIDES*12;
+ j = 3;
+
+ // outside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)(verts + SIDES + i);
+ if (i == SIDES-1)
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + SIDES;
+ ushorts[j+2+i*4] = (lcuint16)verts;
+ }
+ else
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + SIDES + i + 1;
+ ushorts[j+2+i*4] = (lcuint16)verts + i + 1;
+ }
+ ushorts[j+3+i*4] = (lcuint16)verts + i;
+ }
+ j += 4*SIDES;
- for (i = 0; i < 4; i++)
- {
- tex->coords[i][0] = (float)LCINT16(shorts[0]);
- tex->coords[i][1] = (float)LCINT16(shorts[1]);
- shorts += 2;
- }
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)(verts + 3*SIDES + i);
+ if (i == SIDES-1)
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + 3*SIDES;
+ ushorts[j+2+i*4] = (lcuint16)verts + 2*SIDES;
+ }
+ else
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + 3*SIDES + i + 1;
+ ushorts[j+2+i*4] = (lcuint16)verts + 2*SIDES + i + 1;
+ }
+ ushorts[j+3+i*4] = (lcuint16)verts + 2*SIDES + i;
+ }
+ j += 4*SIDES;
- bytes += 8 + 20*sizeof(lcuint16);
+ // ring
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)(verts + i);
+ if (i == SIDES-1)
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts;
+ ushorts[j+2+i*4] = (lcuint16)verts + 3*SIDES;
+ }
+ else
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + i + 1;
+ ushorts[j+2+i*4] = (lcuint16)verts + 3*SIDES + i + 1;
+ }
+ ushorts[j+3+i*4] = (lcuint16)verts + 3*SIDES + i;
}
+ j += 4*SIDES;
- // Read groups
- m_nGroupCount = LCUINT16(*((lcuint16*)bytes));
- bytes += sizeof(lcuint16);
- m_pGroups = (DRAWGROUP*)malloc(sizeof(DRAWGROUP)*m_nGroupCount);
- memset(m_pGroups, 0, sizeof(DRAWGROUP)*m_nGroupCount);
+ ushorts[j] = 0; j++; // tris
+ ushorts[j] = 0; j++; // lines
+ ushorts[j] = LC_COL_EDGES; j++; // color
+ ushorts[j] = 0; j++; // quads
+ ushorts[j] = 0; j++; // tris
+ ushorts[j] = 8*SIDES; j++;
- // Calculate number of vertices.
- tmp = bytes;
- sh = m_nGroupCount;
- lcuint32 tris = 0;
- while (sh--)
+ // outside
+ for (i = 0; i < SIDES; i++)
{
- bt = *bytes;
- bytes++;
- bytes += bt*sizeof(lcuint16);
+ ushorts[j+i*4] = (lcuint16)verts + i;
+ if (i == SIDES-1)
+ ushorts[1+j+i*4] = (lcuint16)verts;
+ else
+ ushorts[1+j+i*4] = (lcuint16)verts + i + 1;
+
+ ushorts[2+j+i*4] = ushorts[j+i*4] + SIDES;
+ ushorts[3+j+i*4] = ushorts[1+j+i*4] + SIDES;
+ }
+ j += 4*SIDES;
- while (*bytes)
- {
- if (*bytes == LC_MESH)
- {
- if (m_nFlags & LC_PIECE_LONGDATA_FILE)
- {
- lcuint32 colors, *p;
- p = (lcuint32*)(bytes + 1);
- colors = LCUINT32(*p);
- p++;
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)verts + 2*SIDES + i;
+ if (i == SIDES-1)
+ ushorts[1+j+i*4] = (lcuint16)verts + 2*SIDES;
+ else
+ ushorts[1+j+i*4] = (lcuint16)verts + 2*SIDES + i + 1;
+
+ ushorts[2+j+i*4] = ushorts[j+i*4] + SIDES;
+ ushorts[3+j+i*4] = ushorts[1+j+i*4] + SIDES;
+ }
+ }
- while (colors--)
- {
- p++; // color code
- tris += LCUINT32(*p) / 4 * 6;
- p += LCUINT32(*p) + 1;
- tris += LCUINT32(*p);
- p += LCUINT32(*p) + 1;
- p += LCUINT32(*p) + 1;
- }
+ verts += 4*SIDES;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ } break;
- bytes = (unsigned char*)p;
- }
- else
- {
- lcuint16 colors, *p;
- p = (lcuint16*)(bytes + 1);
- colors = LCUINT16(*p);
- p++;
+ case LC_STUD3:
+ {
+ int size;
+ Matrix mat;
+
+ for (i = 0; i < 12; i++)
+ ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
+ mat.FromPacked ((float*)(bytes+2));
+ lcuint16 color = ConvertColor(*(bytes+1));
+
+ // Create the vertexes
+ for (i = 0; i < SIDES; i++)
+ {
+ m_fVertexArray[(verts+i+SIDES)*3] =
+ m_fVertexArray[(verts+i)*3] =
+ 0.16f * costbl[i];
+ m_fVertexArray[(verts+i+SIDES)*3+1] =
+ m_fVertexArray[(verts+i)*3+1] =
+ 0.16f * sintbl[i];
+ m_fVertexArray[(verts+i)*3+2] = 0;
+ m_fVertexArray[(verts+i+SIDES)*3+2] = LC_STUD_HEIGHT;
+ }
+ m_fVertexArray[(verts+2*SIDES)*3] = 0;
+ m_fVertexArray[(verts+2*SIDES)*3+1] = 0;
+ m_fVertexArray[(verts+2*SIDES)*3+2] = LC_STUD_HEIGHT;
+
+ mat.TransformPoints(&m_fVertexArray[verts*3], 2*SIDES+1);
+ // colors + 2*num_prim + sides*prims
+ size = 9+SIDES*11;
+
+ if (m_nFlags & LC_PIECE_LONGDATA)
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint32)*size);
+ longs = (lcuint32*)pGroup->drawinfo;
+
+ longs[0] = 2; // colors
+ longs[1] = color;
+ longs[2] = SIDES*4;
+ j = 3;
+
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[3+i*4] = (lcuint32)verts + SIDES + i;
+ if (i == SIDES-1)
+ {
+ longs[4+i*4] = (lcuint32)verts + SIDES;
+ longs[5+i*4] = (lcuint32)verts;
+ }
+ else
+ {
+ longs[4+i*4] = (lcuint32)verts + SIDES + i + 1;
+ longs[5+i*4] = (lcuint32)verts + i + 1;
+ }
+ longs[6+i*4] = (lcuint32)verts + i;
+ }
+ j += 4*SIDES;
+ longs[j] = SIDES*3;
+ j++;
- while (colors--)
- {
- p++; // color code
- tris += LCUINT32(*p) / 4 * 6;
- p += LCUINT16(*p) + 1;
- tris += LCUINT32(*p);
- p += LCUINT16(*p) + 1;
- p += LCUINT16(*p) + 1;
- }
+ for (i = 0; i < SIDES; i++)
+ {
+ if (i == SIDES-1)
+ longs[j+i*3] = (lcuint16)verts + SIDES;
+ else
+ longs[j+i*3] = (lcuint16)verts + SIDES + i + 1;
+ longs[1+j+i*3] = (lcuint16)verts + SIDES + i;
+ longs[2+j+i*3] = (lcuint16)verts + 2*SIDES;
+ }
- bytes = (unsigned char*)p;
- }
- }
+ j += 3*SIDES;
+ longs[j] = 0; j++; // lines
+ longs[j] = LC_COL_EDGES; j++; // color
+ longs[j] = 0; j++; // quads
+ longs[j] = 0; j++; // tris
+ longs[j] = 4*SIDES; j++;
- if (*bytes == LC_STUD)
- {
- verts += (2*SIDES)+1;
- tris += 9*SIDES;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- }
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)verts + i;
+ if (i == SIDES-1)
+ longs[1+j+i*4] = (lcuint32)verts;
+ else
+ longs[1+j+i*4] = (lcuint32)verts + i + 1;
+
+ longs[2+j+i*4] = longs[j+i*4] + SIDES;
+ longs[3+j+i*4] = longs[1+j+i*4] + SIDES;
+ }
+ }
+ else
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint16)*size);
+ ushorts = (lcuint16*)pGroup->drawinfo;
+
+ ushorts[0] = 2; // colors
+ ushorts[1] = color;
+ ushorts[2] = SIDES*4;
+ j = 3;
+
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[3+i*4] = (lcuint16)(verts + SIDES + i);
+ if (i == SIDES-1)
+ {
+ ushorts[4+i*4] = (lcuint16)verts + SIDES;
+ ushorts[5+i*4] = (lcuint16)verts;
+ }
+ else
+ {
+ ushorts[4+i*4] = (lcuint16)verts + SIDES + i + 1;
+ ushorts[5+i*4] = (lcuint16)verts + i + 1;
+ }
+ ushorts[6+i*4] = (lcuint16)verts + i;
+ }
+ j += 4*SIDES;
+ ushorts[j] = SIDES*3;
+ j++;
- if (*bytes == LC_STUD2)
- {
- verts += 4*SIDES;
- tris += 18*SIDES;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- }
+ for (i = 0; i < SIDES; i++)
+ {
+ if (i == SIDES-1)
+ ushorts[j+i*3] = (lcuint16)verts + SIDES;
+ else
+ ushorts[j+i*3] = (lcuint16)verts + SIDES + i + 1;
+ ushorts[1+j+i*3] = (lcuint16)verts + SIDES + i;
+ ushorts[2+j+i*3] = (lcuint16)verts + 2*SIDES;
+ }
- if (*bytes == LC_STUD3)
- {
- verts += (2*SIDES)+1;
- tris += 9*SIDES;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- }
+ j += 3*SIDES;
+ ushorts[j] = 0; j++; // lines
+ ushorts[j] = LC_COL_EDGES; j++; // color
+ ushorts[j] = 0; j++; // quads
+ ushorts[j] = 0; j++; // tris
+ ushorts[j] = 4*SIDES; j++;
- if (*bytes == LC_STUD4)
- {
- verts += 4*SIDES;
- tris += 18*SIDES;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- }
- }
- bytes++; // should be 0
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)verts + i;
+ if (i == SIDES-1)
+ ushorts[1+j+i*4] = (lcuint16)verts;
+ else
+ ushorts[1+j+i*4] = (lcuint16)verts + i + 1;
+
+ ushorts[2+j+i*4] = ushorts[j+i*4] + SIDES;
+ ushorts[3+j+i*4] = ushorts[1+j+i*4] + SIDES;
}
+ }
- m_fVertexArray = (float*)malloc(3*sizeof(float)*verts);
- m_nVertexCount = verts;
+ verts += 2*SIDES+1;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ } break;
- if (m_nVertexCount > 65535 || tris > 65535)
- m_nFlags |= LC_PIECE_LONGDATA;
- else
- m_nFlags &= ~LC_PIECE_LONGDATA;
+ case LC_STUD4:
+ {
+ int size;
+ Matrix mat;
+
+ for (i = 0; i < 12; i++)
+ ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
+ mat.FromPacked ((float*)(bytes+2));
+ lcuint16 color = ConvertColor(*(bytes+1));
+
+ // Create the vertexes
+ for (i = 0; i < SIDES; i++)
+ {
+ // outside
+ m_fVertexArray[(verts+i+SIDES)*3] =
+ m_fVertexArray[(verts+i)*3] =
+ LC_KNOB_RADIUS * costbl[i];
+ m_fVertexArray[(verts+i+SIDES)*3+1] =
+ m_fVertexArray[(verts+i)*3+1] =
+ LC_KNOB_RADIUS * sintbl[i];
+ m_fVertexArray[(verts+i)*3+2] = LC_STUD_HEIGHT;
+ m_fVertexArray[(verts+i+SIDES)*3+2] = 0;
+
+ // inside
+ m_fVertexArray[(verts+i+2*SIDES)*3] =
+ m_fVertexArray[(verts+i+3*SIDES)*3] =
+ LC_STUD_RADIUS * costbl[i];
+ m_fVertexArray[(verts+i+2*SIDES)*3+1] =
+ m_fVertexArray[(verts+i+3*SIDES)*3+1] =
+ LC_STUD_RADIUS * sintbl[i];
+ m_fVertexArray[(verts+i+3*SIDES)*3+2] = LC_STUD_HEIGHT;
+ m_fVertexArray[(verts+i+2*SIDES)*3+2] = 0;
+ }
+
+ mat.TransformPoints(&m_fVertexArray[verts*3], 4*SIDES);
+ // colors + 2*num_prim + sides*prims
+ size = 9+SIDES*20;
+
+ if (m_nFlags & LC_PIECE_LONGDATA)
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint32)*size);
+ longs = (lcuint32*)pGroup->drawinfo;
+
+ longs[0] = 2; // colors
+ longs[1] = color;
+ longs[2] = SIDES*12;
+ j = 3;
+
+ // outside
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)(verts + i);
+ if (i == SIDES-1)
+ {
+ longs[j+1+i*4] = (lcuint32)verts;
+ longs[j+2+i*4] = (lcuint32)verts + SIDES;
+ }
+ else
+ {
+ longs[j+1+i*4] = (lcuint32)verts + i + 1;
+ longs[j+2+i*4] = (lcuint32)verts + SIDES + i + 1;
+ }
+ longs[j+3+i*4] = (lcuint32)verts + SIDES + i;
+ }
+ j += 4*SIDES;
- // Copy the 'fixed' vertexes
- shorts = (lcint16*)(longs + 1);
- for (verts = 0; verts < LCUINT32(*longs); verts++)
+ // inside
+ for (i = 0; i < SIDES; i++)
{
- m_fVertexArray[verts*3] = (float)LCINT16(*shorts)*scale;
- shorts++;
- m_fVertexArray[verts*3+1] = (float)LCINT16(*shorts)*scale;
- shorts++;
- m_fVertexArray[verts*3+2] = (float)LCINT16(*shorts)*scale;
- shorts++;
+ longs[j+i*4] = (lcuint32)(verts + 3*SIDES + i);
+ if (i == SIDES-1)
+ {
+ longs[j+1+i*4] = (lcuint32)verts + 3*SIDES;
+ longs[j+2+i*4] = (lcuint32)verts + 2*SIDES;
+ }
+ else
+ {
+ longs[j+1+i*4] = (lcuint32)verts + 3*SIDES + i + 1;
+ longs[j+2+i*4] = (lcuint32)verts + 2*SIDES + i + 1;
+ }
+ longs[j+3+i*4] = (lcuint32)verts + 2*SIDES + i;
}
+ j += 4*SIDES;
- // Read groups
- bytes = tmp;
- sh = m_nGroupCount;
- for (pGroup = m_pGroups; sh--; pGroup++)
+ // ring
+ for (i = 0; i < SIDES; i++)
{
- bt = *bytes;
- bytes++;
+ longs[j+i*4] = (lcuint32)(verts + 3*SIDES + i);
+ if (i == SIDES-1)
+ {
+ longs[j+1+i*4] = (lcuint32)verts + 3*SIDES;
+ longs[j+2+i*4] = (lcuint32)verts;
+ }
+ else
+ {
+ longs[j+1+i*4] = (lcuint32)verts + 3*SIDES + i + 1;
+ longs[j+2+i*4] = (lcuint32)verts + i + 1;
+ }
+ longs[j+3+i*4] = (lcuint32)verts + i;
+ }
+ j += 4*SIDES;
- pGroup->connections[bt] = 0xFFFF;
- while(bt--)
- {
- lcuint16 tmp = LCUINT16(*((lcuint16*)bytes));
- pGroup->connections[bt] = tmp;
- bytes += sizeof(lcuint16);
- }
+ longs[j] = 0; j++; // tris
+ longs[j] = 0; j++; // lines
+ longs[j] = LC_COL_EDGES; j++; // color
+ longs[j] = 0; j++; // quads
+ longs[j] = 0; j++; // tris
+ longs[j] = 8*SIDES; j++;
- switch (*bytes)
- {
- case LC_MESH:
- {
- bytes++;
+ // outside
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)verts + i;
+ if (i == SIDES-1)
+ longs[1+j+i*4] = (lcuint32)verts;
+ else
+ longs[1+j+i*4] = (lcuint32)verts + i + 1;
+
+ longs[2+j+i*4] = longs[j+i*4] + SIDES;
+ longs[3+j+i*4] = longs[1+j+i*4] + SIDES;
+ }
+ j += 4*SIDES;
- if (m_nFlags & LC_PIECE_LONGDATA_FILE)
- {
- if (m_nFlags & LC_PIECE_LONGDATA)
- WriteMeshDrawInfo<lcuint32, lcuint32>(bytes, pGroup);
- else
- WriteMeshDrawInfo<lcuint32, lcuint16>(bytes, pGroup);
- }
- else
- {
- if (m_nFlags & LC_PIECE_LONGDATA)
- WriteMeshDrawInfo<lcuint16, lcuint32>(bytes, pGroup);
- else
- WriteMeshDrawInfo<lcuint16, lcuint16>(bytes, pGroup);
- }
- } break;
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ longs[j+i*4] = (lcuint32)verts + 2*SIDES + i;
+ if (i == SIDES-1)
+ longs[1+j+i*4] = (lcuint32)verts + 2*SIDES;
+ else
+ longs[1+j+i*4] = (lcuint32)verts + 2*SIDES + i + 1;
+
+ longs[2+j+i*4] = longs[j+i*4] + SIDES;
+ longs[3+j+i*4] = longs[1+j+i*4] + SIDES;
+ }
+ }
+ else
+ {
+ pGroup->drawinfo = malloc(sizeof(lcuint16)*size);
+ ushorts = (lcuint16*)pGroup->drawinfo;
+
+ ushorts[0] = 2; // colors
+ ushorts[1] = color;
+ ushorts[2] = SIDES*12;
+ j = 3;
+
+ // outside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)(verts + i);
+ if (i == SIDES-1)
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts;
+ ushorts[j+2+i*4] = (lcuint16)verts + SIDES;
+ }
+ else
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + i + 1;
+ ushorts[j+2+i*4] = (lcuint16)verts + SIDES + i + 1;
+ }
+ ushorts[j+3+i*4] = (lcuint16)verts + SIDES + i;
+ }
+ j += 4*SIDES;
- case LC_STUD:
- {
- Matrix mat;
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)(verts + 2*SIDES + i);
+ if (i == SIDES-1)
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + 2*SIDES;
+ ushorts[j+2+i*4] = (lcuint16)verts + 3*SIDES;
+ }
+ else
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + 2*SIDES + i + 1;
+ ushorts[j+2+i*4] = (lcuint16)verts + 3*SIDES + i + 1;
+ }
+ ushorts[j+3+i*4] = (lcuint16)verts + 3*SIDES + i;
+ }
+ j += 4*SIDES;
- for (i = 0; i < 12; i++)
- ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
- mat.FromPacked ((float*)(bytes+2));
- lcuint16 color = ConvertColor(*(bytes+1));
+ // ring
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)(verts + 3*SIDES + i);
+ if (i == SIDES-1)
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + 3*SIDES;
+ ushorts[j+2+i*4] = (lcuint16)verts;
+ }
+ else
+ {
+ ushorts[j+1+i*4] = (lcuint16)verts + 3*SIDES + i + 1;
+ ushorts[j+2+i*4] = (lcuint16)verts + i + 1;
+ }
+ ushorts[j+3+i*4] = (lcuint16)verts + i;
+ }
+ j += 4*SIDES;
- if (m_nFlags & LC_PIECE_LONGDATA)
- WriteStudDrawInfo<lcuint32>(color, m_fVertexArray+verts*3, verts, pGroup, LC_STUD_RADIUS);
- else
- WriteStudDrawInfo<lcuint16>(color, m_fVertexArray+verts*3, verts, pGroup, LC_STUD_RADIUS);
+ ushorts[j] = 0; j++; // tris
+ ushorts[j] = 0; j++; // lines
+ ushorts[j] = LC_COL_EDGES; j++; // color
+ ushorts[j] = 0; j++; // quads
+ ushorts[j] = 0; j++; // tris
+ ushorts[j] = 8*SIDES; j++;
- mat.TransformPoints(m_fVertexArray+verts*3, 2 * SIDES + 1);
+ // outside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)verts + i;
+ if (i == SIDES-1)
+ ushorts[1+j+i*4] = (lcuint16)verts;
+ else
+ ushorts[1+j+i*4] = (lcuint16)verts + i + 1;
+
+ ushorts[2+j+i*4] = ushorts[j+i*4] + SIDES;
+ ushorts[3+j+i*4] = ushorts[1+j+i*4] + SIDES;
+ }
+ j += 4*SIDES;
- verts += 2*SIDES+1;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- } break;
+ // inside
+ for (i = 0; i < SIDES; i++)
+ {
+ ushorts[j+i*4] = (lcuint16)verts + 2*SIDES + i;
+ if (i == SIDES-1)
+ ushorts[1+j+i*4] = (lcuint16)verts + 2*SIDES;
+ else
+ ushorts[1+j+i*4] = (lcuint16)verts + 2*SIDES + i + 1;
+
+ ushorts[2+j+i*4] = ushorts[j+i*4] + SIDES;
+ ushorts[3+j+i*4] = ushorts[1+j+i*4] + SIDES;
+ }
+ }
- case LC_STUD2:
- {
- Matrix mat;
+ verts += 4*SIDES;
+ bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
+ } break;
+ }
+ bytes++; // should be 0
+ }
- for (i = 0; i < 12; i++)
- ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
- mat.FromPacked ((float*)(bytes+2));
- lcuint16 color = ConvertColor(*(bytes+1));
+ free(buf);
+
+/*
+ // Now create the information for the CD
+ // If the object is big this can block the program for serveral seconds.
+ // ATTENTION: The RAPID CD library is based on triangles.
- if (m_nFlags & LC_PIECE_LONGDATA)
- WriteHollowStudDrawInfo<lcuint32>(color, m_fVertexArray+verts*3, verts, pGroup, 0.16f, LC_STUD_RADIUS);
- else
- WriteHollowStudDrawInfo<lcuint16>(color, m_fVertexArray+verts*3, verts, pGroup, 0.16f, LC_STUD_RADIUS);
+ if (pInfo->pRModel)
+ delete pInfo->pRModel;
- mat.TransformPoints(m_fVertexArray+verts*3, 4 * SIDES);
+ pInfo->pRModel = new CRModel();
+ pInfo->pRModel->BeginModel();
- verts += 4*SIDES;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- } break;
+ UINT col, loc, j, i;
+ int vert = 0;
- case LC_STUD3:
+ for (UINT c = 0; c < pInfo->cons; c++)
+ {
+ if (pInfo->connection[c].info == NULL)
+ continue;
+ if (pInfo->count > 65535)
+ {
+ UINT* info = (UINT*)pInfo->connection[c].info;
+ loc = 1;
+ col = info[0];
+ while (col)
{
- Matrix mat;
-
- for (i = 0; i < 12; i++)
- ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
- mat.FromPacked ((float*)(bytes+2));
- lcuint16 color = ConvertColor(*(bytes+1));
+ loc++;
- if (m_nFlags & LC_PIECE_LONGDATA)
- WriteStudDrawInfo<lcuint32>(color, m_fVertexArray+verts*3, verts, pGroup, LC_STUD_RADIUS);
- else
- WriteStudDrawInfo<lcuint16>(color, m_fVertexArray+verts*3, verts, pGroup, LC_STUD_RADIUS);
-
- mat.TransformPoints(m_fVertexArray+verts*3, 2 * SIDES + 1);
-
- verts += 2*SIDES+1;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- } break;
+ j = info[loc];
+ for (i = 0; i < j; i+=4)
+ {
+ pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
+ &pInfo->vertex[info[loc+i+3]*3], vert);
+ vert++;
+ pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+3]*3], &pInfo->vertex[info[loc+i+4]*3],
+ &pInfo->vertex[info[loc+i+1]*3], vert);
+ vert++;
+ }
+ loc += j+1;
+ j = info[loc];
+ for (i = 0; i < j; i+=3)
+ {
+ pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
+ &pInfo->vertex[info[loc+i+3]*3], vert);
+ vert++;
+ }
+ loc += j+1;
+ loc += info[loc]+1;
- case LC_STUD4:
+ col--;
+ }
+ }
+ else
+ {
+ WORD* info = (WORD*)pInfo->connection[c].info;
+ loc = 1;
+ col = info[0];
+ while (col)
{
- Matrix mat;
-
- for (i = 0; i < 12; i++)
- ((float*)(bytes+2))[i] = LCFLOAT (((float*)(bytes+2))[i]);
- mat.FromPacked ((float*)(bytes+2));
- lcuint16 color = ConvertColor(*(bytes+1));
-
- if (m_nFlags & LC_PIECE_LONGDATA)
- WriteHollowStudDrawInfo<lcuint32>(color, m_fVertexArray+verts*3, verts, pGroup, 0.16f, LC_STUD_RADIUS);
- else
- WriteHollowStudDrawInfo<lcuint16>(color, m_fVertexArray+verts*3, verts, pGroup, 0.16f, LC_STUD_RADIUS);
-
- mat.TransformPoints(m_fVertexArray+verts*3, 4 * SIDES);
-
- verts += 4*SIDES;
- bytes += 2*sizeof(unsigned char) + 12*sizeof(float);
- } break;
+ loc++;
+
+ j = info[loc];
+ for (i = 0; i < j; i+=4)
+ {
+ pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
+ &pInfo->vertex[info[loc+i+3]*3], vert);
+ vert++;
+ pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+3]*3], &pInfo->vertex[info[loc+i+4]*3],
+ &pInfo->vertex[info[loc+i+1]*3], vert);
+ vert++;
+ }
+ loc += j+1;
+ j = info[loc];
+ for (i = 0; i < j; i+=3)
+ {
+ pInfo->pRModel->AddTri(&pInfo->vertex[info[loc+i+1]*3], &pInfo->vertex[info[loc+i+2]*3],
+ &pInfo->vertex[info[loc+i+3]*3], vert);
+ vert++;
+ }
+ loc += j+1;
+ loc += info[loc]+1;
+
+ col--;
+ }
}
- bytes++; // should be 0
}
-
- free(buf);
+ pInfo->pRModel->EndModel();
+*/
}
void PieceInfo::FreeInformation()
{
+ if (m_nBoxList != 0)
+ glDeleteLists(m_nBoxList, 1);
+ m_nBoxList = 0;
+
if (m_fVertexArray != NULL)
{
free(m_fVertexArray);
@@ -944,6 +1540,11 @@ void PieceInfo::FreeInformation()
free(m_pTextures);
m_pTextures = NULL;
}
+
+ if (m_nFlags & LC_PIECE_LONGDATA_RUNTIME)
+ {
+ m_nFlags &= ~(LC_PIECE_LONGDATA | LC_PIECE_LONGDATA_RUNTIME);
+ }
}
// Zoom extents for the preview window and print catalog
@@ -1028,11 +1629,10 @@ void PieceInfo::ZoomExtents(float Fov, float Aspect, float* EyePos) const
{ m_fDimensions[3], m_fDimensions[1], m_fDimensions[2] } };
float SmallestU = 10000.0f;
- float* PlaneArray[4] = { TopPlane, BottomPlane, LeftPlane, RightPlane };
for (int i = 0; i < 4; i++)
{
- float* Plane = PlaneArray[i];
+ float* Plane;
switch (i)
{
@@ -1113,7 +1713,7 @@ void PieceInfo::RenderPiece(int nColor)
m_pTextures[sh].texture->MakeCurrent();
if (m_pTextures[sh].color == LC_COL_DEFAULT)
- glColor4ub(FlatColorArray[nColor][0], FlatColorArray[nColor][1], FlatColorArray[nColor][2], 255);
+ glColor3ubv(FlatColorArray[nColor]);
if (nColor > 13 && nColor < 22)
{
glEnable (GL_BLEND);
@@ -1126,14 +1726,16 @@ void PieceInfo::RenderPiece(int nColor)
}
glEnable(GL_TEXTURE_2D);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, m_pTextures[sh].vertex);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, m_pTextures[sh].coords);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glBegin(GL_QUADS);
+ glTexCoord2fv(m_pTextures[sh].coords[0]);
+ glVertex3fv(m_pTextures[sh].vertex[0]);
+ glTexCoord2fv(m_pTextures[sh].coords[1]);
+ glVertex3fv(m_pTextures[sh].vertex[1]);
+ glTexCoord2fv(m_pTextures[sh].coords[2]);
+ glVertex3fv(m_pTextures[sh].vertex[2]);
+ glTexCoord2fv(m_pTextures[sh].coords[3]);
+ glVertex3fv(m_pTextures[sh].vertex[3]);
+ glEnd();
glDisable(GL_TEXTURE_2D);
}
@@ -1145,7 +1747,6 @@ void PieceInfo::RenderPiece(int nColor)
{
if (m_nFlags & LC_PIECE_LONGDATA)
{
-#ifndef LC_OPENGLES
unsigned long* info, colors;
info = (unsigned long*)pGroup->drawinfo;
@@ -1162,26 +1763,28 @@ void PieceInfo::RenderPiece(int nColor)
if (curcolor > 13 && curcolor < 22)
{
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glDepthMask(GL_FALSE);
- glColor4ub(ColorArray[curcolor][0], ColorArray[curcolor][1], ColorArray[curcolor][2], ColorArray[curcolor][3]);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+ glDepthMask (GL_FALSE);
+ glColor4ubv (ColorArray[curcolor]);
}
else
{
- glDepthMask(GL_TRUE);
- glDisable(GL_BLEND);
- glColor4ub(FlatColorArray[curcolor][0], FlatColorArray[curcolor][1], FlatColorArray[curcolor][2], 255);
+ glDepthMask (GL_TRUE);
+ glDisable (GL_BLEND);
+ glColor3ubv (FlatColorArray[curcolor]);
}
if (*info)
+ glDrawElements(GL_QUADS, *info, GL_UNSIGNED_INT, info+1);
+ info += *info + 1;
+ if (*info)
glDrawElements(GL_TRIANGLES, *info, GL_UNSIGNED_INT, info+1);
info += *info + 1;
if (*info)
glDrawElements(GL_LINES, *info, GL_UNSIGNED_INT, info+1);
info += *info + 1;
}
-#endif
}
else
{
@@ -1201,19 +1804,22 @@ void PieceInfo::RenderPiece(int nColor)
if (curcolor > 13 && curcolor < 22)
{
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glDepthMask(GL_FALSE);
- glColor4ub(ColorArray[curcolor][0], ColorArray[curcolor][1], ColorArray[curcolor][2], ColorArray[curcolor][3]);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable (GL_BLEND);
+ glDepthMask (GL_FALSE);
+ glColor4ubv (ColorArray[curcolor]);
}
else
{
- glDepthMask(GL_TRUE);
- glDisable(GL_BLEND);
- glColor4ub(FlatColorArray[curcolor][0], FlatColorArray[curcolor][1], FlatColorArray[curcolor][2], 255);
+ glDepthMask (GL_TRUE);
+ glDisable (GL_BLEND);
+ glColor3ubv(FlatColorArray[curcolor]);
}
if (*info)
+ glDrawElements(GL_QUADS, *info, GL_UNSIGNED_SHORT, info+1);
+ info += *info + 1;
+ if (*info)
glDrawElements(GL_TRIANGLES, *info, GL_UNSIGNED_SHORT, info+1);
info += *info + 1;
if (*info)
diff --git a/common/pieceinf.h b/common/pieceinf.h
index 17bef2f..56892c8 100644
--- a/common/pieceinf.h
+++ b/common/pieceinf.h
@@ -11,12 +11,12 @@
#endif
#include "algebra.h"
-#define LC_PIECE_COUNT 0x01 // Count this piece in the totals ?
-#define LC_PIECE_LONGDATA_FILE 0x02 // unsigned long/short index
-#define LC_PIECE_CCW 0x04 // Use back-face culling
-#define LC_PIECE_SMALL 0x10 // scale = 10000
-#define LC_PIECE_MEDIUM 0x20 // scale = 1000 (otherwise = 100)
-#define LC_PIECE_LONGDATA 0x40 // If the original data is 16 bits but we expanded to 32 bits
+#define LC_PIECE_COUNT 0x01 // Count this piece in the totals ?
+#define LC_PIECE_LONGDATA 0x02 // unsigned long/short index
+#define LC_PIECE_CCW 0x04 // Use back-face culling
+#define LC_PIECE_SMALL 0x10 // scale = 10000
+#define LC_PIECE_MEDIUM 0x20 // scale = 1000 (otherwise = 100)
+#define LC_PIECE_LONGDATA_RUNTIME 0x40 // If the original data is 16 bits but we expanded to 32 bits
class File;
class Texture;
@@ -84,10 +84,15 @@ class PieceInfo
void ZoomExtents(float Fov, float Aspect, float* EyePos = NULL) const;
void RenderOnce(int nColor);
void RenderPiece(int nColor);
- void RenderBox();
void WriteWavefront(FILE* file, unsigned char color, unsigned long* start);
// Implementation
+ GLuint GetBoxDisplayList()
+ {
+ if (!m_nBoxList)
+ CreateBoxDisplayList();
+ return m_nBoxList;
+ };
void LoadIndex(File& file);
void AddRef();
void DeRef();
@@ -113,9 +118,11 @@ public:
protected:
int m_nRef;
+ GLuint m_nBoxList;
void LoadInformation();
void FreeInformation();
+ void CreateBoxDisplayList();
};
#endif // _PIECEINF_H_
diff --git a/common/preview.cpp b/common/preview.cpp
index 4c8de96..fb8f67c 100644
--- a/common/preview.cpp
+++ b/common/preview.cpp
@@ -39,6 +39,7 @@ void PiecePreview::OnDraw()
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0.5f, 0.1f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_DITHER);
glShadeModel(GL_FLAT);
diff --git a/common/project.cpp b/common/project.cpp
index 5722c79..802c1bc 100644
--- a/common/project.cpp
+++ b/common/project.cpp
@@ -96,6 +96,7 @@ Project::Project()
m_pGroups = NULL;
m_pUndoList = NULL;
m_pRedoList = NULL;
+ m_nGridList = 0;
m_pTrackFile = NULL;
m_nCurClipboard = 0;
m_nCurAction = 0;
@@ -110,7 +111,7 @@ Project::Project()
messenger->AddRef();
messenger->Listen(&ProjectListener, this);
- for (i = 0; i < LC_CONNECTIONS; i++)
+ for (i = 0; i < LC_CONNECTIONS; i++)
{
m_pConnections[i].entries = NULL;
m_pConnections[i].numentries = 0;
@@ -120,8 +121,6 @@ Project::Project()
m_pClipboard[i] = NULL;
m_pScreenFont = new TexFont();
-
- VRMLScale = 0.01f; // centimeter to meter
}
Project::~Project()
@@ -397,22 +396,22 @@ void Project::LoadDefaults(bool cameras)
bool Project::FileLoad(File* file, bool bUndo, bool bMerge)
{
int i, count;
- char fid[32];
+ char id[32];
unsigned long rgb;
float fv = 0.4f;
unsigned char ch, action = m_nCurAction;
unsigned short sh;
file->Seek(0, SEEK_SET);
- file->Read(fid, 32);
- sscanf(&fid[7], "%f", &fv);
+ file->Read(id, 32);
+ sscanf(&id[7], "%f", &fv);
// Fix the ugly floating point reading on computers with different decimal points.
if (fv == 0.0f)
{
lconv *loc = localeconv();
- fid[8] = loc->decimal_point[0];
- sscanf(&fid[7], "%f", &fv);
+ id[8] = loc->decimal_point[0];
+ sscanf(&id[7], "%f", &fv);
if (fv == 0.0f)
return false;
@@ -1239,7 +1238,8 @@ bool Project::DoSave(char* lpszPathName, bool bReplace)
else
ptr++;
- sprintf(buf, "0 Model exported from LeoCAD\r\n0 Original name: %s\r\n", ptr);
+ sprintf(buf, "0 Model exported from LeoCAD\r\n"
+ "0 Original name: %s\r\n", ptr);
if (strlen(m_strAuthor) != 0)
{
strcat(buf, "0 Author: ");
@@ -1249,8 +1249,6 @@ bool Project::DoSave(char* lpszPathName, bool bReplace)
strcat(buf, "\r\n");
file.Write(buf, strlen(buf));
- const char* OldLocale = setlocale(LC_NUMERIC, "C");
-
for (i = 1; i <= steps; i++)
{
for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
@@ -1271,9 +1269,6 @@ bool Project::DoSave(char* lpszPathName, bool bReplace)
if (i != steps)
file.Write("0 STEP\r\n", 8);
}
-
- setlocale(LC_NUMERIC, OldLocale);
-
file.Write("0\r\n", 3);
}
else
@@ -1402,8 +1397,7 @@ bool Project::OnOpenDocument (const char* lpszPathName)
return false;
}
- char ext[4];
- const char *ptr;
+ char ext[4], *ptr;
memset(ext, 0, 4);
ptr = strrchr(lpszPathName, '.');
if (ptr != NULL)
@@ -1855,42 +1849,30 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
switch (i)
{
case 0:
- glColor4f(0.8f, 0.0f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.0f, 0.0f);
break;
case 1:
- glColor4f(0.0f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.0f, 0.8f, 0.0f);
break;
case 2:
- glColor4f(0.0f, 0.0f, 0.8f, 1.0f);
+ glColor3f(0.0f, 0.0f, 0.8f);
break;
}
- float Verts[11][3];
-
- Verts[0][0] = 0.0f;
- Verts[0][1] = 0.0f;
- Verts[0][2] = 0.0f;
-
- Verts[1][0] = pts[i][0];
- Verts[1][1] = pts[i][1];
- Verts[1][2] = pts[i][2];
+ glBegin(GL_LINES);
+ glVertex3f(pts[i][0], pts[i][1], pts[i][2]);
+ glVertex3f(0, 0, 0);
+ glEnd();
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex3f(pts[i][0], pts[i][1], pts[i][2]);
for (int j = 0; j < 9; j++)
{
float pt[3] = { 12.0f, cosf(LC_2PI * j / 8) * 3.0f, sinf(LC_2PI * j / 8) * 3.0f };
Mats[i].TransformPoints(pt, 1);
- Verts[j+2][0] = pt[0];
- Verts[j+2][1] = pt[1];
- Verts[j+2][2] = pt[2];
+ glVertex3f(pt[0], pt[1], pt[2]);
}
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
-
- glDrawArrays(GL_LINES, 0, 2);
- glDrawArrays(GL_TRIANGLE_FAN, 1, 10);
-
- glDisableClientState(GL_VERTEX_ARRAY);
+ glEnd();
}
// Draw the text.
@@ -1899,10 +1881,12 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
- glColor4f(0, 0, 0, 1);
+ glBegin(GL_QUADS);
+ glColor3f(0, 0, 0);
m_pScreenFont->PrintText(pts[0][0], pts[0][1], 40.0f, "X");
m_pScreenFont->PrintText(pts[1][0], pts[1][1], 40.0f, "Y");
m_pScreenFont->PrintText(pts[2][0], pts[2][1], 40.0f, "Z");
+ glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
@@ -1912,10 +1896,10 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
if ((m_nSnap & LC_DRAW_AXIS) || (m_nSnap & LC_DRAW_GRID))
{
- glColor4f(1.0f - m_fBackground[0], 1.0f - m_fBackground[1], 1.0f - m_fBackground[2], 1.0f);
+ glColor3f(1.0f - m_fBackground[0], 1.0f - m_fBackground[1], 1.0f - m_fBackground[2]);
if (m_nSnap & LC_DRAW_GRID)
- DrawGrid();
+ glCallList (m_nGridList);
if ((bShaded) && (m_nDetail & LC_DET_LIGHTING))
glEnable(GL_LIGHTING);
@@ -1932,6 +1916,21 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
// glDisable (GL_COLOR_MATERIAL);
/*
+ {
+ for (int i = -100; i < 100; i+=5)
+ {
+ glBegin (GL_QUAD_STRIP);
+ glNormal3f (0,0,1);
+ for (int j = -100; j < 100; j+=5)
+ {
+ glVertex3f ((float)i/10, (float)j/10,0);
+ glVertex3f ((float)(i+5)/10, (float)j/10,0);
+ }
+ glEnd();
+ }
+ }
+ */
+ /*
{
LC_RENDER_INFO info;
info.lighting = (m_nDetail & LC_DET_LIGHTING) != 0;
@@ -2099,7 +2098,6 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
// glEnable (GL_CULL_FACE);
// glShadeModel (GL_FLAT);
// glDisable (GL_LIGHTING);
-#ifndef LC_OPENGLES
if ((m_nDetail & LC_DET_BOX_FILL) == 0)
{
if ((m_nDetail & LC_DET_HIDDEN_LINE) != 0)
@@ -2121,7 +2119,6 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
}
}
else
-#endif
RenderBoxes(true);
}
@@ -2195,28 +2192,27 @@ void Project::RenderScene(bool bShaded, bool bDrawViewports)
glTranslatef(0.375, 0.375, 0.0);
glDisable(GL_DEPTH_TEST);
- glEnableLineStipple();
- glColor4f(0, 0, 0, 1);
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple(5, 0x5555);
+ glColor3f(0, 0, 0);
float pt1x = (float)(m_nDownX - x);
float pt1y = (float)(m_nDownY - y);
float pt2x = m_fTrack[0] - x;
float pt2y = m_fTrack[1] - y;
- float verts[8][2] =
- {
- { pt1x, pt1y }, { pt2x, pt1y },
- { pt2x, pt1y }, { pt2x, pt2y },
- { pt2x, pt2y }, { pt1x, pt2y },
- { pt1x, pt2y }, { pt1x, pt1y }
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, verts);
- glDrawArrays(GL_LINES, 0, 8);
- glDisableClientState(GL_VERTEX_ARRAY);
-
- glDisableLineStipple();
+ glBegin(GL_LINES);
+ glVertex2f(pt1x, pt1y);
+ glVertex2f(pt2x, pt1y);
+ glVertex2f(pt2x, pt1y);
+ glVertex2f(pt2x, pt2y);
+ glVertex2f(pt2x, pt2y);
+ glVertex2f(pt1x, pt2y);
+ glVertex2f(pt1x, pt2y);
+ glVertex2f(pt1x, pt1y);
+ glEnd();
+
+ glDisable(GL_LINE_STIPPLE);
glEnable(GL_DEPTH_TEST);
}
@@ -2269,21 +2265,13 @@ void Project::RenderOverlays(int Viewport)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
glColor4f(0.8f, 0.8f, 0.0f, 0.3f);
-
- float verts[4][3] =
- {
- { 0.0f, 0.0f, 0.0f },
- { 0.0f, OverlayScale * OverlayMovePlaneSize, 0.0f },
- { 0.0f, OverlayScale * OverlayMovePlaneSize, OverlayScale * OverlayMovePlaneSize },
- { 0.0f, 0.0f, OverlayScale * OverlayMovePlaneSize }
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, verts);
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- glDisableClientState(GL_VERTEX_ARRAY);
-
+ glVertex3f(0.0f, 0.0f, 0.0f);
+ glVertex3f(0.0f, OverlayScale * OverlayMovePlaneSize, 0.0f);
+ glVertex3f(0.0f, OverlayScale * OverlayMovePlaneSize, OverlayScale * OverlayMovePlaneSize);
+ glVertex3f(0.0f, 0.0f, OverlayScale * OverlayMovePlaneSize);
+ glEnd();
glDisable(GL_BLEND);
@@ -2297,21 +2285,21 @@ void Project::RenderOverlays(int Viewport)
{
case 0:
if ((m_OverlayMode == LC_OVERLAY_X) || (m_OverlayMode == LC_OVERLAY_XY) || (m_OverlayMode == LC_OVERLAY_XZ))
- glColor4f(0.8f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.8f, 0.0f);
else
- glColor4f(0.8f, 0.0f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.0f, 0.0f);
break;
case 1:
if ((m_OverlayMode == LC_OVERLAY_Y) || (m_OverlayMode == LC_OVERLAY_XY) || (m_OverlayMode == LC_OVERLAY_YZ))
- glColor4f(0.8f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.8f, 0.0f);
else
- glColor4f(0.0f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.0f, 0.8f, 0.0f);
break;
case 2:
if ((m_OverlayMode == LC_OVERLAY_Z) || (m_OverlayMode == LC_OVERLAY_XZ) || (m_OverlayMode == LC_OVERLAY_YZ))
- glColor4f(0.8f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.8f, 0.0f);
else
- glColor4f(0.0f, 0.0f, 0.8f, 1.0f);
+ glColor3f(0.0f, 0.0f, 0.8f);
break;
}
@@ -2326,28 +2314,20 @@ void Project::RenderOverlays(int Viewport)
else if (i == 2)
glRotatef(90.0f, 0.0f, -1.0f, 0.0f);
- float Verts[11][3];
-
- Verts[0][0] = 0.0f;
- Verts[0][1] = 0.0f;
- Verts[0][2] = 0.0f;
-
- Verts[1][0] = OverlayScale * OverlayMoveArrowSize;
- Verts[1][1] = 0.0f;
- Verts[1][2] = 0.0f;
+ glBegin(GL_LINES);
+ glVertex3f(0.0f, 0.0f, 0.0f);
+ glVertex3f(OverlayScale * OverlayMoveArrowSize, 0.0f, 0.0f);
+ glEnd();
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex3f(OverlayScale * OverlayMoveArrowSize, 0.0f, 0.0f);
for (int j = 0; j < 9; j++)
{
- Verts[j+2][0] = OverlayScale * OverlayMoveArrowCapSize;
- Verts[j+2][1] = cosf(LC_2PI * j / 8) * OverlayMoveArrowCapRadius * OverlayScale;
- Verts[j+2][2] = sinf(LC_2PI * j / 8) * OverlayMoveArrowCapRadius * OverlayScale;
+ float y = cosf(LC_2PI * j / 8) * OverlayMoveArrowCapRadius * OverlayScale;
+ float z = sinf(LC_2PI * j / 8) * OverlayMoveArrowCapRadius * OverlayScale;
+ glVertex3f(OverlayScale * OverlayMoveArrowCapSize, y, z);
}
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINES, 0, 2);
- glDrawArrays(GL_TRIANGLE_FAN, 1, 10);
- glDisableClientState(GL_VERTEX_ARRAY);
+ glEnd();
glPopMatrix();
}
@@ -2429,16 +2409,9 @@ void Project::RenderOverlays(int Viewport)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- float Verts[33][3];
- int v = 0;
+ glBegin(GL_TRIANGLE_FAN);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
-
- Verts[0][0] = 0.0f;
- Verts[0][1] = 0.0f;
- Verts[0][2] = 0.0f;
- v++;
+ glVertex3f(0.0f, 0.0f, 0.0f);
float StartAngle;
int i = 0;
@@ -2453,19 +2426,7 @@ void Project::RenderOverlays(int Viewport)
float x = cosf((Step * i - StartAngle) * DTOR) * OverlayRotateRadius * OverlayScale;
float y = sinf((Step * i - StartAngle) * DTOR) * OverlayRotateRadius * OverlayScale;
- Verts[v][0] = 0.0f;
- Verts[v][1] = x;
- Verts[v][2] = y;
- v++;
-
- if (v == 33)
- {
- glDrawArrays(GL_TRIANGLE_FAN, 0, v);
- Verts[1][0] = Verts[32][0];
- Verts[1][1] = Verts[32][1];
- Verts[1][2] = Verts[32][2];
- v = 2;
- }
+ glVertex3f(0.0f, x, y);
i++;
if (Step > 0)
@@ -2475,10 +2436,8 @@ void Project::RenderOverlays(int Viewport)
} while (Angle >= 0.0f);
- if (v > 2)
- glDrawArrays(GL_TRIANGLE_FAN, 0, v);
+ glEnd();
- glDisableClientState(GL_VERTEX_ARRAY);
glDisable(GL_BLEND);
glPopMatrix();
@@ -2490,7 +2449,8 @@ void Project::RenderOverlays(int Viewport)
Mat.SetTranslation(m_OverlayCenter);
// Draw the circles.
- float Verts[32][3];
+ glBegin(GL_LINE_LOOP);
+ glColor3f(0.1f, 0.1f, 0.1f);
for (j = 0; j < 32; j++)
{
@@ -2502,17 +2462,10 @@ void Project::RenderOverlays(int Viewport)
Pt = Mul31(Pt, Mat);
- Verts[j][0] = Pt[0];
- Verts[j][1] = Pt[1];
- Verts[j][2] = Pt[2];
+ glVertex3f(Pt[0], Pt[1], Pt[2]);
}
- glColor4f(0.1f, 0.1f, 0.1f, 1.0f);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINE_LOOP, 0, 32);
- glDisableClientState(GL_VERTEX_ARRAY);
+ glEnd();
Vector3 ViewDir = Cam->GetTargetPosition() - Cam->GetEyePosition();
ViewDir.Normalize();
@@ -2536,26 +2489,25 @@ void Project::RenderOverlays(int Viewport)
{
if (m_OverlayMode == LC_OVERLAY_X + i)
{
- glColor4f(0.8f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.8f, 0.0f);
}
else
{
switch (i)
{
case 0:
- glColor4f(0.8f, 0.0f, 0.0f, 1.0f);
+ glColor3f(0.8f, 0.0f, 0.0f);
break;
case 1:
- glColor4f(0.0f, 0.8f, 0.0f, 1.0f);
+ glColor3f(0.0f, 0.8f, 0.0f);
break;
case 2:
- glColor4f(0.0f, 0.0f, 0.8f, 1.0f);
+ glColor3f(0.0f, 0.0f, 0.8f);
break;
}
}
- float Verts[64][3];
- int v = 0;
+ glBegin(GL_LINES);
for (int j = 0; j < 32; j++)
{
@@ -2584,21 +2536,12 @@ void Project::RenderOverlays(int Viewport)
Vector3 Pt1 = v1 * OverlayRotateRadius * OverlayScale;
Vector3 Pt2 = v2 * OverlayRotateRadius * OverlayScale;
- Verts[v][0] = Pt1[0];
- Verts[v][1] = Pt1[1];
- Verts[v][2] = Pt1[2];
- v++;
- Verts[v][0] = Pt2[0];
- Verts[v][1] = Pt2[1];
- Verts[v][2] = Pt2[2];
- v++;
+ glVertex3f(Pt1[0], Pt1[1], Pt1[2]);
+ glVertex3f(Pt2[0], Pt2[1], Pt2[2]);
}
}
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINES, 0, v);
- glDisableClientState(GL_VERTEX_ARRAY);
+ glEnd();
}
// Draw tangent vector.
@@ -2608,7 +2551,7 @@ void Project::RenderOverlays(int Viewport)
{
Vector3 Tangent, Normal = m_OverlayTrackStart - m_OverlayCenter;
Normal.Normalize();
- float Angle = 0;
+ float Angle;
switch (m_OverlayMode)
{
@@ -2643,52 +2586,36 @@ void Project::RenderOverlays(int Viewport)
Vector3 Arrow;
Matrix33 Rot;
- float Verts[6][3];
+ glBegin(GL_LINES);
+ glColor3f(0.8f, 0.8f, 0.0f);
- Verts[0][0] = Pt[0];
- Verts[0][1] = Pt[1];
- Verts[0][2] = Pt[2];
- Verts[1][0] = Tip[0];
- Verts[1][1] = Tip[1];
- Verts[1][2] = Tip[2];
+ glVertex3f(Pt[0], Pt[1], Pt[2]);
+ glVertex3f(Tip[0], Tip[1], Tip[2]);
Rot.CreateFromAxisAngle(Normal, LC_PI * 0.15f);
Arrow = Mul(Tangent, Rot) * OverlayRotateArrowCapSize;
- Verts[2][0] = Tip[0];
- Verts[2][1] = Tip[1];
- Verts[2][2] = Tip[2];
- Verts[3][0] = Tip[0] - Arrow[0];
- Verts[3][1] = Tip[1] - Arrow[1];
- Verts[3][2] = Tip[2] - Arrow[2];
+ glVertex3f(Tip[0], Tip[1], Tip[2]);
+ glVertex3f(Tip[0] - Arrow[0], Tip[1] - Arrow[1], Tip[2] - Arrow[2]);
Rot.CreateFromAxisAngle(Normal, -LC_PI * 0.15f);
Arrow = Mul(Tangent, Rot) * OverlayRotateArrowCapSize;
- Verts[4][0] = Tip[0];
- Verts[4][1] = Tip[1];
- Verts[4][2] = Tip[2];
- Verts[5][0] = Tip[0] - Arrow[0];
- Verts[5][1] = Tip[1] - Arrow[1];
- Verts[5][2] = Tip[2] - Arrow[2];
-
- glColor4f(0.8f, 0.8f, 0.0f, 1.0f);
+ glVertex3f(Tip[0], Tip[1], Tip[2]);
+ glVertex3f(Tip[0] - Arrow[0], Tip[1] - Arrow[1], Tip[2] - Arrow[2]);
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINES, 0, 6);
- glDisableClientState(GL_VERTEX_ARRAY);
+ glEnd();
}
// Draw text.
if (Viewport == m_nActiveViewport)
{
- GLfloat ScreenX, ScreenY, ScreenZ;
- GLfloat ModelMatrix[16], ProjMatrix[16];
+ GLdouble ScreenX, ScreenY, ScreenZ;
+ GLdouble ModelMatrix[16], ProjMatrix[16];
GLint Vp[4];
- glGetFloatv(GL_MODELVIEW_MATRIX, ModelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, ProjMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, ModelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, ProjMatrix);
glGetIntegerv(GL_VIEWPORT, Vp);
gluProject(0, 0, 0, ModelMatrix, ProjMatrix, Vp, &ScreenX, &ScreenY, &ScreenZ);
@@ -2713,8 +2640,10 @@ void Project::RenderOverlays(int Viewport)
int cx, cy;
m_pScreenFont->GetStringDimensions(&cx, &cy, buf);
- glColor4f(0.8f, 0.8f, 0.0f, 1.0f);
+ glBegin(GL_QUADS);
+ glColor3f(0.8f, 0.8f, 0.0f);
m_pScreenFont->PrintText((float)ScreenX - Vp[0] - (cx / 2), (float)ScreenY - Vp[1] + (cy / 2), 0.0f, buf);
+ glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
@@ -2747,10 +2676,10 @@ void Project::RenderOverlays(int Viewport)
glTranslatef(0.375f, 0.375f, 0.0f);
glDisable(GL_DEPTH_TEST);
- glColor4f(0, 0, 0, 1);
+ glColor3f(0, 0, 0);
// Draw circle.
- float verts[32][2];
+ glBegin(GL_LINE_LOOP);
float r = min(w, h) * 0.35f;
float cx = x + w / 2.0f;
@@ -2758,44 +2687,45 @@ void Project::RenderOverlays(int Viewport)
for (int i = 0; i < 32; i++)
{
- verts[i][0] = cosf((float)i / 32.0f * (2.0f * LC_PI)) * r + cx;
- verts[i][1] = sinf((float)i / 32.0f * (2.0f * LC_PI)) * r + cy;
+ float x = cosf((float)i / 32.0f * (2.0f * LC_PI)) * r + cx;
+ float y = sinf((float)i / 32.0f * (2.0f * LC_PI)) * r + cy;
+
+ glVertex2f(x, y);
}
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, verts);
- glDrawArrays(GL_LINE_LOOP, 0, 32);
+ glEnd();
const float OverlayCameraSquareSize = max(8.0f, (w+h)/200);
// Draw squares.
- float Squares[16][3] =
- {
- { cx + OverlayCameraSquareSize, cy + r + OverlayCameraSquareSize },
- { cx - OverlayCameraSquareSize, cy + r + OverlayCameraSquareSize },
- { cx - OverlayCameraSquareSize, cy + r - OverlayCameraSquareSize },
- { cx + OverlayCameraSquareSize, cy + r - OverlayCameraSquareSize },
- { cx + OverlayCameraSquareSize, cy - r + OverlayCameraSquareSize },
- { cx - OverlayCameraSquareSize, cy - r + OverlayCameraSquareSize },
- { cx - OverlayCameraSquareSize, cy - r - OverlayCameraSquareSize },
- { cx + OverlayCameraSquareSize, cy - r - OverlayCameraSquareSize },
- { cx + r + OverlayCameraSquareSize, cy + OverlayCameraSquareSize },
- { cx + r - OverlayCameraSquareSize, cy + OverlayCameraSquareSize },
- { cx + r - OverlayCameraSquareSize, cy - OverlayCameraSquareSize },
- { cx + r + OverlayCameraSquareSize, cy - OverlayCameraSquareSize },
- { cx - r + OverlayCameraSquareSize, cy + OverlayCameraSquareSize },
- { cx - r - OverlayCameraSquareSize, cy + OverlayCameraSquareSize },
- { cx - r - OverlayCameraSquareSize, cy - OverlayCameraSquareSize },
- { cx - r + OverlayCameraSquareSize, cy - OverlayCameraSquareSize }
- };
-
- glVertexPointer(3, GL_FLOAT, 0, Squares);
- glDrawArrays(GL_LINE_LOOP, 0, 4);
- glDrawArrays(GL_LINE_LOOP, 4, 4);
- glDrawArrays(GL_LINE_LOOP, 8, 4);
- glDrawArrays(GL_LINE_LOOP, 12, 4);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(cx + OverlayCameraSquareSize, cy + r + OverlayCameraSquareSize);
+ glVertex2f(cx - OverlayCameraSquareSize, cy + r + OverlayCameraSquareSize);
+ glVertex2f(cx - OverlayCameraSquareSize, cy + r - OverlayCameraSquareSize);
+ glVertex2f(cx + OverlayCameraSquareSize, cy + r - OverlayCameraSquareSize);
+ glEnd();
+
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(cx + OverlayCameraSquareSize, cy - r + OverlayCameraSquareSize);
+ glVertex2f(cx - OverlayCameraSquareSize, cy - r + OverlayCameraSquareSize);
+ glVertex2f(cx - OverlayCameraSquareSize, cy - r - OverlayCameraSquareSize);
+ glVertex2f(cx + OverlayCameraSquareSize, cy - r - OverlayCameraSquareSize);
+ glEnd();
+
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(cx + r + OverlayCameraSquareSize, cy + OverlayCameraSquareSize);
+ glVertex2f(cx + r - OverlayCameraSquareSize, cy + OverlayCameraSquareSize);
+ glVertex2f(cx + r - OverlayCameraSquareSize, cy - OverlayCameraSquareSize);
+ glVertex2f(cx + r + OverlayCameraSquareSize, cy - OverlayCameraSquareSize);
+ glEnd();
+
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(cx - r + OverlayCameraSquareSize, cy + OverlayCameraSquareSize);
+ glVertex2f(cx - r - OverlayCameraSquareSize, cy + OverlayCameraSquareSize);
+ glVertex2f(cx - r - OverlayCameraSquareSize, cy - OverlayCameraSquareSize);
+ glVertex2f(cx - r + OverlayCameraSquareSize, cy - OverlayCameraSquareSize);
+ glEnd();
- glDisableClientState(GL_VERTEX_ARRAY);
glEnable(GL_DEPTH_TEST);
}
else if (m_nCurAction == LC_ACTION_ZOOM_REGION)
@@ -2816,28 +2746,27 @@ void Project::RenderOverlays(int Viewport)
glTranslatef(0.375f, 0.375f, 0.0f);
glDisable(GL_DEPTH_TEST);
- glEnableLineStipple();
- glColor4f(0, 0, 0, 1);
+ glEnable(GL_LINE_STIPPLE);
+ glLineStipple(5, 0x5555);
+ glColor3f(0, 0, 0);
float pt1x = (float)(m_nDownX - x);
float pt1y = (float)(m_nDownY - y);
float pt2x = m_OverlayTrackStart[0] - x;
float pt2y = m_OverlayTrackStart[1] - y;
- float Verts[8][2] =
- {
- { pt1x, pt1y }, { pt2x, pt1y },
- { pt2x, pt1y }, { pt2x, pt2y },
- { pt2x, pt2y }, { pt1x, pt2y },
- { pt1x, pt2y }, { pt1x, pt1y }
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINES, 0, 8);
- glDisableClientState(GL_VERTEX_ARRAY);
-
- glDisableLineStipple();
+ glBegin(GL_LINES);
+ glVertex2f(pt1x, pt1y);
+ glVertex2f(pt2x, pt1y);
+ glVertex2f(pt2x, pt1y);
+ glVertex2f(pt2x, pt2y);
+ glVertex2f(pt2x, pt2y);
+ glVertex2f(pt1x, pt2y);
+ glVertex2f(pt1x, pt2y);
+ glVertex2f(pt1x, pt1y);
+ glEnd();
+
+ glDisable(GL_LINE_STIPPLE);
glEnable(GL_DEPTH_TEST);
}
}
@@ -2863,14 +2792,7 @@ void Project::RenderViewports(bool bBackground, bool bLines)
if ((m_nDetail & LC_DET_SMOOTH) == 0)
glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
-
- float Verts[4][2];
- float Colors[4][3];
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, Verts);
- glEnableClientState(GL_COLOR_ARRAY);
- glColorPointer(3, GL_FLOAT, 0, Colors);
+ glBegin(GL_QUADS);
for (vp = 0; vp < viewports[m_nViewportMode].n; vp++)
{
@@ -2879,21 +2801,14 @@ void Project::RenderViewports(bool bBackground, bool bLines)
w = viewports[m_nViewportMode].dim[vp][2] * (float)m_nViewX;
h = viewports[m_nViewportMode].dim[vp][3] * (float)m_nViewY;
- Colors[0][0] = m_fGradient1[0]; Colors[0][1] = m_fGradient1[1]; Colors[0][2] = m_fGradient1[2];
- Verts[0][0] = x+w; Verts[0][1] = y+h;
- Colors[1][0] = m_fGradient1[0]; Colors[1][1] = m_fGradient1[1]; Colors[1][2] = m_fGradient1[2];
- Verts[1][0] = x; Verts[1][1] = y+h;
- Colors[2][0] = m_fGradient2[0]; Colors[2][1] = m_fGradient2[1]; Colors[2][2] = m_fGradient2[2];
- Verts[2][0] = x; Verts[2][1] = y;
- Colors[3][0] = m_fGradient2[0]; Colors[3][1] = m_fGradient2[1]; Colors[3][2] = m_fGradient2[2];
- Verts[3][0] = x+w; Verts[3][1] = y;
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glColor3fv(m_fGradient1);
+ glVertex2f(x+w, y+h);
+ glVertex2f(x, y+h);
+ glColor3fv(m_fGradient2);
+ glVertex2f(x, y);
+ glVertex2f(x+w, y);
}
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_COLOR_ARRAY);
-
+ glEnd();
glEnable(GL_DEPTH_TEST);
if ((m_nDetail & LC_DET_SMOOTH) == 0)
glShadeModel(GL_FLAT);
@@ -2907,14 +2822,7 @@ void Project::RenderViewports(bool bBackground, bool bLines)
glDisable (GL_DEPTH_TEST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
m_pBackground->MakeCurrent();
-
- float Verts[4][2];
- float Coords[4][2];
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, Verts);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, Coords);
+ glBegin(GL_QUADS);
for (vp = 0; vp < viewports[m_nViewportMode].n; vp++)
{
@@ -2930,21 +2838,16 @@ void Project::RenderViewports(bool bBackground, bool bLines)
th = h/m_pBackground->m_nHeight;
}
- Coords[0][0] = 0; Coords[0][1] = 0;
- Verts[0][0] = x; Verts[0][1] = y+h;
- Coords[1][0] = tw; Coords[1][1] = 0;
- Verts[1][0] = x+w; Verts[1][1] = y+h;
- Coords[2][0] = tw; Coords[2][1] = th;
- Verts[2][0] = x+w; Verts[2][1] = y;
- Coords[3][0] = 0; Coords[3][1] = th;
- Verts[3][0] = x; Verts[3][1] = y;
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glTexCoord2f(0, 0);
+ glVertex2f(x, y+h);
+ glTexCoord2f(tw, 0);
+ glVertex2f(x+w, y+h);
+ glTexCoord2f(tw, th);
+ glVertex2f(x+w, y);
+ glTexCoord2f(0, th);
+ glVertex2f(x, y);
}
-
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-
+ glEnd();
glEnable(GL_DEPTH_TEST);
}
@@ -2955,12 +2858,13 @@ void Project::RenderViewports(bool bBackground, bool bLines)
if (bLines)
{
// Draw text
- glColor4f(0, 0, 0, 1);
+ glColor3f(0, 0, 0);
if (!bBackground)
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
m_pScreenFont->MakeCurrent();
glEnable(GL_ALPHA_TEST);
+ glBegin(GL_QUADS);
for (vp = 0; vp < viewports[m_nViewportMode].n; vp++)
{
@@ -2969,8 +2873,9 @@ void Project::RenderViewports(bool bBackground, bool bLines)
w = viewports[m_nViewportMode].dim[vp][2] * (float)(m_nViewX - 1);
h = viewports[m_nViewportMode].dim[vp][3] * (float)(m_nViewY - 1);
- m_pScreenFont->PrintText(x + 3, y + h - 6, 0.0f, m_pViewCameras[vp]->GetName());
+ m_pScreenFont->PrintText(x + 3, y + h - 6, 0.0f, m_pViewCameras[vp]->GetName());
}
+ glEnd();
glDisable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D);
@@ -2979,30 +2884,36 @@ void Project::RenderViewports(bool bBackground, bool bLines)
if (m_fLineWidth != 1.0f)
glLineWidth (1.0f);
- glEnableClientState(GL_VERTEX_ARRAY);
-
for (vp = 0; vp < viewports[m_nViewportMode].n; vp++)
{
if (vp == m_nActiveViewport)
- glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
- else
- glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
+ continue;
x = viewports[m_nViewportMode].dim[vp][0] * (float)m_nViewX;
y = viewports[m_nViewportMode].dim[vp][1] * (float)m_nViewY;
w = viewports[m_nViewportMode].dim[vp][2] * (float)(m_nViewX - 1);
h = viewports[m_nViewportMode].dim[vp][3] * (float)(m_nViewY - 1);
- float Verts[4][2] =
- {
- { x, y }, { x+w, y }, { x+w, y+h }, { x, y+h }
- };
-
- glVertexPointer(2, GL_FLOAT, 0, Verts);
- glDrawArrays(GL_LINE_LOOP, 0, 4);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(x, y);
+ glVertex2f(x+w, y);
+ glVertex2f(x+w, y+h);
+ glVertex2f(x, y+h);
+ glEnd();
}
- glDisableClientState(GL_VERTEX_ARRAY);
+ x = viewports[m_nViewportMode].dim[m_nActiveViewport][0] * (float)m_nViewX;
+ y = viewports[m_nViewportMode].dim[m_nActiveViewport][1] * (float)m_nViewY;
+ w = viewports[m_nViewportMode].dim[m_nActiveViewport][2] * (float)(m_nViewX - 1);
+ h = viewports[m_nViewportMode].dim[m_nActiveViewport][3] * (float)(m_nViewY - 1);
+
+ glColor3f(1.0f, 0, 0);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(x, y);
+ glVertex2f(x+w, y);
+ glVertex2f(x+w, y+h);
+ glVertex2f(x, y+h);
+ glEnd();
if (m_fLineWidth != 1.0f)
glLineWidth (m_fLineWidth);
@@ -3023,11 +2934,14 @@ void Project::RenderBoxes(bool bHilite)
// Initialize OpenGL
void Project::RenderInitialize()
{
+ int i;
+ glLineStipple (1, 65280);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(0.5f, 0.1f);
+ glDrawBuffer(GL_BACK);
glCullFace(GL_BACK);
glDisable (GL_CULL_FACE);
@@ -3060,6 +2974,7 @@ void Project::RenderInitialize()
if (m_nDetail & LC_DET_LIGHTING)
{
glEnable(GL_LIGHTING);
+ glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
glEnable(GL_COLOR_MATERIAL);
GLfloat mat_translucent[] = { (GLfloat)0.8, (GLfloat)0.8, (GLfloat)0.8, (GLfloat)1.0 };
@@ -3082,6 +2997,7 @@ void Project::RenderInitialize()
if (m_nScene & LC_SCENE_FOG)
{
glEnable(GL_FOG);
+ glFogi(GL_FOG_MODE, GL_EXP);
glFogf(GL_FOG_DENSITY, m_fFogDensity);
glFogfv(GL_FOG_COLOR, m_fFogColor);
}
@@ -3115,12 +3031,13 @@ void Project::RenderInitialize()
// Set the perspective correction hint to fastest or nicest...
// glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
-}
-void Project::DrawGrid()
-{
+ // Grid display list
+ if (m_nGridList == 0)
+ m_nGridList = glGenLists(1);
+ glNewList (m_nGridList, GL_COMPILE);
glEnableClientState(GL_VERTEX_ARRAY);
- int i = 2*(4*m_nGridSize+2); // verts needed (2*lines)
+ i = 2*(4*m_nGridSize+2); // verts needed (2*lines)
float *grid = (float*)malloc(i*sizeof(float[3]));
float x = m_nGridSize*0.8f;
@@ -3142,6 +3059,7 @@ void Project::DrawGrid()
}
glVertexPointer(3, GL_FLOAT, 0, grid);
glDrawArrays(GL_LINES, 0, i);
+ glEndList();
free(grid);
}
@@ -3527,7 +3445,7 @@ void Project::CreateImages (Image* images, int width, int height, unsigned short
Sys_FinishMemoryRender (render);
}
-void Project::CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char* ext)
+void Project::CreateHTMLPieceList(FILE* f, int nStep, bool bImages, char* ext)
{
Piece* pPiece;
int col[LC_MAXCOLORS], ID = 0, c;
@@ -3898,8 +3816,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
if (SystemDoDialog(LC_DLG_HTML, &opts))
{
FILE* f;
- const char *ext, *htmlext;
- char fn[LC_MAXPATH];
+ char *ext, *htmlext, fn[LC_MAXPATH];
int i;
unsigned short last = GetLastStep();
@@ -3976,11 +3893,6 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
strcat (fn, m_strTitle);
strcat (fn, htmlext);
f = fopen (fn, "wt");
- if (f == NULL)
- {
- perror(fn);
- return;
- }
fprintf (f, "<HTML>\n<HEAD>\n<TITLE>Instructions for %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
for (i = 1; i <= last; i++)
@@ -4007,11 +3919,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
strcat (fn, "-index");
strcat (fn, htmlext);
f = fopen (fn, "wt");
- if (f == NULL)
- {
- perror(fn);
- return;
- }
+
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>Instructions for %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
for (i = 1; i <= last; i++)
@@ -4029,11 +3937,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
{
sprintf(fn, "%s%s-%02d%s", opts.path, m_strTitle, i, htmlext);
f = fopen(fn, "wt");
- if (f == NULL)
- {
- perror(fn);
- return;
- }
+
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>%s - Step %02d</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle, i);
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
m_strTitle, i, ext, i, opts.imdlg.width, opts.imdlg.height);
@@ -4065,11 +3969,6 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
strcat (fn, "-pieces");
strcat (fn, htmlext);
f = fopen (fn, "wt");
- if (f == NULL)
- {
- perror(fn);
- return;
- }
fprintf (f, "<HTML>\n<HEAD>\n<TITLE>Pieces used by %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
CreateHTMLPieceList(f, 0, opts.images, ext);
@@ -4134,6 +4033,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
glDepthFunc(GL_LEQUAL);
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glDisable (GL_DITHER);
glShadeModel(GL_FLAT);
@@ -4346,15 +4246,28 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
info++;
// skip if color only have lines
- if (*info == 0)
+ if ((*info == 0) && (info[1] == 0))
{
- info++;
+ info += 2;
info += *info + 1;
continue;
}
fputs(" mesh {\n", f);
+ for (count = *info, info++; count; count -= 4)
+ {
+ fprintf(f, " triangle { <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f> }\n",
+ -pInfo->m_fVertexArray[info[0]*3+1], -pInfo->m_fVertexArray[info[0]*3], pInfo->m_fVertexArray[info[0]*3+2],
+ -pInfo->m_fVertexArray[info[1]*3+1], -pInfo->m_fVertexArray[info[1]*3], pInfo->m_fVertexArray[info[1]*3+2],
+ -pInfo->m_fVertexArray[info[2]*3+1], -pInfo->m_fVertexArray[info[2]*3], pInfo->m_fVertexArray[info[2]*3+2]);
+ fprintf(f, " triangle { <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f> }\n",
+ -pInfo->m_fVertexArray[info[2]*3+1], -pInfo->m_fVertexArray[info[2]*3], pInfo->m_fVertexArray[info[2]*3+2],
+ -pInfo->m_fVertexArray[info[3]*3+1], -pInfo->m_fVertexArray[info[3]*3], pInfo->m_fVertexArray[info[3]*3+2],
+ -pInfo->m_fVertexArray[info[0]*3+1], -pInfo->m_fVertexArray[info[0]*3], pInfo->m_fVertexArray[info[0]*3+2]);
+ info += 4;
+ }
+
for (count = *info, info++; count; count -= 3)
{
fprintf(f, " triangle { <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f> }\n",
@@ -4382,15 +4295,28 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
info++;
// skip if color only have lines
- if (*info == 0)
+ if ((*info == 0) && (info[1] == 0))
{
- info++;
+ info += 2;
info += *info + 1;
continue;
}
fputs(" mesh {\n", f);
+ for (count = *info, info++; count; count -= 4)
+ {
+ fprintf(f, " triangle { <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f> }\n",
+ -pInfo->m_fVertexArray[info[0]*3+1], -pInfo->m_fVertexArray[info[0]*3], pInfo->m_fVertexArray[info[0]*3+2],
+ -pInfo->m_fVertexArray[info[1]*3+1], -pInfo->m_fVertexArray[info[1]*3], pInfo->m_fVertexArray[info[1]*3+2],
+ -pInfo->m_fVertexArray[info[2]*3+1], -pInfo->m_fVertexArray[info[2]*3], pInfo->m_fVertexArray[info[2]*3+2]);
+ fprintf(f, " triangle { <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f> }\n",
+ -pInfo->m_fVertexArray[info[2]*3+1], -pInfo->m_fVertexArray[info[2]*3], pInfo->m_fVertexArray[info[2]*3+2],
+ -pInfo->m_fVertexArray[info[3]*3+1], -pInfo->m_fVertexArray[info[3]*3], pInfo->m_fVertexArray[info[3]*3+2],
+ -pInfo->m_fVertexArray[info[0]*3+1], -pInfo->m_fVertexArray[info[0]*3], pInfo->m_fVertexArray[info[0]*3+2]);
+ info += 4;
+ }
+
for (count = *info, info++; count; count -= 3)
{
fprintf(f, " triangle { <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f>, <%.2f, %.2f, %.2f> }\n",
@@ -4509,27 +4435,6 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
}
} break;
- // Export to VRML97, exchange x -> z, z -> y, y -> x,
- case LC_FILE_VRML97:
- {
- char filename[LC_MAXPATH];
- if (!SystemDoDialog(LC_DLG_VRML97, filename))
- break;
-
- exportVRML97File(filename);
- } break;
-
- // Export to X3DV for rigid body component
- // exchange x -> z, z -> y, y -> x,
- case LC_FILE_X3DV:
- {
- char filename[LC_MAXPATH];
- if (!SystemDoDialog(LC_DLG_X3DV, filename))
- break;
-
- exportX3DVFile(filename);
- } break;
-
case LC_FILE_WAVEFRONT:
{
char filename[LC_MAXPATH];
@@ -5778,7 +5683,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
if (m_pPieces == 0) break;
bool bControl = Sys_KeyDown (KEY_CONTROL);
- GLfloat modelMatrix[16], projMatrix[16];
+ GLdouble modelMatrix[16], projMatrix[16];
float up[3], eye[3], target[3];
float bs[6] = { 10000, 10000, 10000, -10000, -10000, -10000 };
GLint viewport[4], out, x, y, w, h;
@@ -5847,7 +5752,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
frontvec *= 0.25f;
glMatrixMode(GL_MODELVIEW);
- glGetFloatv(GL_PROJECTION_MATRIX,projMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX,projMatrix);
glGetIntegerv(GL_VIEWPORT,viewport);
for (out = 0; out < 10000; out++) // Zoom in
@@ -5857,11 +5762,11 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
eye[2] -= frontvec[2];
glLoadIdentity();
gluLookAt(eye[0], eye[1], eye[2], target[0], target[1], target[2], up[0], up[1], up[2]);
- glGetFloatv(GL_MODELVIEW_MATRIX,modelMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX,modelMatrix);
for (int i = 0; i < 24; i+=3)
{
- GLfloat winx, winy, winz;
+ double winx, winy, winz;
gluProject (v[i], v[i+1], v[i+2], modelMatrix, projMatrix, viewport, &winx, &winy, &winz);
if ((winx < viewport[0] + 1) || (winy < viewport[1] + 1) ||
(winx > viewport[0] + viewport[2] - 1) || (winy > viewport[1] + viewport[3] - 1))
@@ -5881,11 +5786,11 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
eye[2] += frontvec[2];
glLoadIdentity();
gluLookAt(eye[0], eye[1], eye[2], target[0], target[1], target[2], up[0], up[1], up[2]);
- glGetFloatv(GL_MODELVIEW_MATRIX,modelMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX,modelMatrix);
for (int i = 0; i < 24; i+=3)
{
- GLfloat winx, winy, winz;
+ double winx, winy, winz;
gluProject (v[i], v[i+1], v[i+2], modelMatrix, projMatrix, viewport, &winx, &winy, &winz);
if ((winx < viewport[0] + 1) || (winy < viewport[1] + 1) ||
(winx > viewport[0] + viewport[2] - 1) || (winy > viewport[1] + viewport[3] - 1))
@@ -6808,21 +6713,21 @@ void Project::GetPieceInsertPosition(int MouseX, int MouseY, Vector3& Position,
void Project::FindObjectFromPoint(int x, int y, LC_CLICKLINE* pLine, bool PiecesOnly)
{
- GLfloat px, py, pz, rx, ry, rz;
- GLfloat modelMatrix[16], projMatrix[16];
+ GLdouble px, py, pz, rx, ry, rz;
+ GLdouble modelMatrix[16], projMatrix[16];
GLint viewport[4];
Piece* pPiece;
Camera* pCamera;
Light* pLight;
LoadViewportProjection(m_nActiveViewport);
- glGetFloatv(GL_MODELVIEW_MATRIX,modelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX,projMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX,modelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX,projMatrix);
glGetIntegerv(GL_VIEWPORT,viewport);
// Unproject the selected point against both the front and the back clipping plane
- gluUnProject(x, y, 0.0f, modelMatrix, projMatrix, viewport, &px, &py, &pz);
- gluUnProject(x, y, 1.0f, modelMatrix, projMatrix, viewport, &rx, &ry, &rz);
+ gluUnProject(x, y, 0, modelMatrix, projMatrix, viewport, &px, &py, &pz);
+ gluUnProject(x, y, 1, modelMatrix, projMatrix, viewport, &rx, &ry, &rz);
pLine->a1 = (float)px;
pLine->b1 = (float)py;
@@ -7889,16 +7794,16 @@ bool Project::OnKeyDown(char nKey, bool bControl, bool bShift)
} break;
}
- GLfloat modelMatrix[16], projMatrix[16], p1[3], p2[3], p3[3];
+ GLdouble modelMatrix[16], projMatrix[16], p1[3], p2[3], p3[3];
float ax, ay;
GLint viewport[4];
- glGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
glGetIntegerv(GL_VIEWPORT, viewport);
- gluUnProject( 5, 5, 0.1f, modelMatrix,projMatrix,viewport,&p1[0],&p1[1],&p1[2]);
- gluUnProject(10, 5, 0.1f, modelMatrix,projMatrix,viewport,&p2[0],&p2[1],&p2[2]);
- gluUnProject( 5,10, 0.1f, modelMatrix,projMatrix,viewport,&p3[0],&p3[1],&p3[2]);
+ gluUnProject( 5, 5, 0.1, modelMatrix,projMatrix,viewport,&p1[0],&p1[1],&p1[2]);
+ gluUnProject(10, 5, 0.1, modelMatrix,projMatrix,viewport,&p2[0],&p2[1],&p2[2]);
+ gluUnProject( 5,10, 0.1, modelMatrix,projMatrix,viewport,&p3[0],&p3[1],&p3[2]);
Vector vx((float)(p2[0] - p1[0]), (float)(p2[1] - p1[1]), 0);//p2[2] - p1[2] };
Vector x(1, 0, 0);
@@ -7970,7 +7875,7 @@ void Project::BeginPieceDrop(PieceInfo* Info)
void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
{
- GLfloat modelMatrix[16], projMatrix[16], point[3];
+ GLdouble modelMatrix[16], projMatrix[16], point[3];
GLint viewport[4];
if (IsDrawing())
@@ -7990,11 +7895,11 @@ void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
m_MouseSnapLeftover = Vector3(0, 0, 0);
LoadViewportProjection(m_nActiveViewport);
- glGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
glGetIntegerv(GL_VIEWPORT, viewport);
- gluUnProject(x, y, 0.9f, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);
+ gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);
m_fTrack[0] = (float)point[0]; m_fTrack[1] = (float)point[1]; m_fTrack[2] = (float)point[2];
switch (m_nCurAction)
@@ -8201,8 +8106,8 @@ void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
if (count == max)
break;
- GLfloat tmp[3];
- gluUnProject(x+1, y-1, 0.9f, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);
+ double tmp[3];
+ gluUnProject(x+1, y-1, 0.9, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);
SelectAndFocusNone(false);
StartTracking(LC_TRACK_START_LEFT);
pLight = new Light (m_fTrack[0], m_fTrack[1], m_fTrack[2], (float)tmp[0], (float)tmp[1], (float)tmp[2]);
@@ -8216,8 +8121,8 @@ void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
case LC_ACTION_CAMERA:
{
- GLfloat tmp[3];
- gluUnProject(x+1, y-1, 0.9f, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);
+ double tmp[3];
+ gluUnProject(x+1, y-1, 0.9, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);
SelectAndFocusNone(false);
StartTracking(LC_TRACK_START_LEFT);
Camera* pCamera = new Camera(m_fTrack[0], m_fTrack[1], m_fTrack[2], (float)tmp[0], (float)tmp[1], (float)tmp[2], m_pCameras);
@@ -8307,7 +8212,7 @@ void Project::OnLeftButtonDown(int x, int y, bool bControl, bool bShift)
void Project::OnLeftButtonDoubleClick(int x, int y, bool bControl, bool bShift)
{
- GLfloat modelMatrix[16], projMatrix[16], point[3];
+ GLdouble modelMatrix[16], projMatrix[16], point[3];
GLint viewport[4];
if (IsDrawing())
@@ -8317,12 +8222,12 @@ void Project::OnLeftButtonDoubleClick(int x, int y, bool bControl, bool bShift)
return;
LoadViewportProjection(m_nActiveViewport);
- glGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
- glGetIntegerv(GL_VIEWPORT, viewport);
+ glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev (GL_PROJECTION_MATRIX, projMatrix);
+ glGetIntegerv (GL_VIEWPORT, viewport);
// why this is here ?
- gluUnProject(x, y, 0.9f, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);
+ gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);
m_fTrack[0] = (float)point[0]; m_fTrack[1] = (float)point[1]; m_fTrack[2] = (float)point[2];
LC_CLICKLINE ClickLine;
@@ -8417,7 +8322,7 @@ void Project::OnLeftButtonUp(int x, int y, bool bControl, bool bShift)
void Project::OnRightButtonDown(int x, int y, bool bControl, bool bShift)
{
- GLfloat modelMatrix[16], projMatrix[16], point[3];
+ GLdouble modelMatrix[16], projMatrix[16], point[3];
GLint viewport[4];
if (StopTracking(false))
@@ -8430,11 +8335,11 @@ void Project::OnRightButtonDown(int x, int y, bool bControl, bool bShift)
m_bTrackCancel = false;
LoadViewportProjection(m_nActiveViewport);
- glGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
glGetIntegerv(GL_VIEWPORT, viewport);
- gluUnProject(x, y, 0.9f, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);
+ gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &point[0], &point[1], &point[2]);
m_fTrack[0] = (float)point[0]; m_fTrack[1] = (float)point[1]; m_fTrack[2] = (float)point[2];
switch (m_nCurAction)
@@ -8516,16 +8421,16 @@ void Project::OnMouseMove(int x, int y, bool bControl, bool bShift)
if (IsDrawing())
return;
- GLfloat modelMatrix[16], projMatrix[16], tmp[3];
+ GLdouble modelMatrix[16], projMatrix[16], tmp[3];
GLint viewport[4];
float ptx, pty, ptz;
LoadViewportProjection(m_nActiveViewport);
- glGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
glGetIntegerv(GL_VIEWPORT, viewport);
- gluUnProject(x, y, 0.9f, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);
+ gluUnProject(x, y, 0.9, modelMatrix, projMatrix, viewport, &tmp[0], &tmp[1], &tmp[2]);
ptx = (float)tmp[0]; pty = (float)tmp[1]; ptz = (float)tmp[2];
switch (m_nCurAction)
@@ -9180,13 +9085,13 @@ void Project::MouseUpdateOverlays(int x, int y)
const float OverlayRotateRadius = 2.0f;
// Calculate the distance from the mouse pointer to the center of the sphere.
- GLfloat px, py, pz, rx, ry, rz;
- GLfloat ModelMatrix[16], ProjMatrix[16];
+ GLdouble px, py, pz, rx, ry, rz;
+ GLdouble ModelMatrix[16], ProjMatrix[16];
GLint Viewport[4];
LoadViewportProjection(m_nActiveViewport);
- glGetFloatv(GL_MODELVIEW_MATRIX, ModelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, ProjMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, ModelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, ProjMatrix);
glGetIntegerv(GL_VIEWPORT, Viewport);
// Unproject the mouse point against both the front and the back clipping planes.
@@ -9407,15 +9312,15 @@ void Project::UpdateOverlayScale()
{
if (m_OverlayActive)
{
- GLfloat ScreenX, ScreenY, ScreenZ, PointX, PointY, PointZ;
- GLfloat ModelMatrix[16], ProjMatrix[16];
+ GLdouble ScreenX, ScreenY, ScreenZ, PointX, PointY, PointZ;
+ GLdouble ModelMatrix[16], ProjMatrix[16];
GLint Viewport[4];
for (int i = 0; i < viewports[m_nViewportMode].n; i++)
{
LoadViewportProjection(i);
- glGetFloatv(GL_MODELVIEW_MATRIX, ModelMatrix);
- glGetFloatv(GL_PROJECTION_MATRIX, ProjMatrix);
+ glGetDoublev(GL_MODELVIEW_MATRIX, ModelMatrix);
+ glGetDoublev(GL_PROJECTION_MATRIX, ProjMatrix);
glGetIntegerv(GL_VIEWPORT, Viewport);
// Calculate the scaling factor by projecting the center to the front plane then
@@ -9428,856 +9333,3 @@ void Project::UpdateOverlayScale()
}
}
}
-
-// VRML97 and X3DV export is very similar, cause X3D is the successor of VRML97
-// therefore a lot of the export routines can be reused
-// the member variable VRMLdialect used with the following enum has this information
-
-enum
-{
- VRML97,
- X3DV_WITH_RIGID_BODY_PHYSICS
-};
-
-void Project::exportVRML97File(char *filename)
-{
- exportVRMLFile(filename, VRML97);
-}
-
-void Project::exportX3DVFile(char *filename)
-{
- exportVRMLFile(filename, X3DV_WITH_RIGID_BODY_PHYSICS);
-}
-
-void Project::writeIndent(FILE* stream)
-{
- for (int i = 0; i < indent; i++)
- fprintf(stream, " ");
-}
-
-#define INDENT_INC 2
-
-// routines to write VRML/X3DV shape related commands
-// for details see
-// http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/
-// http://www.web3d.org/x3d/specifications/ISO-IEC-19775-X3DAbstractSpecification/Part01/Architecture.html
-
-void Project::writeVRMLShapeBegin(FILE *stream, unsigned long currentColor, bool blackLines)
-{
- // http://www.web3d.org/x3d/specifications/ISO-IEC-19775-X3DAbstractSpecification_Revision1_to_Part1/Part01/components/rigid_physics.html#CollidableShape
-
- if (VRMLdialect == X3DV_WITH_RIGID_BODY_PHYSICS)
- {
- numFaceColors = 0;
- faceColors = (int *) malloc(1);
-
- writeIndent(stream);
- fprintf(stream, "DEF CollidableShape%d CollidableShape {\n", numDEF++);
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "shape ");
- }
- else
- writeIndent(stream);
-
- // http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#Shape
-
- fprintf(stream, "Shape {\n");
- indent += INDENT_INC;
-
- // http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#Appearance
- // http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#Material
- writeIndent(stream);
- fprintf(stream, "appearance Appearance {\n");
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "material Material {\n");
- indent += INDENT_INC;
- if (blackLines)
- {
- writeIndent(stream);
- fprintf(stream, "diffuseColor 0 0 0\n");
- writeIndent(stream);
- fprintf(stream, "emissiveColor 0 0 0\n");
- }
- else
- {
- writeIndent(stream);
- fprintf(stream, "diffuseColor %g %g %g\n", (float)(FlatColorArray[currentColor][0]) / 256.0, (float)(FlatColorArray[currentColor][1]) / 256.0, (float)(FlatColorArray[currentColor][2]) / 256.0);
- if (currentColor > 13 && currentColor < 22)
- {
- writeIndent(stream);
- fprintf(stream, "transparency 0.5\n");
- }
- }
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
-
- if (blackLines)
- {
- // http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#IndexedLineSet
- writeIndent(stream);
- fprintf(stream, "geometry IndexedLineSet {\n");
- indent += INDENT_INC;
- }
- else
- {
- // http://www.web3d.org/x3d/specifications/ISO-IEC-19775-X3DAbstractSpecification/Part01/components/rendering.html#TriangleSet
- // http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#IndexedFaceSet
- writeIndent(stream);
- if (VRMLdialect == X3DV_WITH_RIGID_BODY_PHYSICS)
- fprintf(stream, "geometry TriangleSet {\n");
- else
- fprintf(stream, "geometry IndexedFaceSet {\n");
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "solid FALSE\n");
- if (VRMLdialect != X3DV_WITH_RIGID_BODY_PHYSICS)
- {
- writeIndent(stream);
- fprintf(stream, "creaseAngle 0.79\n");
- }
- }
-}
-
-void Project::writeVRMLShapeEnd(FILE *stream)
-{
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
-}
-
-// search for vertex (vertex[0], vertex[1], vertex[2]) in coords and give
-// back index (-1 if not found)
-
-int Project::searchForVertex(float* vertex)
-{
- for (int i = 0; i < numCoords; i++)
- if (coords[i * 3] == vertex[0])
- if (coords[i * 3 + 1] == vertex[1])
- if (coords[i * 3 + 2] == vertex[2])
- return i;
- return -1;
-}
-
-// routines to collect VRML indexed polygon mesh data or X3DV triangle mesh data
-
-template<class type> void Project::generateMeshData(type* info, float *pos, Piece* pPiece, int numVertices, int currentColor)
-{
- float rot[4];
- Vector3 Pos = pPiece->GetPosition();
- pPiece->GetRotation(rot);
- Matrix matrix(rot, Pos);
-
- bool rigidBody = (VRMLdialect == X3DV_WITH_RIGID_BODY_PHYSICS);
-
- PieceInfo* pInfo = pPiece->GetPieceInfo();
- if (rigidBody)
- {
- // IndexedLineSet not supported by xj3d RigidBody node
- if (numVertices == 2)
- return;
-
- int maxJ = 1;
- // write 2 triangles instead of 1 quad
- if (numVertices == 4)
- maxJ = 2;
- for (int j = 0; j < maxJ; j++)
- {
- for (int i = 0; i < 3; i++)
- {
- int index = i;
- if (j == 1)
- {
- switch (i) {
- case 0:
- index = 2;
- break;
- case 1:
- index = 0;
- break;
- case 2:
- index = 3;
- break;
- }
- }
- float *localVertex = &pInfo->m_fVertexArray[info[index] * 3];
- float vertex[3];
- matrix.TransformPoint(vertex, localVertex);
- coords = (float *) realloc(coords, (numCoords + 1) * 3 * sizeof(float));
- coords[numCoords * 3 + 0] = vertex[1] - pos[1];
- coords[numCoords * 3 + 1] = vertex[2] - pos[2];
- coords[numCoords * 3 + 2] = vertex[0] - pos[0];
- numCoords++;
- }
- faceColors = (int *) realloc(faceColors, (numFaceColors + 1) * sizeof(int));
- faceColors[numFaceColors] = currentColor;
- numFaceColors++;
- }
- return;
- }
- for (int i = 0; i < numVertices; i++)
- {
- float *localVertex = &pInfo->m_fVertexArray[info[i] * 3];
- int index = searchForVertex(localVertex);
- if (index == -1)
- {
- float vertex[3];
- if (rigidBody)
- matrix.TransformPoint(vertex, localVertex);
- else
- {
- vertex[0] = localVertex[0];
- vertex[1] = localVertex[1];
- vertex[2] = localVertex[2];
- }
- coords = (float *) realloc(coords, (numCoords + 1) * 3 * sizeof(float));
- coords[numCoords * 3 + 0] = vertex[1] - (rigidBody ? pos[1] : 0);
- coords[numCoords * 3 + 1] = vertex[2] - (rigidBody ? pos[2] : 0);
- coords[numCoords * 3 + 2] = vertex[0] - (rigidBody ? pos[0] : 0);
- index = numCoords;
- numCoords++;
- }
- coordIndices = (int *) realloc(coordIndices, (numCoordIndices + 1) * sizeof(int));
- coordIndices[numCoordIndices] = index;
- numCoordIndices++;
- }
- coordIndices = (int *) realloc(coordIndices, (numCoordIndices + 1) * sizeof(int));
- coordIndices[numCoordIndices] = -1;
- numCoordIndices++;
- faceColors = (int *) realloc(faceColors, (numFaceColors + 1) * sizeof(int));
- faceColors[numFaceColors] = currentColor;
- numFaceColors++;
-}
-
-// write collected mesh data
-
-void Project::writeVRMLShapeMeshBegin(FILE *stream)
-{
- writeIndent(stream);
-
- fprintf(stream, "coord Coordinate {\n");
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "point [\n");
- indent += INDENT_INC;
-}
-
-void Project::writeVRMLShapeMeshData(FILE *stream)
-{
- for (int i = 0; i < numCoords; i++)
- {
- writeIndent(stream);
- fprintf(stream, "%f %f %f\n", coords[i * 3] * VRMLScale, coords[i * 3 + 1] * VRMLScale, coords[i * 3 + 2] * VRMLScale);
- }
-}
-
-void Project::writeVRMLShapeMeshEnd(FILE *stream)
-{
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "]\n");
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
-
-
- if (VRMLdialect == X3DV_WITH_RIGID_BODY_PHYSICS)
- {
- writeIndent(stream);
- fprintf(stream, "color ColorRGBA {\n");
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "color [\n");
- indent += INDENT_INC;
-
- for (int i = 0; i < numFaceColors; i++)
- {
- int currentColor = faceColors[i];
- writeIndent(stream);
- fprintf(stream, "%g %g %g %g\n", (float)(FlatColorArray[currentColor][0]) / 256.0, (float)(FlatColorArray[currentColor][1]) / 256.0, (float)(FlatColorArray[currentColor][2]) / 256.0, (currentColor > 13 && currentColor < 22) ? 0.5 : 1);
- writeIndent(stream);
- fprintf(stream, "%g %g %g %g\n", (float)(FlatColorArray[currentColor][0]) / 256.0, (float)(FlatColorArray[currentColor][1]) / 256.0, (float)(FlatColorArray[currentColor][2]) / 256.0, (currentColor > 13 && currentColor < 22) ? 0.5 : 1);
- writeIndent(stream);
- fprintf(stream, "%g %g %g %g\n", (float)(FlatColorArray[currentColor][0]) / 256.0, (float)(FlatColorArray[currentColor][1]) / 256.0, (float)(FlatColorArray[currentColor][2]) / 256.0, (currentColor > 13 && currentColor < 22) ? 0.5 : 1);
- }
-
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "]\n");
-
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
- }
- else
- {
- writeIndent(stream);
- fprintf(stream, "coordIndex [\n");
- indent += INDENT_INC;
-
- for (int i = 0; i < numCoordIndices; i ++)
- {
- writeIndent(stream);
- fprintf(stream, "%d\n", coordIndices[i]);
- }
-
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "]\n");
- }
-}
-
-// routine to run through leoCADs internal data space, collect and write data
-
-template<class type> void Project::writeVRMLShapes(type color, FILE *stream, int coordinateCounter, Piece* pPiece, unsigned short group, float *pos, bool beginAndEnd)
-{
- PieceInfo* pInfo = pPiece->GetPieceInfo();
- const char* colname;
- type* info = (type*)(pInfo->m_pGroups[group].drawinfo);
- type currentColor = color;
- type count, colors = *info;
- type maxColors = colors;
- info++;
-
- while (colors--)
- {
- numCoords = 0;
- coords = (float *) malloc(1);
- numCoordIndices = 0;
- coordIndices = (int *) malloc(1);
-
- if ((*info == LC_COL_DEFAULT) || (*info == LC_COL_EDGES))
- {
- colname = altcolornames[color];
- currentColor = color;
- }
- else
- {
- if ((*info >= LC_MAXCOLORS))
- {
- info++;
- info += *info + 1;
- info += *info + 1;
-
- continue;
- }
- colname = altcolornames[*info];
- currentColor = *info;
- }
- info++;
-
- if (*info)
- {
- for (count = *info, info++; count; count -= 3)
- {
- generateMeshData(info, pos, pPiece, 3, currentColor);
- info += 3;
- }
- writeIndent(stream);
- fprintf(stream, "# %s\n", colname);
-
- bool rigidBody = (VRMLdialect == X3DV_WITH_RIGID_BODY_PHYSICS);
-
- bool writeBegin = ((!rigidBody) || (beginAndEnd && (colors == (maxColors - 1))));
- bool writeEnd = ((!rigidBody) || (beginAndEnd && (colors == 0)));
-
- if (writeBegin)
- {
- writeVRMLShapeBegin(stream, currentColor, false);
- writeVRMLShapeMeshBegin(stream);
- }
-
- writeVRMLShapeMeshData(stream);
-
- if (writeEnd)
- {
- writeVRMLShapeMeshEnd(stream);
- writeVRMLShapeEnd(stream);
- }
- }
- else
- info++;
-
- if (*info)
- {
- // IndexedLineSet not supported in RigidBody node for the xj3d browser 8-(
- if (VRMLdialect != X3DV_WITH_RIGID_BODY_PHYSICS)
- {
- writeIndent(stream);
- fprintf(stream, "# lines of color %s\n", colname);
- }
-
- for (count = *info, info++; count; count -= 2)
- {
- generateMeshData(info, pos, pPiece, 2, currentColor);
- info += 2;
- }
-
- // IndexedLineSet not supported in RigidBody node for the xj3d browser 8-(
- if (VRMLdialect != X3DV_WITH_RIGID_BODY_PHYSICS)
- {
- writeVRMLShapeBegin(stream, currentColor, true);
- writeVRMLShapeMeshBegin(stream);
- writeVRMLShapeMeshData(stream);
- writeVRMLShapeMeshEnd(stream);
- writeVRMLShapeEnd(stream);
- }
- }
- else
- info++;
-
- free(coords);
- free(coordIndices);
- }
-}
-
-// The X3DV export need to "melt together" faces of different pieces into one triangleSet
-// based on the leocad "piece -> group" menupoint, otherwise the rigid body simulation would simulate all pieces seperatly
-// Additionally a center of mass is required for the X3DV export
-// Unfortunalty, the origin of a piece in leocad is not usefull for use as center of mass
-// So the exporter use the mid of the boundingbox of all pieces in a group as center of mass
-// the needed information is stored in the following compound datatype
-
-class GroupInfo
-{
-public:
- Group *group;
- float minBoundingBox[3];
- float maxBoundingBox[3];
- char groupname[65];
- bool firstData;
- Piece *firstPiece;
- Piece *lastPiece;
-};
-
-// routines to account a boundingbox
-
-template<class type> void Project::getMinMaxData(type* info, Piece* pPiece, GroupInfo* groupInfo)
-{
- float rot[4];
- Vector3 Pos = pPiece->GetPosition();
- pPiece->GetRotation(rot);
- Matrix matrix(rot, Pos);
-
- PieceInfo* pInfo = pPiece->GetPieceInfo();
-
- for (int i = 0; i < 3; i++)
- {
- float vertex[3];
- float *localVertex = &pInfo->m_fVertexArray[info[i] * 3];
- matrix.TransformPoint(vertex, localVertex);
-
- for (int j = 0; j < 3; j++)
- {
- if (groupInfo->firstData)
- {
- groupInfo->minBoundingBox[j] = vertex[j];
- groupInfo->maxBoundingBox[j] = vertex[j];
- }
- if (vertex[j] < groupInfo->minBoundingBox[j])
- groupInfo->minBoundingBox[j] = vertex[j];
- if (vertex[j] > groupInfo->maxBoundingBox[j])
- groupInfo->maxBoundingBox[j] = vertex[j];
- }
- groupInfo->firstData = false;
- }
-}
-
-template<class type> void Project::getMinMax(type col, Piece* piece, unsigned short group, GroupInfo* groupInfo)
-{
- PieceInfo *pInfo = piece->GetPieceInfo();
- type* info = (type*)(pInfo->m_pGroups[group].drawinfo);
- type colors = *info;
- info++;
-
- type count;
-
- while (colors--)
- {
- if ((*info == LC_COL_DEFAULT) || (*info == LC_COL_EDGES))
- {
- }
- else
- {
- if ((*info >= LC_MAXCOLORS))
- {
- info++;
- info += *info + 1;
- info += *info + 1;
-
- continue;
- }
- }
- info++;
-
- bool skipNext = (info[0] < 1);
- if (skipNext)
- skipNext = (info[1] < 1);
- if (skipNext)
- info += 2;
- else
- {
- for (count = *info, info++; count; count -= 3)
- {
- getMinMaxData(info, piece, groupInfo);
- info += 3;
- }
- }
-
- info += *info + 1;
- }
-}
-
-// Pieces without TopGroup represent Pieces without "Piece->Group" in LeoCAD
-// The handleAsGroup function is used with "if" in loops over pieces,
-// to run the if/loop content for either only single pieces or all pieces part
-// of a LeoCAD "Piece->Group"
-
-bool Project::handleAsGroup(Piece* pPiece, GroupInfo groupInfo)
-{
- if (pPiece->GetTopGroup() == NULL)
- {
- if (groupInfo.firstPiece == pPiece)
- return true;
- }
- else
- {
- if (pPiece->GetTopGroup() == groupInfo.group)
- return true;
- }
- return false;
-}
-
-// main routine to export VRML97 or X3DV files
-
-void Project::exportVRMLFile(char *filename, int dialect)
-{
- numDEF = 0;
- indent = 0;
- int coordinateCounter = 1;
- char buf[LC_MAXPATH], *ptr;
- FILE* stream = fopen(filename, "wt");
- Piece* pPiece;
- bool rigidBody = (dialect == X3DV_WITH_RIGID_BODY_PHYSICS);
- VRMLdialect = dialect;
- strcpy(buf, m_strPathName);
- ptr = strrchr(buf, '\\');
- if (ptr)
- ptr++;
- else
- {
- ptr = strrchr(buf, '/');
- if (ptr)
- ptr++;
- else
- ptr = buf;
- }
-
- // write header
- switch (VRMLdialect)
- {
- case VRML97:
- fputs("#VRML V2.0 utf8\n", stream);
- break;
- case X3DV_WITH_RIGID_BODY_PHYSICS:
- fputs("#X3D V3.0 utf8\n", stream);
- fputs("PROFILE Immersive\n", stream);
- fputs("COMPONENT RigidBodyPhysics:2\n", stream);
- break;
- }
-
- // write leading comments
- fputs("# Model exported from LeoCAD\n", stream);
- if (strlen(buf) != 0)
- fprintf(stream,"# Original name: %s\n", ptr);
- if (strlen(m_strAuthor))
- fprintf(stream, "# Author: %s\n", m_strAuthor);
-
- // write leading once needed X3DV commands
- if (rigidBody)
- {
- fputs("\n", stream);
- writeIndent(stream);
- fputs("Group {\n", stream);
- indent += INDENT_INC;
- writeIndent(stream);
- fputs("children [\n", stream);
- indent += INDENT_INC;
- }
-
- // initalise "melt together" group information
- ObjArray<GroupInfo> allGroups;
- GroupInfo groupObject;
- for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
- {
- Group *topGroup = pPiece->GetTopGroup();
- int foundGroup = false;;
- if (topGroup != NULL)
- {
- for (int i = 0; i < allGroups.GetSize(); i++)
- if (allGroups[i].group == topGroup)
- {
- allGroups[i].lastPiece = pPiece;
- foundGroup = true;
- }
- }
- if (!foundGroup)
- {
- groupObject.group = topGroup;
- groupObject.firstPiece = pPiece;
- groupObject.lastPiece = pPiece;
- groupObject.firstData = true;
- if (topGroup != NULL)
- snprintf(groupObject.groupname, 64, "%s", topGroup->m_strName);
- else
- snprintf(groupObject.groupname, 64, "%s", pPiece->GetName());
- allGroups.Add(groupObject);
- }
- }
-
- // account bounding box information
- for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
- {
- unsigned char color = pPiece->GetColor();
- PieceInfo *pInfo = pPiece->GetPieceInfo();
- for (int j = 0; j < allGroups.GetSize(); j++)
- {
- if (handleAsGroup(pPiece, allGroups[j]))
- {
- unsigned short group;
-
- for (group = 0; group < pInfo->m_nGroupCount; group++)
- {
- if (pInfo->m_nFlags & LC_PIECE_LONGDATA)
- {
- unsigned long col = color;
- getMinMax(col, pPiece, group, &(allGroups[j]));
- }
- else
- {
- unsigned short col = color;
- getMinMax(col, pPiece, group, &(allGroups[j]));
- }
- }
- }
- }
- }
-
- // write main VRML97/X3DV data
- for (int j = 0; j < allGroups.GetSize(); j++)
- {
- for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
- {
- bool beginGroup = ((allGroups[j].group == NULL) || (allGroups[j].firstPiece == pPiece));
- bool endGroup = ((allGroups[j].group == NULL) || (allGroups[j].lastPiece == pPiece));
-
- if (handleAsGroup(pPiece, allGroups[j]))
- {
- PieceInfo* pInfo = pPiece->GetPieceInfo();
- unsigned char color = pPiece->GetColor();
-
- strcpy(buf, pPiece->GetName());
- for (unsigned int i = 0; i < strlen(buf); i++)
- if ((buf[i] == '#') || (buf[i] == ' '))
- buf[i] = '_';
-
- writeIndent(stream);
- fprintf(stream, "# %s\n", buf);
-
- float pos[3];
- float rot[4];
-
- switch (VRMLdialect)
- {
- case VRML97:
- pPiece->GetPosition(pos);
- pPiece->GetRotation(rot);
- writeIndent(stream);
- fprintf(stream, "Transform {\n");
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "translation %g %g %g\n", pos[1] * VRMLScale, pos[2] * VRMLScale, pos[0] * VRMLScale);
- writeIndent(stream);
- fprintf(stream, "rotation %g %g %g %g\n", rot[1], rot[2], rot[0], rot[3] * M_PI / 180.0);
- writeIndent(stream);
- fprintf(stream, "children [\n");
- indent += INDENT_INC;
- break;
- case X3DV_WITH_RIGID_BODY_PHYSICS:
- for (int k = 0; k < 3; k++)
- pos[k] = allGroups[j].minBoundingBox[k] + (allGroups[j].maxBoundingBox[k] - allGroups[j].minBoundingBox[k]) / 2.0f;
- }
-
- unsigned short group;
-
- if (pInfo->m_nGroupCount > 0)
- {
- if (beginGroup && rigidBody)
- {
- if (pInfo->m_nFlags & LC_PIECE_LONGDATA)
- {
- unsigned long col = color;
- writeVRMLShapeBegin(stream, col, false);
- writeVRMLShapeMeshBegin(stream);
- }
- else
- {
- unsigned short col = color;
- writeVRMLShapeBegin(stream, col, false);
- writeVRMLShapeMeshBegin(stream);
- }
- }
-
- for (group = 0; group < pInfo->m_nGroupCount; group++)
- {
- writeIndent(stream);
- fprintf(stream, "# group %d\n",(int)group);
- if (pInfo->m_nFlags & LC_PIECE_LONGDATA)
- {
- unsigned long col = color;
- writeVRMLShapes(col, stream, coordinateCounter, pPiece, group, pos, !rigidBody);
- }
- else
- {
- unsigned short col = color;
- writeVRMLShapes(col, stream, coordinateCounter, pPiece, group, pos, !rigidBody);
- }
- }
-
- if (endGroup && rigidBody)
- {
- writeVRMLShapeMeshEnd(stream);
- writeVRMLShapeEnd(stream);
- }
- }
-
- if (!rigidBody)
- {
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "]\n");
- }
-
- if (endGroup || (!rigidBody))
- {
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "} # endShape\n");
- }
-
- coordinateCounter++;
- }
-
- }
- }
-
- if (rigidBody)
- {
- // write trailing once needed X3DV commands
- // http://www.xj3d.org/extensions/rigid_physics.html
- // http://www.web3d.org/x3d/specifications/ISO-IEC-19775-X3DAbstractSpecification_Revision1_to_Part1/Part01/components/rigid_physics.html
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("]\n", stream);
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("}\n", stream);
-
- writeIndent(stream);
- fputs("DEF RigidBodyCollection1 RigidBodyCollection {\n", stream);
- indent += INDENT_INC;
- writeIndent(stream);
- fputs("bodies [\n", stream);
- indent += INDENT_INC;
- coordinateCounter = 0;
- for (int j = 0; j < allGroups.GetSize(); j++)
- {
- for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
- {
- bool beginGroup = ((allGroups[j].group == NULL) || (allGroups[j].firstPiece == pPiece));
- bool endGroup = ((allGroups[j].group == NULL) || (allGroups[j].lastPiece == pPiece));
-
- if (handleAsGroup(pPiece, allGroups[j]))
- {
- float pos[3];
-
- if (VRMLdialect == X3DV_WITH_RIGID_BODY_PHYSICS)
- {
- if (beginGroup)
- {
- for (int k = 0; k < 3; k++)
- pos[k] = allGroups[j].minBoundingBox[k] + (allGroups[j].maxBoundingBox[k] - allGroups[j].minBoundingBox[k]) / 2.0f;
- writeIndent(stream);
- fprintf(stream, "# %s\n", allGroups[j].groupname);
- writeIndent(stream);
- fprintf(stream, "RigidBody {\n");
- indent += INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "position %g %g %g\n", pos[1] * VRMLScale, pos[2] * VRMLScale, pos[0] * VRMLScale);
- writeIndent(stream);
- fprintf(stream, "geometry USE CollidableShape%d\n", coordinateCounter);
- }
- if (endGroup)
- {
- indent -= INDENT_INC;
- writeIndent(stream);
- fprintf(stream, "}\n");
- }
- }
- }
-
- }
- coordinateCounter++;
- }
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("]\n", stream);
-
- writeIndent(stream);
- fputs("collider DEF CollisionCollection1 CollisionCollection", stream);
- fputs(" {\n", stream);
- indent += INDENT_INC;
- writeIndent(stream);
- fputs("collidables [\n", stream);
- indent += INDENT_INC;
- for (int i = 0; i < numDEF; i++)
- {
- writeIndent(stream);
- fprintf(stream, "USE CollidableShape%d\n", i);
- }
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("]\n", stream);
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("}\n", stream);
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("}\n", stream);
-
- writeIndent(stream);
- fputs("DEF CollisionSensor1 CollisionSensor {\n", stream);
- indent += INDENT_INC;
- writeIndent(stream);
- fputs("collidables USE CollisionCollection1\n", stream);
- indent -= INDENT_INC;
- writeIndent(stream);
- fputs("}\n", stream);
- fputs("\n", stream);
- fputs("ROUTE CollisionSensor1.contacts TO RigidBodyCollection1.set_contacts\n", stream);
- }
-
- if (indent != 0)
- fprintf(stderr, "internal error: indent %d\n", indent);
- fclose(stream);
-}
-
-
diff --git a/common/project.h b/common/project.h
index 0f959a0..f4bb61c 100644
--- a/common/project.h
+++ b/common/project.h
@@ -30,7 +30,6 @@ class Piece;
class Camera;
class Light;
class Group;
-class GroupInfo;
class Texture;
class Terrain;
class PieceInfo;
@@ -190,8 +189,7 @@ protected:
void RenderOverlays(int Viewport);
void RenderBoxes(bool bHilite);
void RenderInitialize();
- void DrawGrid();
- void CreateHTMLPieceList(FILE* f, int nStep, bool bImages, const char* ext);
+ void CreateHTMLPieceList(FILE* f, int nStep, bool bImages, char* ext);
inline bool IsDrawing()
{
@@ -278,6 +276,7 @@ protected:
char m_strFooter[256];
char m_strHeader[256];
+ GLuint m_nGridList;
unsigned long m_nAutosave;
unsigned long m_nSaveTimer;
char m_strModelsPath[LC_MAXPATH];
@@ -309,35 +308,6 @@ protected:
friend class CCADView;
friend void PrintPiecesThread(void* pv);
friend void Export3DStudio();
-
- // VRML/X3DV export
- void exportVRML97File(char *filename);
- void exportX3DVFile(char *filename);
- void exportVRMLFile(char *filename, int dialect);
- template<class type> void writeVRMLShapes(type color, FILE *stream, int coordinateCounter, Piece* pPiece, unsigned short group, float *pos, bool beginAndEnd);
- void writeVRMLShapeBegin(FILE *stream, unsigned long currentColor, bool blackLines);
- void writeVRMLShapeMeshBegin(FILE *stream);
- void writeVRMLShapeMeshData(FILE *stream);
- void writeVRMLShapeMeshEnd(FILE *stream);
- void writeVRMLShapeEnd(FILE *stream);
- void writeIndent(FILE *stream);
- int indent;
- int numDEF;
- bool VRMLdialect;
- bool firstData;
- int searchForVertex(float *vertex);
- template<class type> void generateMeshData(type* info, float *pos, Piece* pPiece, int numVertices, int currentColor);
- template<class type> void getMinMaxData(type* info, Piece* pPiece, GroupInfo* groupInfo);
- template<class type> void getMinMax(type col, Piece* pPiece, unsigned short group, GroupInfo* groupInfo);
- bool handleAsGroup(Piece* piece, GroupInfo groupInfo);
- int numCoords;
- float *coords;
- int numCoordIndices;
- int *coordIndices;
- float centerOfMass[3];
- int numFaceColors;
- int *faceColors;
- float VRMLScale;
};
#endif // _PROJECT_H_
diff --git a/common/quant.cpp b/common/quant.cpp
index 2191cb3..d2072a3 100644
--- a/common/quant.cpp
+++ b/common/quant.cpp
@@ -217,16 +217,16 @@ static int build_table(unsigned char *image, unsigned long pixels)
return 1;
}
-static void fixheap(unsigned long heapid)
+static void fixheap(unsigned long id)
{
- unsigned char thres_level = heap[heapid].level;
- unsigned long thres_index = heap[heapid].index, index = 0;
+ unsigned char thres_level = heap[id].level;
+ unsigned long thres_index = heap[id].index, index = 0;
unsigned long half_totc = tot_colors >> 1;
unsigned long thres_val = rgb_table[thres_level][thres_index].pixels_in_cube;
- while (heapid <= half_totc)
+ while (id <= half_totc)
{
- index = heapid << 1;
+ index = id << 1;
if (index < (unsigned long)tot_colors)
if (rgb_table[heap[index].level][heap[index].index].pixels_in_cube
@@ -236,12 +236,12 @@ static void fixheap(unsigned long heapid)
if (thres_val <= rgb_table[heap[index].level][heap[index].index].pixels_in_cube)
break;
else {
- heap[heapid] = heap[index];
- heapid = index;
+ heap[id] = heap[index];
+ id = index;
}
}
- heap[heapid].level = thres_level;
- heap[heapid].index = (unsigned short)thres_index;
+ heap[id].level = thres_level;
+ heap[id].index = (unsigned short)thres_index;
}
static void reduce_table(int num_colors)
diff --git a/common/str.cpp b/common/str.cpp
index c28a22c..c176f6e 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -197,6 +197,7 @@ bool String::Match(const String& Expression) const
}
else if (*p == '(')
{
+ const char* Start = p;
int c = 0;
// Skip what's inside the parenthesis.
diff --git a/common/system.h b/common/system.h
index cd79b10..0010bc6 100755
--- a/common/system.h
+++ b/common/system.h
@@ -98,7 +98,7 @@ void SystemUpdateCategories(bool SearchOnly);
void SystemInit();
void SystemFinish();
-int SystemDoMessageBox(const char* prompt, int nMode);
+int SystemDoMessageBox(char* prompt, int nMode);
bool SystemDoDialog(int nMode, void* param);
void SystemDoPopupMenu(int nMenu, int x, int y);
void SystemDoWaitCursor(int nCode);
diff --git a/common/terrain.cpp b/common/terrain.cpp
index 7f6a70d..4e24a93 100644
--- a/common/terrain.cpp
+++ b/common/terrain.cpp
@@ -581,15 +581,6 @@ void Terrain::Render(Camera* pCam, float aspect)
glTranslatef(eye[0], eye[1], 0);
glScalef(pCam->m_zFar, pCam->m_zFar, 1);
- float verts[4][2] =
- {
- { -1, -1 }, { 1, -1 },
- { 1, 1 }, { -1, 1 }
- };
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(2, GL_FLOAT, 0, verts);
-
if (m_nOptions & LC_TERRAIN_TEXTURE)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@@ -604,30 +595,30 @@ float tx, ty;
tx = (tw*eye[0])/(2*pCam->m_zFar);
ty = (th*eye[1])/(2*pCam->m_zFar);
- float coords[4][2] =
- {
- { tx, ty }, { tx+tw, ty },
- { tx+tw, ty+th }, { tx, ty+th }
- };
-
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, coords);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glBegin(GL_QUADS);
+ glTexCoord2f(tx, ty);
+ glVertex2f(-1, -1);
+ glTexCoord2f(tx+tw, ty);
+ glVertex2f(1, -1);
+ glTexCoord2f(tx+tw, ty+th);
+ glVertex2f(1, 1);
+ glTexCoord2f(tx, ty+th);
+ glVertex2f(-1, 1);
+ glEnd();
glDisable(GL_TEXTURE_2D);
}
else
{
- glColor4f(m_fColor[0], m_fColor[1], m_fColor[2], 1.0f);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+ glColor3fv(m_fColor);
+ glBegin(GL_QUADS);
+ glVertex2f(-1, -1);
+ glVertex2f(1, -1);
+ glVertex2f(1, 1);
+ glVertex2f(-1, 1);
+ glEnd();
}
- glDisableClientState(GL_VERTEX_ARRAY);
-
glPopMatrix();
}
else
@@ -635,7 +626,7 @@ ty = (th*eye[1])/(2*pCam->m_zFar);
FindVisiblePatches(pCam, aspect);
int i, j;
- glColor4f(m_fColor[0], m_fColor[1], m_fColor[2], 1.0f);
+ glColor3fv(m_fColor);
glEnableClientState(GL_VERTEX_ARRAY);
if (m_nOptions & LC_TERRAIN_TEXTURE)
diff --git a/common/texfont.cpp b/common/texfont.cpp
index 010f1f5..a5c3b5d 100644
--- a/common/texfont.cpp
+++ b/common/texfont.cpp
@@ -105,37 +105,56 @@ void TexFont::GetStringDimensions(int* cx, int* cy, const char* Text) const
}
}
-void TexFont::PrintText(float Left, float Top, float Z, const char* Text) const
+void TexFont::PrintText(float Left, float Top, float ScaleX, float ScaleY, const char* Text) const
{
- float Height = m_nFontHeight;
-
- float Verts[4][3];
- float Coords[4][2];
+ float Height = m_nFontHeight * ScaleY;
- glEnableClientState(GL_VERTEX_ARRAY);
- glVertexPointer(3, GL_FLOAT, 0, Verts);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glTexCoordPointer(2, GL_FLOAT, 0, Coords);
+ while (*Text != 0)
+ {
+ int ch = *Text;
+ glTexCoord2f(m_Glyphs[ch].left, m_Glyphs[ch].top);
+ glVertex2f(Left, Top);
+ glTexCoord2f(m_Glyphs[ch].left, m_Glyphs[ch].bottom);
+ glVertex2f(Left, Top - Height);
+ glTexCoord2f(m_Glyphs[ch].right, m_Glyphs[ch].bottom);
+ glVertex2f(Left + m_Glyphs[ch].width * ScaleX, Top - Height);
+ glTexCoord2f(m_Glyphs[ch].right, m_Glyphs[ch].top);
+ glVertex2f(Left + m_Glyphs[ch].width * ScaleX, Top);
+
+ Left += m_Glyphs[ch].width * ScaleX;
+ Text++;
+ }
+}
+// Old function, should probably be removed.
+void TexFont::PrintText(float Left, float Top, float Z, const char* Text) const
+{
while (*Text != 0)
{
- int ch = *Text;
-
- Coords[0][0] = m_Glyphs[ch].left; Coords[0][1] = m_Glyphs[ch].top;
- Verts[0][0] = Left; Verts[0][1] = Top; Verts[0][2] = Z;
- Coords[1][0] = m_Glyphs[ch].left; Coords[1][1] = m_Glyphs[ch].bottom;
- Verts[1][0] = Left; Verts[1][1] = Top - Height; Verts[1][2] = Z;
- Coords[2][0] = m_Glyphs[ch].right; Coords[2][1] = m_Glyphs[ch].top;
- Verts[2][0] = Left + m_Glyphs[ch].width; Verts[2][1] = Top; Verts[2][2] = Z;
- Coords[3][0] = m_Glyphs[ch].right; Coords[3][1] = m_Glyphs[ch].bottom;
- Verts[3][0] = Left + m_Glyphs[ch].width; Verts[3][1] = Top - Height; Verts[3][2] = Z;
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+ int ch = *Text;
+ glTexCoord2f(m_Glyphs[ch].left, m_Glyphs[ch].top);
+ glVertex3f(Left, Top, Z);
+ glTexCoord2f(m_Glyphs[ch].left, m_Glyphs[ch].bottom);
+ glVertex3f(Left, Top - m_nFontHeight, Z);
+ glTexCoord2f(m_Glyphs[ch].right, m_Glyphs[ch].bottom);
+ glVertex3f(Left + m_Glyphs[ch].width, Top - m_nFontHeight, Z);
+ glTexCoord2f(m_Glyphs[ch].right, m_Glyphs[ch].top);
+ glVertex3f(Left + m_Glyphs[ch].width, Top, Z);
Left += m_Glyphs[ch].width;
Text++;
}
+}
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+// Temporary function to draw the axis icon text
+void TexFont::PrintCharScaled (float scale, int ch) const
+{
+ glTexCoord2f (m_Glyphs[ch].left, m_Glyphs[ch].top);
+ glVertex2f (-scale * m_Glyphs[ch].width, scale * m_nFontHeight);
+ glTexCoord2f (m_Glyphs[ch].left, m_Glyphs[ch].bottom);
+ glVertex2f (-scale * m_Glyphs[ch].width, -scale * m_nFontHeight);
+ glTexCoord2f (m_Glyphs[ch].right, m_Glyphs[ch].bottom);
+ glVertex2f (scale * m_Glyphs[ch].width, -scale * m_nFontHeight);
+ glTexCoord2f (m_Glyphs[ch].right, m_Glyphs[ch].top);
+ glVertex2f (scale * m_Glyphs[ch].width, scale * m_nFontHeight);
}
diff --git a/common/texfont.h b/common/texfont.h
index 92fd524..e0d4935 100644
--- a/common/texfont.h
+++ b/common/texfont.h
@@ -18,7 +18,9 @@ public:
{ if (m_bLoaded) m_pTexture->MakeCurrent (); }
bool FileLoad(File& file);
- void PrintText(float Left, float Top, float Z, const char* Text) const;
+ void PrintText(float left, float top, float z, const char* text) const;
+ void PrintText(float Left, float Top, float ScaleX, float ScaleY, const char* Text) const;
+ void PrintCharScaled(float scale, int ch) const;
void GetStringDimensions(int* cx, int* cy, const char* Text) const;
protected:
diff --git a/common/texture.cpp b/common/texture.cpp
index 687d360..8c92e67 100644
--- a/common/texture.cpp
+++ b/common/texture.cpp
@@ -186,10 +186,9 @@ bool Texture::LoadFromFile (char* strFilename, bool bFilter)
bool Texture::FinishLoadImage (bool bFilter, void *data)
{
- GLint w, h, level, maxsize;
- GLint i, j, k, pow2;
- GLint components;
- GLint InternalFormat;
+ GLint w, h, level, maxsize;
+ GLint i, j, k, pow2;
+ GLint components;
if (data == NULL || m_nWidth < 1 || m_nHeight < 1)
return false;
@@ -198,6 +197,8 @@ bool Texture::FinishLoadImage (bool bFilter, void *data)
glGenTextures(1, &m_nID);
glBindTexture(GL_TEXTURE_2D, m_nID);
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
// glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
@@ -213,12 +214,6 @@ bool Texture::FinishLoadImage (bool bFilter, void *data)
default: return false;
}
-#if LC_OPENGLES
- InternalFormat = m_nFormat;
-#else
- InternalFormat = components;
-#endif
-
// create an alpha channel for the texture
if (m_nFormat == GL_LUMINANCE_ALPHA)
for (i = m_nWidth*m_nHeight-1; i >= 0; i--)
@@ -250,7 +245,7 @@ bool Texture::FinishLoadImage (bool bFilter, void *data)
data = tmp;
}
- glTexImage2D (GL_TEXTURE_2D, 0, InternalFormat, w, h, 0, m_nFormat, GL_UNSIGNED_BYTE, data);
+ glTexImage2D (GL_TEXTURE_2D, 0, components, w, h, 0, m_nFormat, GL_UNSIGNED_BYTE, data);
if (bFilter)
for (level = 1; ((w != 1) || (h != 1)); level++)
@@ -268,7 +263,7 @@ bool Texture::FinishLoadImage (bool bFilter, void *data)
for (k = 0; k < components; k++)
out[k] = (in[k] + in[k+components] + in[row] + in[row+k+components])>>2;
- glTexImage2D (GL_TEXTURE_2D, level, InternalFormat, w, h, 0, m_nFormat, GL_UNSIGNED_BYTE, data);
+ glTexImage2D (GL_TEXTURE_2D, level, components, w, h, 0, m_nFormat, GL_UNSIGNED_BYTE, data);
}
free (data);
diff --git a/common/tr.cpp b/common/tr.cpp
index cf290d1..d5d5f01 100644
--- a/common/tr.cpp
+++ b/common/tr.cpp
@@ -212,7 +212,6 @@ void TiledRender::BeginTile()
int TiledRender::EndTile()
{
-#ifndef LC_OPENGLES
GLint prevRowLength, prevSkipRows, prevSkipPixels;
// be sure OpenGL rendering is finished
@@ -269,7 +268,58 @@ int TiledRender::EndTile()
}
else
return 1;
-#else
- return 0;
-#endif
}
+
+void TiledRender::RasterPos3f(float x, float y, float z)
+{
+ if (m_CurrentTile < 0)
+ {
+ // not doing tile rendering right now. Let OpenGL do this.
+ glRasterPos3f(x, y, z);
+ }
+ else
+ {
+ GLdouble modelview[16], proj[16];
+ GLint viewport[4];
+ GLdouble winX, winY, winZ;
+
+ // Get modelview, projection and viewport
+ glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
+ glGetDoublev(GL_PROJECTION_MATRIX, proj);
+ viewport[0] = 0;
+ viewport[1] = 0;
+ viewport[2] = m_CurrentTileWidth;
+ viewport[3] = m_CurrentTileHeight;
+
+ // Project object coord to window coordinate
+ if (gluProject(x, y, z, modelview, proj, viewport, &winX, &winY, &winZ))
+ {
+ // set raster pos to window coord (0,0)
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho(0.0, m_CurrentTileWidth,
+ 0.0, m_CurrentTileHeight, 0.0, 1.0);
+ glRasterPos3f(0.0, 0.0, (float)-winZ);
+
+ // Now use empty bitmap to adjust raster position to (winX,winY)
+ {
+ GLubyte bitmap[1] = {0};
+ glBitmap(1, 1, 0.0, 0.0, (float)winX, (float)winY, bitmap);
+ }
+
+ // restore original matrices
+ glPopMatrix(); // proj
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+ }
+ }
+}
+
+
+
+
+
diff --git a/common/tr.h b/common/tr.h
index 82c2f79..f1394c6 100644
--- a/common/tr.h
+++ b/common/tr.h
@@ -36,6 +36,7 @@ public:
void Ortho(double left, double right, double bottom, double top, double zNear, double zFar);
void Frustum(double left, double right, double bottom, double top, double zNear, double zFar);
void Perspective(double fovy, double aspect, double zNear, double zFar );
+ void RasterPos3f(float x, float y, float z);
int Get(TRenum param);
int EndTile();
void BeginTile();
diff --git a/common/typedefs.h b/common/typedefs.h
index 10953ea..ce68b1f 100644
--- a/common/typedefs.h
+++ b/common/typedefs.h
@@ -35,8 +35,6 @@ typedef enum
LC_FILE_HTML,
LC_FILE_POVRAY,
LC_FILE_WAVEFRONT,
- LC_FILE_VRML97,
- LC_FILE_X3DV,
LC_FILE_PROPERTIES,
LC_FILE_TERRAIN,
LC_FILE_LIBRARY,
@@ -141,27 +139,6 @@ typedef enum
LC_EDIT_ACTION_PAN,
LC_EDIT_ACTION_ROTATE_VIEW,
LC_EDIT_ACTION_ROLL,
- LC_LIBDLG_FILE_RESET,
- LC_LIBDLG_FILE_OPEN,
- LC_LIBDLG_FILE_SAVE,
- LC_LIBDLG_FILE_SAVEAS,
- LC_LIBDLG_FILE_PRINTCATALOG,
- LC_LIBDLG_FILE_MERGEUPDATE,
- LC_LIBDLG_FILE_IMPORTPIECE,
- LC_LIBDLG_FILE_RETURN,
- LC_LIBDLG_FILE_CANCEL,
- LC_LIBDLG_CATEGORY_NEW,
- LC_LIBDLG_CATEGORY_REMOVE,
- LC_LIBDLG_CATEGORY_EDIT,
- LC_LIBDLG_CATEGORY_RESET,
- LC_LIBDLG_GROUP_INSERT,
- LC_LIBDLG_GROUP_DELETE,
- LC_LIBDLG_GROUP_EDIT,
- LC_LIBDLG_GROUP_MOVEUP,
- LC_LIBDLG_GROUP_MOVEDOWN,
- LC_LIBDLG_PIECE_NEW,
- LC_LIBDLG_PIECE_EDIT,
- LC_LIBDLG_PIECE_DELETE,
} LC_COMMANDS;
typedef enum
@@ -316,8 +293,6 @@ typedef enum {
LC_DLG_HTML,
LC_DLG_POVRAY,
LC_DLG_WAVEFRONT,
- LC_DLG_VRML97,
- LC_DLG_X3DV,
LC_DLG_MINIFIG,
LC_DLG_ARRAY,
LC_DLG_PREFERENCES,
diff --git a/config.mk b/config.mk
index a2665c8..ea5e3c8 100644
--- a/config.mk
+++ b/config.mk
@@ -161,10 +161,10 @@ config:
### Determine variable sizes
@echo -n "checking size of char... "; \
echo "#include <stdio.h>" > conftest.c; \
- echo "int main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
- echo "if (!f) return (1); fprintf(f, \"%d\\\n\", sizeof(char)); return (0); }" >> conftest.c; \
- if { (eval $(CC) conftest.c -o conftest) ; } && \
- (test -s conftest && (./conftest; exit) ); then \
+ echo "main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
+ echo "if (!f) exit(1); fprintf(f, \"%d\\n\", sizeof(char)); exit(0); }" >> conftest.c; \
+ if { (eval $(CC) conftest.c -o conftest) 2> /dev/null; } && \
+ (test -s conftest && (./conftest; exit) 2> /dev/null); then \
ac_cv_sizeof_char=`cat conftestval`; \
echo "$$ac_cv_sizeof_char"; \
else \
@@ -176,10 +176,10 @@ config:
\
echo -n "checking size of short... "; \
echo "#include <stdio.h>" > conftest.c; \
- echo "int main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
- echo "if (!f) return (1); fprintf(f, \"%d\\\n\", sizeof(short)); return (0); }" >> conftest.c; \
- if { (eval $(CC) conftest.c -o conftest) ; } && \
- (test -s conftest && (./conftest; exit) ); then \
+ echo "main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
+ echo "if (!f) exit(1); fprintf(f, \"%d\\n\", sizeof(short)); exit(0); }" >> conftest.c; \
+ if { (eval $(CC) conftest.c -o conftest) 2> /dev/null; } && \
+ (test -s conftest && (./conftest; exit) 2> /dev/null); then \
ac_cv_sizeof_short=`cat conftestval`; \
echo "$$ac_cv_sizeof_short"; \
else \
@@ -191,10 +191,10 @@ config:
\
echo -n "checking size of long... "; \
echo "#include <stdio.h>" > conftest.c; \
- echo "int main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
- echo "if (!f) return (1); fprintf(f, \"%d\\\n\", sizeof(long)); return (0); }" >> conftest.c; \
- if { (eval $(CC) conftest.c -o conftest) ; } && \
- (test -s conftest && (./conftest; exit) ); then \
+ echo "main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
+ echo "if (!f) exit(1); fprintf(f, \"%d\\n\", sizeof(long)); exit(0); }" >> conftest.c; \
+ if { (eval $(CC) conftest.c -o conftest) 2> /dev/null; } && \
+ (test -s conftest && (./conftest; exit) 2> /dev/null); then \
ac_cv_sizeof_long=`cat conftestval`; \
echo "$$ac_cv_sizeof_long"; \
else \
@@ -206,10 +206,10 @@ config:
\
echo -n "checking size of int... "; \
echo "#include <stdio.h>" > conftest.c; \
- echo "int main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
- echo "if (!f) return (1); fprintf(f, \"%d\\\n\", sizeof(int)); return (0); }" >> conftest.c; \
- if { (eval $(CC) conftest.c -o conftest) ; } && \
- (test -s conftest && (./conftest; exit) ); then \
+ echo "main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
+ echo "if (!f) exit(1); fprintf(f, \"%d\\n\", sizeof(int)); exit(0); }" >> conftest.c; \
+ if { (eval $(CC) conftest.c -o conftest) 2> /dev/null; } && \
+ (test -s conftest && (./conftest; exit) 2> /dev/null); then \
ac_cv_sizeof_int=`cat conftestval`; \
echo "$$ac_cv_sizeof_int"; \
else \
@@ -221,10 +221,10 @@ config:
\
echo -n "checking size of void *... "; \
echo "#include <stdio.h>" > conftest.c; \
- echo "int main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
- echo "if (!f) return (1); fprintf(f, \"%d\\\n\", sizeof(void *)); return (0); }" >> conftest.c; \
- if { (eval $(CC) conftest.c -o conftest) ; } && \
- (test -s conftest && (./conftest; exit) ); then \
+ echo "main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
+ echo "if (!f) exit(1); fprintf(f, \"%d\\n\", sizeof(void *)); exit(0); }" >> conftest.c; \
+ if { (eval $(CC) conftest.c -o conftest) 2> /dev/null; } && \
+ (test -s conftest && (./conftest; exit) 2> /dev/null); then \
ac_cv_sizeof_void_p=`cat conftestval`; \
echo "$$ac_cv_sizeof_void_p"; \
else \
@@ -236,10 +236,10 @@ config:
\
echo -n "checking size of long long... "; \
echo "#include <stdio.h>" > conftest.c; \
- echo "int main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
- echo "if (!f) return (1); fprintf(f, \"%d\\\n\", sizeof(long long)); return (0); }" >> conftest.c; \
- if { (eval $(CC) conftest.c -o conftest) ; } && \
- (test -s conftest && (./conftest; exit) ); then \
+ echo "main() { FILE *f=fopen(\"conftestval\", \"w\");" >> conftest.c; \
+ echo "if (!f) exit(1); fprintf(f, \"%d\\n\", sizeof(long long)); exit(0); }" >> conftest.c; \
+ if { (eval $(CC) conftest.c -o conftest) 2> /dev/null; } && \
+ (test -s conftest && (./conftest; exit) 2> /dev/null); then \
ac_cv_sizeof_long_long=`cat conftestval`; \
echo "$$ac_cv_sizeof_long_long"; \
else \
@@ -276,10 +276,10 @@ config:
### Check if machine is little or big endian
@echo -n "Determining endianess... "
- @echo "int main () { union { long l; char c[sizeof (long)]; } u;" > endiantest.c
- @echo "u.l = 1; return (u.c[sizeof (long) - 1] == 1); }" >> endiantest.c
- @if { (eval $(CC) endiantest.c -o endiantest) ; } && \
- (test -s endiantest && (./endiantest; exit) ); then \
+ @echo "main () { union { long l; char c[sizeof (long)]; } u;" > endiantest.c
+ @echo "u.l = 1; exit (u.c[sizeof (long) - 1] == 1); }" >> endiantest.c
+ @if { (eval $(CC) endiantest.c -o endiantest) 2> /dev/null; } && \
+ (test -s endiantest && (./endiantest; exit) 2> /dev/null); then \
echo "little endian"; \
echo "#define LC_LITTLE_ENDIAN" >> $(OSDIR)/config.h; \
echo "#define LCUINT16(val) val" >> $(OSDIR)/config.h; \
@@ -328,7 +328,7 @@ endif
@echo -n "Checking for jpeg support... "
@echo "char jpeg_read_header();" > jpegtest.c
@echo "int main() { jpeg_read_header(); return 0; }" >> jpegtest.c
- @if { (eval $(CC) jpegtest.c -ljpeg -o jpegtest $(CPPFLAGS) $(LDFLAGS)) ; } && \
+ @if { (eval $(CC) jpegtest.c -ljpeg -o jpegtest $(CPPFLAGS) $(LDFLAGS)) 2> /dev/null; } && \
(test -s jpegtest); then \
echo "ok"; \
echo "HAVE_JPEGLIB = yes" >> $(OSDIR)/config.mk; \
@@ -344,7 +344,7 @@ endif
@echo -n "Checking for zlib support... "
@echo "char gzread();" > ztest.c
@echo "int main() { gzread(); return 0; }" >> ztest.c
- @if { (eval $(CC) ztest.c -lz -o ztest $(CPPFLAGS) $(LDFLAGS)) ; } && \
+ @if { (eval $(CC) ztest.c -lz -o ztest $(CPPFLAGS) $(LDFLAGS)) 2> /dev/null; } && \
(test -s ztest); then \
echo "ok"; \
echo "HAVE_ZLIB = yes" >> $(OSDIR)/config.mk; \
@@ -360,7 +360,7 @@ endif
@echo -n "Checking for png support... "
@echo "char png_read_info();" > pngtest.c
@echo "int main() { png_read_info(); return 0; }" >> pngtest.c
- @if { (eval $(CC) pngtest.c -lm -lz -lpng -o pngtest $(CPPFLAGS) $(LDFLAGS)) ; } && \
+ @if { (eval $(CC) pngtest.c -lm -lz -lpng -o pngtest $(CPPFLAGS) $(LDFLAGS)) 2> /dev/null; } && \
(test -s pngtest); then \
echo "ok"; \
echo "HAVE_PNGLIB = yes" >> $(OSDIR)/config.mk; \
diff --git a/description-pak b/description-pak
new file mode 100644
index 0000000..9769524
--- /dev/null
+++ b/description-pak
@@ -0,0 +1,5 @@
+LeoCAD is a CAD program that allows people to build virtual models using
+bricks similar to those found in LEGO toys. It's available for free under
+the GNU Public License, and works on the Windows and Linux Operating
+Systems.
+
diff --git a/iphone/Classes/EAGLView.h b/iphone/Classes/EAGLView.h
deleted file mode 100644
index fe55371..0000000
--- a/iphone/Classes/EAGLView.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// EAGLView.h
-// LeoCAD
-//
-// Created by Leo on 2/19/09.
-// Copyright __MyCompanyName__ 2009. All rights reserved.
-//
-
-
-#import <UIKit/UIKit.h>
-#import <OpenGLES/EAGL.h>
-#import <OpenGLES/ES1/gl.h>
-#import <OpenGLES/ES1/glext.h>
-
-class View;
-
-/*
-This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
-The view content is basically an EAGL surface you render your OpenGL scene into.
-Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
-*/
-@interface EAGLView : UIView {
-
-@private
- /* The pixel dimensions of the backbuffer */
- GLint backingWidth;
- GLint backingHeight;
-
- EAGLContext *context;
-
- /* OpenGL names for the renderbuffer and framebuffers used to render to this view */
- GLuint viewRenderbuffer, viewFramebuffer;
-
- /* OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist) */
- GLuint depthRenderbuffer;
-
- NSTimer *animationTimer;
- NSTimeInterval animationInterval;
-
- View* view;
-}
-
-@property NSTimeInterval animationInterval;
-
-- (void)startAnimation;
-- (void)stopAnimation;
-- (void)drawView;
-
-- (void)MakeCurrent;
-- (void)SwapBuffers;
-
-@end
diff --git a/iphone/Classes/EAGLView.m b/iphone/Classes/EAGLView.m
deleted file mode 100644
index 8b45796..0000000
--- a/iphone/Classes/EAGLView.m
+++ /dev/null
@@ -1,182 +0,0 @@
-#import <QuartzCore/QuartzCore.h>
-#import <OpenGLES/EAGLDrawable.h>
-#import "EAGLView.h"
-#include "config.h"
-#include "globals.h"
-#include "view.h"
-#include "lc_application.h"
-
-#define USE_DEPTH_BUFFER 1
-
-// A class extension to declare private methods
-@interface EAGLView ()
-
-@property (nonatomic, retain) EAGLContext *context;
-@property (nonatomic, assign) NSTimer *animationTimer;
-
-- (BOOL) createFramebuffer;
-- (void) destroyFramebuffer;
-
-@end
-
-
-@implementation EAGLView
-
-@synthesize context;
-@synthesize animationTimer;
-@synthesize animationInterval;
-
-
-// You must implement this method
-+ (Class)layerClass
-{
- return [CAEAGLLayer class];
-}
-
-//The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:
-- (id)initWithCoder:(NSCoder*)coder
-{
- if ((self = [super initWithCoder:coder])) {
- // Get the layer
- CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
-
- eaglLayer.opaque = YES;
- eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
-
- context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
-
- if (!context || ![EAGLContext setCurrentContext:context]) {
- [self release];
- return nil;
- }
-
- animationInterval = 1.0 / 60.0;
- }
-
- view = new View(lcGetActiveProject(), NULL);
- view->Create(self);
-
- return self;
-}
-
-- (void)drawView
-{
- [EAGLContext setCurrentContext:context];
-
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
-
- glViewport(0, 0, backingWidth, backingHeight);
- view->OnSize(backingWidth, backingHeight);
-
- view->OnDraw();
-
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
- [context presentRenderbuffer:GL_RENDERBUFFER_OES];
-}
-
-- (void)layoutSubviews
-{
- [EAGLContext setCurrentContext:context];
- [self destroyFramebuffer];
- [self createFramebuffer];
- [self drawView];
-}
-
-
-- (BOOL)createFramebuffer
-{
- glGenFramebuffersOES(1, &viewFramebuffer);
- glGenRenderbuffersOES(1, &viewRenderbuffer);
-
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
- [context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
- glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);
-
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
- if (USE_DEPTH_BUFFER) {
- glGenRenderbuffersOES(1, &depthRenderbuffer);
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
- glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
- glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
- }
-
- if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
- NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
- return NO;
- }
-
- return YES;
-}
-
-
-- (void)destroyFramebuffer {
-
- glDeleteFramebuffersOES(1, &viewFramebuffer);
- viewFramebuffer = 0;
- glDeleteRenderbuffersOES(1, &viewRenderbuffer);
- viewRenderbuffer = 0;
-
- if(depthRenderbuffer) {
- glDeleteRenderbuffersOES(1, &depthRenderbuffer);
- depthRenderbuffer = 0;
- }
-}
-
-
-- (void)startAnimation {
-// self.animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];
-}
-
-
-- (void)stopAnimation {
- self.animationTimer = nil;
-}
-
-- (void)setAnimationTimer:(NSTimer *)newTimer
-{
- [animationTimer invalidate];
- animationTimer = newTimer;
-}
-
-- (void)setAnimationInterval:(NSTimeInterval)interval
-{
-
- animationInterval = interval;
- if (animationTimer) {
- [self stopAnimation];
- [self startAnimation];
- }
-}
-
-- (void)dealloc
-{
- delete view;
- view = NULL;
-
- [self stopAnimation];
-
- if ([EAGLContext currentContext] == context) {
- [EAGLContext setCurrentContext:nil];
- }
-
- [context release];
- [super dealloc];
-}
-
-- (void)MakeCurrent
-{
- [EAGLContext setCurrentContext:context];
- glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
-}
-
-- (void)SwapBuffers
-{
- glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
- [context presentRenderbuffer:GL_RENDERBUFFER_OES];
-}
-
-@end
diff --git a/iphone/Classes/LeoCADAppDelegate.h b/iphone/Classes/LeoCADAppDelegate.h
deleted file mode 100644
index a0ab245..0000000
--- a/iphone/Classes/LeoCADAppDelegate.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// LeoCADAppDelegate.h
-// LeoCAD
-//
-// Created by Leo on 2/19/09.
-// Copyright __MyCompanyName__ 2009. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class EAGLView;
-
-@interface LeoCADAppDelegate : NSObject <UIApplicationDelegate> {
- UIWindow *window;
- EAGLView *glView;
-}
-
-@property (nonatomic, retain) IBOutlet UIWindow *window;
-@property (nonatomic, retain) IBOutlet EAGLView *glView;
-
-@end
-
diff --git a/iphone/Classes/LeoCADAppDelegate.m b/iphone/Classes/LeoCADAppDelegate.m
deleted file mode 100644
index 3b9be7c..0000000
--- a/iphone/Classes/LeoCADAppDelegate.m
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// LeoCADAppDelegate.m
-// LeoCAD
-//
-// Created by Leo on 2/19/09.
-// Copyright __MyCompanyName__ 2009. All rights reserved.
-//
-
-#import "LeoCADAppDelegate.h"
-#import "EAGLView.h"
-
-@implementation LeoCADAppDelegate
-
-@synthesize window;
-@synthesize glView;
-
-- (void)applicationDidFinishLaunching:(UIApplication *)application {
-
- glView.animationInterval = 1.0 / 60.0;
- [glView startAnimation];
-}
-
-
-- (void)applicationWillResignActive:(UIApplication *)application {
- glView.animationInterval = 1.0 / 5.0;
-}
-
-
-- (void)applicationDidBecomeActive:(UIApplication *)application {
- glView.animationInterval = 1.0 / 60.0;
-}
-
-
-- (void)dealloc {
- [window release];
- [glView release];
- [super dealloc];
-}
-
-@end
diff --git a/iphone/Icon.png b/iphone/Icon.png
deleted file mode 100755
index 033ad2d..0000000
--- a/iphone/Icon.png
+++ /dev/null
Binary files differ
diff --git a/iphone/Info.plist b/iphone/Info.plist
deleted file mode 100644
index c012f84..0000000
--- a/iphone/Info.plist
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleDisplayName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>${PRODUCT_NAME}</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>LSRequiresIPhoneOS</key>
- <true/>
- <key>NSMainNibFile</key>
- <string>MainWindow</string>
- <key>UIStatusBarHidden</key>
- <true/>
-</dict>
-</plist>
diff --git a/iphone/LeoCAD.xcodeproj/project.pbxproj b/iphone/LeoCAD.xcodeproj/project.pbxproj
deleted file mode 100755
index 2bebed4..0000000
--- a/iphone/LeoCAD.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,522 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 45;
- objects = {
-
-/* Begin PBXBuildFile section */
- 1D3623260D0F684500981E51 /* LeoCADAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* LeoCADAppDelegate.m */; };
- 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
- 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
- 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
- 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
- 28FD14FE0DC6FC130079059D /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 28FD14FD0DC6FC130079059D /* EAGLView.m */; };
- 28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD14FF0DC6FC520079059D /* OpenGLES.framework */; };
- 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 28FD15070DC6FC5B0079059D /* QuartzCore.framework */; };
- B37BC4730F4E06FA00C208E5 /* algebra.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4280F4E06FA00C208E5 /* algebra.cpp */; };
- B37BC4750F4E06FA00C208E5 /* camera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC42D0F4E06FA00C208E5 /* camera.cpp */; };
- B37BC4760F4E06FA00C208E5 /* console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC42F0F4E06FA00C208E5 /* console.cpp */; };
- B37BC4770F4E06FA00C208E5 /* curve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4310F4E06FA00C208E5 /* curve.cpp */; };
- B37BC4780F4E06FA00C208E5 /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4330F4E06FA00C208E5 /* debug.cpp */; };
- B37BC4790F4E06FA00C208E5 /* file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4360F4E06FA00C208E5 /* file.cpp */; };
- B37BC47A0F4E06FA00C208E5 /* globals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4380F4E06FA00C208E5 /* globals.cpp */; };
- B37BC47B0F4E06FA00C208E5 /* group.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC43B0F4E06FA00C208E5 /* group.cpp */; };
- B37BC47C0F4E06FA00C208E5 /* im_bmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC43D0F4E06FA00C208E5 /* im_bmp.cpp */; };
- B37BC47D0F4E06FA00C208E5 /* im_gif.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC43E0F4E06FA00C208E5 /* im_gif.cpp */; };
- B37BC47E0F4E06FA00C208E5 /* im_jpg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC43F0F4E06FA00C208E5 /* im_jpg.cpp */; };
- B37BC47F0F4E06FA00C208E5 /* im_png.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4400F4E06FA00C208E5 /* im_png.cpp */; };
- B37BC4800F4E06FA00C208E5 /* image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4410F4E06FA00C208E5 /* image.cpp */; };
- B37BC4810F4E06FA00C208E5 /* keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4430F4E06FA00C208E5 /* keyboard.cpp */; };
- B37BC4820F4E06FA00C208E5 /* lc_application.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4450F4E06FA00C208E5 /* lc_application.cpp */; };
- B37BC4830F4E06FA00C208E5 /* library.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4470F4E06FA00C208E5 /* library.cpp */; };
- B37BC4840F4E06FA00C208E5 /* light.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4490F4E06FA00C208E5 /* light.cpp */; };
- B37BC4850F4E06FA00C208E5 /* mainwnd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC44B0F4E06FA00C208E5 /* mainwnd.cpp */; };
- B37BC4870F4E06FA00C208E5 /* matrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC44E0F4E06FA00C208E5 /* matrix.cpp */; };
- B37BC4880F4E06FA00C208E5 /* message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4500F4E06FA00C208E5 /* message.cpp */; };
- B37BC4890F4E06FA00C208E5 /* minifig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4520F4E06FA00C208E5 /* minifig.cpp */; };
- B37BC48B0F4E06FA00C208E5 /* object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4550F4E06FA00C208E5 /* object.cpp */; };
- B37BC48C0F4E06FA00C208E5 /* opengl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4570F4E06FA00C208E5 /* opengl.cpp */; };
- B37BC48D0F4E06FA00C208E5 /* piece.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4590F4E06FA00C208E5 /* piece.cpp */; };
- B37BC48E0F4E06FA00C208E5 /* pieceinf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC45B0F4E06FA00C208E5 /* pieceinf.cpp */; };
- B37BC48F0F4E06FA00C208E5 /* preview.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC45D0F4E06FA00C208E5 /* preview.cpp */; };
- B37BC4900F4E06FA00C208E5 /* project.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC45F0F4E06FA00C208E5 /* project.cpp */; };
- B37BC4910F4E06FA00C208E5 /* quant.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4610F4E06FA00C208E5 /* quant.cpp */; };
- B37BC4920F4E06FA00C208E5 /* str.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4630F4E06FA00C208E5 /* str.cpp */; };
- B37BC4930F4E06FA00C208E5 /* terrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4660F4E06FA00C208E5 /* terrain.cpp */; };
- B37BC4940F4E06FA00C208E5 /* texfont.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4680F4E06FA00C208E5 /* texfont.cpp */; };
- B37BC4950F4E06FA00C208E5 /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC46A0F4E06FA00C208E5 /* texture.cpp */; };
- B37BC4960F4E06FA00C208E5 /* tr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC46C0F4E06FA00C208E5 /* tr.cpp */; };
- B37BC4970F4E06FA00C208E5 /* vector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC46F0F4E06FA00C208E5 /* vector.cpp */; };
- B37BC4980F4E06FA00C208E5 /* view.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B37BC4710F4E06FA00C208E5 /* view.cpp */; };
- B38CAC890F76170E006495F1 /* basewnd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38CAC880F76170E006495F1 /* basewnd.cpp */; };
- B38CAC8E0F76184D006495F1 /* system.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38CAC8D0F76184D006495F1 /* system.cpp */; };
- B38CAC9A0F761A53006495F1 /* glwindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B38CAC990F761A53006495F1 /* glwindow.cpp */; };
- B38CAD2C0F76268E006495F1 /* pieces.bin in Resources */ = {isa = PBXBuildFile; fileRef = B38CAD270F76268E006495F1 /* pieces.bin */; };
- B38CAD2D0F76268E006495F1 /* pieces.idx in Resources */ = {isa = PBXBuildFile; fileRef = B38CAD280F76268E006495F1 /* pieces.idx */; };
- B38CAD2E0F76268E006495F1 /* sysfont.txf in Resources */ = {isa = PBXBuildFile; fileRef = B38CAD290F76268E006495F1 /* sysfont.txf */; };
- B38CAD2F0F76268E006495F1 /* textures.bin in Resources */ = {isa = PBXBuildFile; fileRef = B38CAD2A0F76268E006495F1 /* textures.bin */; };
- B38CAD300F76268E006495F1 /* textures.idx in Resources */ = {isa = PBXBuildFile; fileRef = B38CAD2B0F76268E006495F1 /* textures.idx */; };
- B3F5CF190F76F98900C9D249 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B3F5CF180F76F98900C9D249 /* Icon.png */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
- 1D3623240D0F684500981E51 /* LeoCADAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeoCADAppDelegate.h; sourceTree = "<group>"; };
- 1D3623250D0F684500981E51 /* LeoCADAppDelegate.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = LeoCADAppDelegate.m; sourceTree = "<group>"; };
- 1D6058910D05DD3D006BFB54 /* LeoCAD.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LeoCAD.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
- 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
- 28FD14FC0DC6FC130079059D /* EAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
- 28FD14FD0DC6FC130079059D /* EAGLView.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = EAGLView.m; sourceTree = "<group>"; };
- 28FD14FF0DC6FC520079059D /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
- 28FD15070DC6FC5B0079059D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
- 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = main.m; sourceTree = "<group>"; };
- 32CA4F630368D1EE00C91783 /* LeoCAD_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeoCAD_Prefix.pch; sourceTree = "<group>"; };
- 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- B37BC4280F4E06FA00C208E5 /* algebra.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = algebra.cpp; path = ../common/algebra.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4290F4E06FA00C208E5 /* algebra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = algebra.h; path = ../common/algebra.h; sourceTree = SOURCE_ROOT; };
- B37BC42A0F4E06FA00C208E5 /* array.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = array.cpp; path = ../common/array.cpp; sourceTree = SOURCE_ROOT; };
- B37BC42B0F4E06FA00C208E5 /* array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = array.h; path = ../common/array.h; sourceTree = SOURCE_ROOT; };
- B37BC42C0F4E06FA00C208E5 /* basewnd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = basewnd.h; path = ../common/basewnd.h; sourceTree = SOURCE_ROOT; };
- B37BC42D0F4E06FA00C208E5 /* camera.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = camera.cpp; path = ../common/camera.cpp; sourceTree = SOURCE_ROOT; };
- B37BC42E0F4E06FA00C208E5 /* camera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = camera.h; path = ../common/camera.h; sourceTree = SOURCE_ROOT; };
- B37BC42F0F4E06FA00C208E5 /* console.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = console.cpp; path = ../common/console.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4300F4E06FA00C208E5 /* console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = console.h; path = ../common/console.h; sourceTree = SOURCE_ROOT; };
- B37BC4310F4E06FA00C208E5 /* curve.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = curve.cpp; path = ../common/curve.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4320F4E06FA00C208E5 /* curve.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = curve.h; path = ../common/curve.h; sourceTree = SOURCE_ROOT; };
- B37BC4330F4E06FA00C208E5 /* debug.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = debug.cpp; path = ../common/debug.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4340F4E06FA00C208E5 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../common/debug.h; sourceTree = SOURCE_ROOT; };
- B37BC4350F4E06FA00C208E5 /* defines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = defines.h; path = ../common/defines.h; sourceTree = SOURCE_ROOT; };
- B37BC4360F4E06FA00C208E5 /* file.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = file.cpp; path = ../common/file.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4370F4E06FA00C208E5 /* file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = file.h; path = ../common/file.h; sourceTree = SOURCE_ROOT; };
- B37BC4380F4E06FA00C208E5 /* globals.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = globals.cpp; path = ../common/globals.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4390F4E06FA00C208E5 /* globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = globals.h; path = ../common/globals.h; sourceTree = SOURCE_ROOT; };
- B37BC43A0F4E06FA00C208E5 /* glwindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glwindow.h; path = ../common/glwindow.h; sourceTree = SOURCE_ROOT; };
- B37BC43B0F4E06FA00C208E5 /* group.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = group.cpp; path = ../common/group.cpp; sourceTree = SOURCE_ROOT; };
- B37BC43C0F4E06FA00C208E5 /* group.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = group.h; path = ../common/group.h; sourceTree = SOURCE_ROOT; };
- B37BC43D0F4E06FA00C208E5 /* im_bmp.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = im_bmp.cpp; path = ../common/im_bmp.cpp; sourceTree = SOURCE_ROOT; };
- B37BC43E0F4E06FA00C208E5 /* im_gif.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = im_gif.cpp; path = ../common/im_gif.cpp; sourceTree = SOURCE_ROOT; };
- B37BC43F0F4E06FA00C208E5 /* im_jpg.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = im_jpg.cpp; path = ../common/im_jpg.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4400F4E06FA00C208E5 /* im_png.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = im_png.cpp; path = ../common/im_png.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4410F4E06FA00C208E5 /* image.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = image.cpp; path = ../common/image.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4420F4E06FA00C208E5 /* image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = image.h; path = ../common/image.h; sourceTree = SOURCE_ROOT; };
- B37BC4430F4E06FA00C208E5 /* keyboard.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = keyboard.cpp; path = ../common/keyboard.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4440F4E06FA00C208E5 /* keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = keyboard.h; path = ../common/keyboard.h; sourceTree = SOURCE_ROOT; };
- B37BC4450F4E06FA00C208E5 /* lc_application.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = lc_application.cpp; path = ../common/lc_application.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4460F4E06FA00C208E5 /* lc_application.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lc_application.h; path = ../common/lc_application.h; sourceTree = SOURCE_ROOT; };
- B37BC4470F4E06FA00C208E5 /* library.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = library.cpp; path = ../common/library.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4480F4E06FA00C208E5 /* library.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = library.h; path = ../common/library.h; sourceTree = SOURCE_ROOT; };
- B37BC4490F4E06FA00C208E5 /* light.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = light.cpp; path = ../common/light.cpp; sourceTree = SOURCE_ROOT; };
- B37BC44A0F4E06FA00C208E5 /* light.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = light.h; path = ../common/light.h; sourceTree = SOURCE_ROOT; };
- B37BC44B0F4E06FA00C208E5 /* mainwnd.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = mainwnd.cpp; path = ../common/mainwnd.cpp; sourceTree = SOURCE_ROOT; };
- B37BC44C0F4E06FA00C208E5 /* mainwnd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mainwnd.h; path = ../common/mainwnd.h; sourceTree = SOURCE_ROOT; };
- B37BC44E0F4E06FA00C208E5 /* matrix.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = matrix.cpp; path = ../common/matrix.cpp; sourceTree = SOURCE_ROOT; };
- B37BC44F0F4E06FA00C208E5 /* matrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = matrix.h; path = ../common/matrix.h; sourceTree = SOURCE_ROOT; };
- B37BC4500F4E06FA00C208E5 /* message.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = message.cpp; path = ../common/message.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4510F4E06FA00C208E5 /* message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = message.h; path = ../common/message.h; sourceTree = SOURCE_ROOT; };
- B37BC4520F4E06FA00C208E5 /* minifig.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = minifig.cpp; path = ../common/minifig.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4530F4E06FA00C208E5 /* minifig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = minifig.h; path = ../common/minifig.h; sourceTree = SOURCE_ROOT; };
- B37BC4550F4E06FA00C208E5 /* object.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = object.cpp; path = ../common/object.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4560F4E06FA00C208E5 /* object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = object.h; path = ../common/object.h; sourceTree = SOURCE_ROOT; };
- B37BC4570F4E06FA00C208E5 /* opengl.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = opengl.cpp; path = ../common/opengl.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4580F4E06FA00C208E5 /* opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = opengl.h; path = ../common/opengl.h; sourceTree = SOURCE_ROOT; };
- B37BC4590F4E06FA00C208E5 /* piece.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = piece.cpp; path = ../common/piece.cpp; sourceTree = SOURCE_ROOT; };
- B37BC45A0F4E06FA00C208E5 /* piece.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = piece.h; path = ../common/piece.h; sourceTree = SOURCE_ROOT; };
- B37BC45B0F4E06FA00C208E5 /* pieceinf.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = pieceinf.cpp; path = ../common/pieceinf.cpp; sourceTree = SOURCE_ROOT; };
- B37BC45C0F4E06FA00C208E5 /* pieceinf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pieceinf.h; path = ../common/pieceinf.h; sourceTree = SOURCE_ROOT; };
- B37BC45D0F4E06FA00C208E5 /* preview.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = preview.cpp; path = ../common/preview.cpp; sourceTree = SOURCE_ROOT; };
- B37BC45E0F4E06FA00C208E5 /* preview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = preview.h; path = ../common/preview.h; sourceTree = SOURCE_ROOT; };
- B37BC45F0F4E06FA00C208E5 /* project.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = project.cpp; path = ../common/project.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4600F4E06FA00C208E5 /* project.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = project.h; path = ../common/project.h; sourceTree = SOURCE_ROOT; };
- B37BC4610F4E06FA00C208E5 /* quant.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = quant.cpp; path = ../common/quant.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4620F4E06FA00C208E5 /* quant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = quant.h; path = ../common/quant.h; sourceTree = SOURCE_ROOT; };
- B37BC4630F4E06FA00C208E5 /* str.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = str.cpp; path = ../common/str.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4640F4E06FA00C208E5 /* str.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = str.h; path = ../common/str.h; sourceTree = SOURCE_ROOT; };
- B37BC4650F4E06FA00C208E5 /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = system.h; path = ../common/system.h; sourceTree = SOURCE_ROOT; };
- B37BC4660F4E06FA00C208E5 /* terrain.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = terrain.cpp; path = ../common/terrain.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4670F4E06FA00C208E5 /* terrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = terrain.h; path = ../common/terrain.h; sourceTree = SOURCE_ROOT; };
- B37BC4680F4E06FA00C208E5 /* texfont.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = texfont.cpp; path = ../common/texfont.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4690F4E06FA00C208E5 /* texfont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = texfont.h; path = ../common/texfont.h; sourceTree = SOURCE_ROOT; };
- B37BC46A0F4E06FA00C208E5 /* texture.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = texture.cpp; path = ../common/texture.cpp; sourceTree = SOURCE_ROOT; };
- B37BC46B0F4E06FA00C208E5 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = texture.h; path = ../common/texture.h; sourceTree = SOURCE_ROOT; };
- B37BC46C0F4E06FA00C208E5 /* tr.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = tr.cpp; path = ../common/tr.cpp; sourceTree = SOURCE_ROOT; };
- B37BC46D0F4E06FA00C208E5 /* tr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tr.h; path = ../common/tr.h; sourceTree = SOURCE_ROOT; };
- B37BC46E0F4E06FA00C208E5 /* typedefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = typedefs.h; path = ../common/typedefs.h; sourceTree = SOURCE_ROOT; };
- B37BC46F0F4E06FA00C208E5 /* vector.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = vector.cpp; path = ../common/vector.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4700F4E06FA00C208E5 /* vector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vector.h; path = ../common/vector.h; sourceTree = SOURCE_ROOT; };
- B37BC4710F4E06FA00C208E5 /* view.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = view.cpp; path = ../common/view.cpp; sourceTree = SOURCE_ROOT; };
- B37BC4720F4E06FA00C208E5 /* view.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = view.h; path = ../common/view.h; sourceTree = SOURCE_ROOT; };
- B37BC4D30F4E0A2500C208E5 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
- B38CAC880F76170E006495F1 /* basewnd.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = basewnd.cpp; sourceTree = "<group>"; };
- B38CAC8D0F76184D006495F1 /* system.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = system.cpp; sourceTree = "<group>"; };
- B38CAC990F761A53006495F1 /* glwindow.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = glwindow.cpp; sourceTree = "<group>"; };
- B38CAD270F76268E006495F1 /* pieces.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = pieces.bin; sourceTree = "<group>"; };
- B38CAD280F76268E006495F1 /* pieces.idx */ = {isa = PBXFileReference; lastKnownFileType = file; path = pieces.idx; sourceTree = "<group>"; };
- B38CAD290F76268E006495F1 /* sysfont.txf */ = {isa = PBXFileReference; lastKnownFileType = file; path = sysfont.txf; sourceTree = "<group>"; };
- B38CAD2A0F76268E006495F1 /* textures.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; path = textures.bin; sourceTree = "<group>"; };
- B38CAD2B0F76268E006495F1 /* textures.idx */ = {isa = PBXFileReference; lastKnownFileType = file; path = textures.idx; sourceTree = "<group>"; };
- B3F5CF180F76F98900C9D249 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
- 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
- 28FD15000DC6FC520079059D /* OpenGLES.framework in Frameworks */,
- 28FD15080DC6FC5B0079059D /* QuartzCore.framework in Frameworks */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 080E96DDFE201D6D7F000001 /* Classes */ = {
- isa = PBXGroup;
- children = (
- 28FD14FC0DC6FC130079059D /* EAGLView.h */,
- 28FD14FD0DC6FC130079059D /* EAGLView.m */,
- 1D3623240D0F684500981E51 /* LeoCADAppDelegate.h */,
- 1D3623250D0F684500981E51 /* LeoCADAppDelegate.m */,
- );
- path = Classes;
- sourceTree = "<group>";
- };
- 19C28FACFE9D520D11CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- 1D6058910D05DD3D006BFB54 /* LeoCAD.app */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
- isa = PBXGroup;
- children = (
- B37BC4270F4E06E500C208E5 /* Common */,
- 080E96DDFE201D6D7F000001 /* Classes */,
- 29B97315FDCFA39411CA2CEA /* Other Sources */,
- 29B97317FDCFA39411CA2CEA /* Resources */,
- 29B97323FDCFA39411CA2CEA /* Frameworks */,
- 19C28FACFE9D520D11CA2CBB /* Products */,
- );
- name = CustomTemplate;
- sourceTree = "<group>";
- };
- 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
- isa = PBXGroup;
- children = (
- B38CAC880F76170E006495F1 /* basewnd.cpp */,
- B37BC4D30F4E0A2500C208E5 /* config.h */,
- B38CAC990F761A53006495F1 /* glwindow.cpp */,
- 32CA4F630368D1EE00C91783 /* LeoCAD_Prefix.pch */,
- 29B97316FDCFA39411CA2CEA /* main.m */,
- B38CAC8D0F76184D006495F1 /* system.cpp */,
- );
- name = "Other Sources";
- sourceTree = "<group>";
- };
- 29B97317FDCFA39411CA2CEA /* Resources */ = {
- isa = PBXGroup;
- children = (
- B3F5CF180F76F98900C9D249 /* Icon.png */,
- B38CAD240F762506006495F1 /* Pieces */,
- 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
- 8D1107310486CEB800E47090 /* Info.plist */,
- );
- name = Resources;
- sourceTree = "<group>";
- };
- 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
- isa = PBXGroup;
- children = (
- 28FD15070DC6FC5B0079059D /* QuartzCore.framework */,
- 28FD14FF0DC6FC520079059D /* OpenGLES.framework */,
- 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
- 1D30AB110D05D00D00671497 /* Foundation.framework */,
- );
- name = Frameworks;
- sourceTree = "<group>";
- };
- B37BC4270F4E06E500C208E5 /* Common */ = {
- isa = PBXGroup;
- children = (
- B37BC4280F4E06FA00C208E5 /* algebra.cpp */,
- B37BC4290F4E06FA00C208E5 /* algebra.h */,
- B37BC42A0F4E06FA00C208E5 /* array.cpp */,
- B37BC42B0F4E06FA00C208E5 /* array.h */,
- B37BC42C0F4E06FA00C208E5 /* basewnd.h */,
- B37BC42D0F4E06FA00C208E5 /* camera.cpp */,
- B37BC42E0F4E06FA00C208E5 /* camera.h */,
- B37BC42F0F4E06FA00C208E5 /* console.cpp */,
- B37BC4300F4E06FA00C208E5 /* console.h */,
- B37BC4310F4E06FA00C208E5 /* curve.cpp */,
- B37BC4320F4E06FA00C208E5 /* curve.h */,
- B37BC4330F4E06FA00C208E5 /* debug.cpp */,
- B37BC4340F4E06FA00C208E5 /* debug.h */,
- B37BC4350F4E06FA00C208E5 /* defines.h */,
- B37BC4360F4E06FA00C208E5 /* file.cpp */,
- B37BC4370F4E06FA00C208E5 /* file.h */,
- B37BC4380F4E06FA00C208E5 /* globals.cpp */,
- B37BC4390F4E06FA00C208E5 /* globals.h */,
- B37BC43A0F4E06FA00C208E5 /* glwindow.h */,
- B37BC43B0F4E06FA00C208E5 /* group.cpp */,
- B37BC43C0F4E06FA00C208E5 /* group.h */,
- B37BC43D0F4E06FA00C208E5 /* im_bmp.cpp */,
- B37BC43E0F4E06FA00C208E5 /* im_gif.cpp */,
- B37BC43F0F4E06FA00C208E5 /* im_jpg.cpp */,
- B37BC4400F4E06FA00C208E5 /* im_png.cpp */,
- B37BC4410F4E06FA00C208E5 /* image.cpp */,
- B37BC4420F4E06FA00C208E5 /* image.h */,
- B37BC4430F4E06FA00C208E5 /* keyboard.cpp */,
- B37BC4440F4E06FA00C208E5 /* keyboard.h */,
- B37BC4450F4E06FA00C208E5 /* lc_application.cpp */,
- B37BC4460F4E06FA00C208E5 /* lc_application.h */,
- B37BC4470F4E06FA00C208E5 /* library.cpp */,
- B37BC4480F4E06FA00C208E5 /* library.h */,
- B37BC4490F4E06FA00C208E5 /* light.cpp */,
- B37BC44A0F4E06FA00C208E5 /* light.h */,
- B37BC44B0F4E06FA00C208E5 /* mainwnd.cpp */,
- B37BC44C0F4E06FA00C208E5 /* mainwnd.h */,
- B37BC44E0F4E06FA00C208E5 /* matrix.cpp */,
- B37BC44F0F4E06FA00C208E5 /* matrix.h */,
- B37BC4500F4E06FA00C208E5 /* message.cpp */,
- B37BC4510F4E06FA00C208E5 /* message.h */,
- B37BC4520F4E06FA00C208E5 /* minifig.cpp */,
- B37BC4530F4E06FA00C208E5 /* minifig.h */,
- B37BC4550F4E06FA00C208E5 /* object.cpp */,
- B37BC4560F4E06FA00C208E5 /* object.h */,
- B37BC4570F4E06FA00C208E5 /* opengl.cpp */,
- B37BC4580F4E06FA00C208E5 /* opengl.h */,
- B37BC4590F4E06FA00C208E5 /* piece.cpp */,
- B37BC45A0F4E06FA00C208E5 /* piece.h */,
- B37BC45B0F4E06FA00C208E5 /* pieceinf.cpp */,
- B37BC45C0F4E06FA00C208E5 /* pieceinf.h */,
- B37BC45D0F4E06FA00C208E5 /* preview.cpp */,
- B37BC45E0F4E06FA00C208E5 /* preview.h */,
- B37BC45F0F4E06FA00C208E5 /* project.cpp */,
- B37BC4600F4E06FA00C208E5 /* project.h */,
- B37BC4610F4E06FA00C208E5 /* quant.cpp */,
- B37BC4620F4E06FA00C208E5 /* quant.h */,
- B37BC4630F4E06FA00C208E5 /* str.cpp */,
- B37BC4640F4E06FA00C208E5 /* str.h */,
- B37BC4650F4E06FA00C208E5 /* system.h */,
- B37BC4660F4E06FA00C208E5 /* terrain.cpp */,
- B37BC4670F4E06FA00C208E5 /* terrain.h */,
- B37BC4680F4E06FA00C208E5 /* texfont.cpp */,
- B37BC4690F4E06FA00C208E5 /* texfont.h */,
- B37BC46A0F4E06FA00C208E5 /* texture.cpp */,
- B37BC46B0F4E06FA00C208E5 /* texture.h */,
- B37BC46C0F4E06FA00C208E5 /* tr.cpp */,
- B37BC46D0F4E06FA00C208E5 /* tr.h */,
- B37BC46E0F4E06FA00C208E5 /* typedefs.h */,
- B37BC46F0F4E06FA00C208E5 /* vector.cpp */,
- B37BC4700F4E06FA00C208E5 /* vector.h */,
- B37BC4710F4E06FA00C208E5 /* view.cpp */,
- B37BC4720F4E06FA00C208E5 /* view.h */,
- );
- name = Common;
- sourceTree = "<group>";
- };
- B38CAD240F762506006495F1 /* Pieces */ = {
- isa = PBXGroup;
- children = (
- B38CAD270F76268E006495F1 /* pieces.bin */,
- B38CAD280F76268E006495F1 /* pieces.idx */,
- B38CAD290F76268E006495F1 /* sysfont.txf */,
- B38CAD2A0F76268E006495F1 /* textures.bin */,
- B38CAD2B0F76268E006495F1 /* textures.idx */,
- );
- name = Pieces;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXNativeTarget section */
- 1D6058900D05DD3D006BFB54 /* LeoCAD */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "LeoCAD" */;
- buildPhases = (
- 1D60588D0D05DD3D006BFB54 /* Resources */,
- 1D60588E0D05DD3D006BFB54 /* Sources */,
- 1D60588F0D05DD3D006BFB54 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = LeoCAD;
- productName = LeoCAD;
- productReference = 1D6058910D05DD3D006BFB54 /* LeoCAD.app */;
- productType = "com.apple.product-type.application";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 29B97313FDCFA39411CA2CEA /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "LeoCAD" */;
- compatibilityVersion = "Xcode 3.1";
- hasScannedForEncodings = 1;
- mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
- projectDirPath = "";
- projectRoot = ..;
- targets = (
- 1D6058900D05DD3D006BFB54 /* LeoCAD */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- 1D60588D0D05DD3D006BFB54 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */,
- B38CAD2C0F76268E006495F1 /* pieces.bin in Resources */,
- B38CAD2D0F76268E006495F1 /* pieces.idx in Resources */,
- B38CAD2E0F76268E006495F1 /* sysfont.txf in Resources */,
- B38CAD2F0F76268E006495F1 /* textures.bin in Resources */,
- B38CAD300F76268E006495F1 /* textures.idx in Resources */,
- B3F5CF190F76F98900C9D249 /* Icon.png in Resources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- 1D60588E0D05DD3D006BFB54 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
- 1D3623260D0F684500981E51 /* LeoCADAppDelegate.m in Sources */,
- 28FD14FE0DC6FC130079059D /* EAGLView.m in Sources */,
- B37BC4730F4E06FA00C208E5 /* algebra.cpp in Sources */,
- B37BC4750F4E06FA00C208E5 /* camera.cpp in Sources */,
- B37BC4760F4E06FA00C208E5 /* console.cpp in Sources */,
- B37BC4770F4E06FA00C208E5 /* curve.cpp in Sources */,
- B37BC4780F4E06FA00C208E5 /* debug.cpp in Sources */,
- B37BC4790F4E06FA00C208E5 /* file.cpp in Sources */,
- B37BC47A0F4E06FA00C208E5 /* globals.cpp in Sources */,
- B37BC47B0F4E06FA00C208E5 /* group.cpp in Sources */,
- B37BC47C0F4E06FA00C208E5 /* im_bmp.cpp in Sources */,
- B37BC47D0F4E06FA00C208E5 /* im_gif.cpp in Sources */,
- B37BC47E0F4E06FA00C208E5 /* im_jpg.cpp in Sources */,
- B37BC47F0F4E06FA00C208E5 /* im_png.cpp in Sources */,
- B37BC4800F4E06FA00C208E5 /* image.cpp in Sources */,
- B37BC4810F4E06FA00C208E5 /* keyboard.cpp in Sources */,
- B37BC4820F4E06FA00C208E5 /* lc_application.cpp in Sources */,
- B37BC4830F4E06FA00C208E5 /* library.cpp in Sources */,
- B37BC4840F4E06FA00C208E5 /* light.cpp in Sources */,
- B37BC4850F4E06FA00C208E5 /* mainwnd.cpp in Sources */,
- B37BC4870F4E06FA00C208E5 /* matrix.cpp in Sources */,
- B37BC4880F4E06FA00C208E5 /* message.cpp in Sources */,
- B37BC4890F4E06FA00C208E5 /* minifig.cpp in Sources */,
- B37BC48B0F4E06FA00C208E5 /* object.cpp in Sources */,
- B37BC48C0F4E06FA00C208E5 /* opengl.cpp in Sources */,
- B37BC48D0F4E06FA00C208E5 /* piece.cpp in Sources */,
- B37BC48E0F4E06FA00C208E5 /* pieceinf.cpp in Sources */,
- B37BC48F0F4E06FA00C208E5 /* preview.cpp in Sources */,
- B37BC4900F4E06FA00C208E5 /* project.cpp in Sources */,
- B37BC4910F4E06FA00C208E5 /* quant.cpp in Sources */,
- B37BC4920F4E06FA00C208E5 /* str.cpp in Sources */,
- B37BC4930F4E06FA00C208E5 /* terrain.cpp in Sources */,
- B37BC4940F4E06FA00C208E5 /* texfont.cpp in Sources */,
- B37BC4950F4E06FA00C208E5 /* texture.cpp in Sources */,
- B37BC4960F4E06FA00C208E5 /* tr.cpp in Sources */,
- B37BC4970F4E06FA00C208E5 /* vector.cpp in Sources */,
- B37BC4980F4E06FA00C208E5 /* view.cpp in Sources */,
- B38CAC890F76170E006495F1 /* basewnd.cpp in Sources */,
- B38CAC8E0F76184D006495F1 /* system.cpp in Sources */,
- B38CAC9A0F761A53006495F1 /* glwindow.cpp in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 1D6058940D05DD3E006BFB54 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- COPY_PHASE_STRIP = NO;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = LeoCAD_Prefix.pch;
- INFOPLIST_FILE = Info.plist;
- PRODUCT_NAME = LeoCAD;
- };
- name = Debug;
- };
- 1D6058950D05DD3E006BFB54 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- COPY_PHASE_STRIP = YES;
- GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = LeoCAD_Prefix.pch;
- INFOPLIST_FILE = Info.plist;
- PRODUCT_NAME = LeoCAD;
- };
- name = Release;
- };
- C01FCF4F08A954540054247B /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Leonardo Zide";
- GCC_C_LANGUAGE_STANDARD = c99;
- GCC_PREPROCESSOR_DEFINITIONS = "LC_IPHONE=1";
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- ONLY_ACTIVE_ARCH = YES;
- PREBINDING = NO;
- "PROVISIONING_PROFILE[sdk=iphoneos*]" = "66E10150-8393-4DF2-9510-9E54677112A8";
- SDKROOT = iphoneos2.2.1;
- };
- name = Debug;
- };
- C01FCF5008A954540054247B /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT)";
- "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
- GCC_C_LANGUAGE_STANDARD = c99;
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- PREBINDING = NO;
- SDKROOT = iphoneos2.2.1;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "LeoCAD" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1D6058940D05DD3E006BFB54 /* Debug */,
- 1D6058950D05DD3E006BFB54 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- C01FCF4E08A954540054247B /* Build configuration list for PBXProject "LeoCAD" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- C01FCF4F08A954540054247B /* Debug */,
- C01FCF5008A954540054247B /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
-}
diff --git a/iphone/LeoCAD_Prefix.pch b/iphone/LeoCAD_Prefix.pch
deleted file mode 100644
index fcb14ac..0000000
--- a/iphone/LeoCAD_Prefix.pch
+++ /dev/null
@@ -1,8 +0,0 @@
-//
-// Prefix header for all source files of the 'LeoCAD' target in the 'LeoCAD' project
-//
-
-#ifdef __OBJC__
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-#endif
diff --git a/iphone/MainWindow.xib b/iphone/MainWindow.xib
deleted file mode 100644
index 8b0654c..0000000
--- a/iphone/MainWindow.xib
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.02">
- <data>
- <int key="IBDocument.SystemTarget">528</int>
- <string key="IBDocument.SystemVersion">9E17</string>
- <string key="IBDocument.InterfaceBuilderVersion">672</string>
- <string key="IBDocument.AppKitVersion">949.33</string>
- <string key="IBDocument.HIToolboxVersion">352.00</string>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="8"/>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBProxyObject" id="841351856">
- <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
- </object>
- <object class="IBProxyObject" id="191355593">
- <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
- </object>
- <object class="IBUICustomObject" id="664661524"/>
- <object class="IBUIWindow" id="380026005">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">1316</int>
- <object class="NSMutableArray" key="NSSubviews">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBUIView" id="773737154">
- <reference key="NSNextResponder" ref="380026005"/>
- <int key="NSvFlags">1298</int>
- <string key="NSFrameSize">{320, 480}</string>
- <reference key="NSSuperview" ref="380026005"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MQA</bytes>
- <object class="NSColorSpace" key="NSCustomColorSpace">
- <int key="NSID">2</int>
- </object>
- </object>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
- </object>
- </object>
- <object class="NSPSMatrix" key="NSFrameMatrix"/>
- <string key="NSFrameSize">{320, 480}</string>
- <reference key="NSSuperview"/>
- <object class="NSColor" key="IBUIBackgroundColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MSAxIDEAA</bytes>
- </object>
- <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
- <bool key="IBUIVisibleAtLaunch">YES</bool>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="841351856"/>
- <reference key="destination" ref="664661524"/>
- </object>
- <int key="connectionID">4</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">window</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="380026005"/>
- </object>
- <int key="connectionID">5</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBCocoaTouchOutletConnection" key="connection">
- <string key="label">glView</string>
- <reference key="source" ref="664661524"/>
- <reference key="destination" ref="773737154"/>
- </object>
- <int key="connectionID">9</int>
- </object>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="957960031">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1000"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">2</int>
- <reference key="object" ref="380026005"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="773737154"/>
- </object>
- <reference key="parent" ref="957960031"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="841351856"/>
- <reference key="parent" ref="957960031"/>
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">3</int>
- <reference key="object" ref="664661524"/>
- <reference key="parent" ref="957960031"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">8</int>
- <reference key="object" ref="773737154"/>
- <reference key="parent" ref="380026005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="191355593"/>
- <reference key="parent" ref="957960031"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.CustomClassName</string>
- <string>-2.CustomClassName</string>
- <string>2.IBAttributePlaceholdersKey</string>
- <string>2.IBEditorWindowLastContentRect</string>
- <string>2.IBPluginDependency</string>
- <string>3.CustomClassName</string>
- <string>3.IBPluginDependency</string>
- <string>8.CustomClassName</string>
- <string>8.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>UIApplication</string>
- <string>UIResponder</string>
- <object class="NSMutableDictionary">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <string>{{500, 343}, {320, 480}}</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>LeoCADAppDelegate</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- <string>EAGLView</string>
- <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">9</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">EAGLView</string>
- <string key="superclassName">UIView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/EAGLView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">LeoCADAppDelegate</string>
- <string key="superclassName">NSObject</string>
- <object class="NSMutableDictionary" key="outlets">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>glView</string>
- <string>window</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>EAGLView</string>
- <string>UIWindow</string>
- </object>
- </object>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Classes/LeoCADAppDelegate.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">LeoCAD.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
diff --git a/iphone/basewnd.cpp b/iphone/basewnd.cpp
deleted file mode 100644
index f6afe4a..0000000
--- a/iphone/basewnd.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// BaseWnd class implementation for iPhone
-//
-
-#include "basewnd.h"
-
-BaseWnd::BaseWnd (BaseWnd *parent, int menu_count)
-{
- m_pMenuItems = new BaseMenuItem[menu_count];
- memset(m_pMenuItems, 0, sizeof(BaseMenuItem[menu_count]));
- m_pParent = parent;
-
- m_pXID = NULL;
-}
-
-BaseWnd::~BaseWnd ()
-{
- delete [] m_pMenuItems;
- m_pMenuItems = NULL;
-}
-
-void BaseWnd::BeginWait ()
-{
-}
-
-void BaseWnd::EndWait ()
-{
-}
-
-int BaseWnd::MessageBox (const char* text, const char* caption, int flags)
-{
- int mode = (flags & LC_MB_TYPEMASK);
- int ret;
-
- if (mode == LC_MB_OK)
- ret = LC_OK;
- else if (mode == LC_MB_OKCANCEL)
- ret = LC_CANCEL;
- else /* if (mode == LC_MB_YESNO) */
- ret = LC_NO;
-
- return ret;
-}
-
-void BaseWnd::ShowMenuItem (int id, bool show)
-{
-}
-
-void BaseWnd::EnableMenuItem (int id, bool enable)
-{
-}
-
-void BaseWnd::CheckMenuItem (int id, bool check)
-{
-}
-
-void BaseWnd::SetMenuItemText (int id, const char *text)
-{
-}
diff --git a/iphone/config.h b/iphone/config.h
deleted file mode 100644
index 099f282..0000000
--- a/iphone/config.h
+++ /dev/null
@@ -1,36 +0,0 @@
-//
-// LeoCAD configuration
-//
-// Auto-generated file, DO NOT EDIT
-//
-
-#ifndef _CONFIG_H_
-#define _CONFIG_H_
-
-#define LC_VERSION_MAJOR 0
-#define LC_VERSION_MINOR 74
-#define LC_VERSION_PATCH 0
-#define LC_VERSION_OSNAME "iPhone"
-#define LC_VERSION_TEXT "0.75"
-#define LC_VERSION_TAG ""
-#define LC_INSTALL_PREFIX "."
-
-typedef signed char lcint8;
-typedef unsigned char lcuint8;
-typedef signed short lcint16;
-typedef unsigned short lcuint16;
-typedef signed int lcint32;
-typedef unsigned int lcuint32;
-
-#define LC_LITTLE_ENDIAN
-#define LCUINT16(val) val
-#define LCUINT32(val) val
-#define LCINT16(val) val
-#define LCINT32(val) val
-#define LCFLOAT(val) val
-
-//#define LC_HAVE_JPEGLIB
-//#define LC_HAVE_ZLIB
-//#define LC_HAVE_PNGLIB
-
-#endif // _CONFIG_H_
diff --git a/iphone/glwindow.cpp b/iphone/glwindow.cpp
deleted file mode 100644
index c0fe9d2..0000000
--- a/iphone/glwindow.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#import "EAGLView.h"
-#include <stdio.h>
-#include "opengl.h"
-#include "glwindow.h"
-
-// =============================================================================
-// GLWindow class
-
-GLWindow::GLWindow(GLWindow *share)
-{
- m_pShare = share;
- m_pData = NULL;
-}
-
-GLWindow::~GLWindow()
-{
- DestroyContext();
-}
-
-bool GLWindow::Create(void *data)
-{
- m_pData = data;
- OnInitialUpdate();
- return true;
-}
-
-void GLWindow::DestroyContext()
-{
-}
-
-void GLWindow::OnInitialUpdate()
-{
- MakeCurrent();
- GL_InitializeExtensions();
-}
-
-bool GLWindow::MakeCurrent()
-{
- EAGLView* View = (EAGLView*)m_pData;
- [View MakeCurrent];
-
- return true;
-}
-
-void GLWindow::SwapBuffers()
-{
- EAGLView* View = (EAGLView*)m_pData;
- [View SwapBuffers];
-}
-
-void GLWindow::Redraw()
-{
- EAGLView* View = (EAGLView*)m_pData;
- [View setNeedsDisplay];
-}
-
-void GLWindow::CaptureMouse()
-{
-}
-
-void GLWindow::ReleaseMouse()
-{
-}
diff --git a/iphone/main.m b/iphone/main.m
deleted file mode 100644
index c68b2be..0000000
--- a/iphone/main.m
+++ /dev/null
@@ -1,45 +0,0 @@
-#import <UIKit/UIKit.h>
-#include "config.h"
-#include "globals.h"
-#include "lc_application.h"
-#include "library.h"
-#include "basewnd.h"
-#include "project.h"
-#include "preview.h"
-#include "mainwnd.h"
-
-PiecePreview* preview;
-
-int main(int argc, char *argv[])
-{
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-
- CFBundleRef mainBundle = CFBundleGetMainBundle();
- CFURLRef url = CFBundleCopyBundleURL(mainBundle);
- UInt8 path[2048];
- CFURLGetFileSystemRepresentation(url, YES, path, 2048);
- CFRelease(url);
- strcat((char*)path, "/");
-
- g_App = new lcApplication();
- main_window = new MainWnd();
-
- if (!g_App->Initialize(argc, argv, (char*)path))
- return 1;
-
- preview = new PiecePreview(NULL);
-
- PieceInfo* Info = lcGetPiecesLibrary()->FindPieceInfo("3005");
- if (!Info)
- Info = lcGetPiecesLibrary()->GetPieceInfo(0);
-
- if (Info)
- {
- lcGetActiveProject()->SetCurrentPiece(Info);
- preview->SetCurrentPiece(Info);
- }
-
- int retVal = UIApplicationMain(argc, argv, nil, nil);
- [pool release];
- return retVal;
-}
diff --git a/iphone/system.cpp b/iphone/system.cpp
deleted file mode 100644
index b6e41b2..0000000
--- a/iphone/system.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-#include "opengl.h"
-#include "camera.h"
-#include "project.h"
-#include "system.h"
-#include "globals.h"
-#include "lc_application.h"
-
-// =============================================================================
-// Cursor functions
-
-int Sys_MessageBox (const char* text, const char* caption, int type)
-{
- int mode = (type & LC_MB_TYPEMASK);
- int ret;
-
- if (mode == LC_MB_OK)
- ret = LC_OK;
- else if (mode == LC_MB_OKCANCEL)
- ret = LC_CANCEL;
- else /* if (mode == LC_MB_YESNO) */
- ret = LC_NO;
-
- return ret;
-}
-
-// =============================================================================
-// Memory rendering
-
-void* Sys_StartMemoryRender(int width, int height)
-{
- return NULL;
-}
-
-void Sys_FinishMemoryRender(void* param)
-{
-}
-
-// =============================================================================
-// Misc stuff
-
-bool Sys_KeyDown (int key)
-{
- return false;
-}
-
-// String
-char* strupr(char* string)
-{
- char *cp;
- for (cp=string; *cp; ++cp)
- {
- if ('a' <= *cp && *cp <= 'z')
- *cp += 'A' - 'a';
- }
-
- return string;
-}
-
-char* strlwr(char* string)
-{
- char *cp;
- for (cp = string; *cp; ++cp)
- {
- if ('A' <= *cp && *cp <= 'Z')
- *cp += 'a' - 'A';
- }
-
- return string;
-}
-
-int stricmp(const char* str1, const char* str2)
-{
- return strcasecmp(str1, str2);
-}
-
-void SystemPumpMessages()
-{
-}
-
-long SystemGetTicks()
-{
- static int basetime = 0;
- struct timezone tzp;
- struct timeval tp;
-
- gettimeofday (&tp, &tzp);
-
- if (!basetime)
- basetime = tp.tv_sec;
-
- return (tp.tv_sec-basetime)*1000 + tp.tv_usec/1000;
-}
-
-// User Interface
-void SystemUpdateViewport(int new_vp, int old_vp)
-{
-}
-
-void SystemUpdateCategories(bool SearchOnly)
-{
-}
-
-void SystemUpdateAction(int new_action, int old_action)
-{
-}
-
-void SystemUpdateColorList(int new_color)
-{
-}
-
-void SystemUpdateRenderingMode(bool bBackground, bool bFast)
-{
-}
-
-void SystemUpdateUndoRedo(char* undo, char* redo)
-{
-}
-
-void SystemUpdateSnap(const unsigned long snap)
-{
-}
-
-void SystemUpdateCurrentCamera(Camera* pOld, Camera* pNew, Camera* pCamera)
-{
-}
-
-void SystemUpdateCameraMenu(Camera* pCamera)
-{
-}
-
-void SystemUpdateTime(bool bAnimation, int nTime, int nTotal)
-{
-}
-
-void SystemUpdateAnimation(bool bAnimation, bool bAddKeys)
-{
-}
-
-void SystemUpdateSnap(unsigned short move_snap, unsigned short RotateSnap)
-{
-}
-
-void SystemUpdateSelected(unsigned long flags, int SelectedCount, Object* Focus)
-{
-}
-
-void SystemUpdateRecentMenu (String names[4])
-{
-}
-
-void SystemUpdatePaste(bool enable)
-{
-}
-
-void SystemUpdatePlay(bool play, bool stop)
-{
-}
-
-void SystemInit()
-{
-}
-
-void SystemFinish()
-{
-}
-
-// FIXME: remove
-int SystemDoMessageBox(const char* prompt, int mode)
-{
- return Sys_MessageBox(prompt, "", mode);
-}
-
-bool SystemDoDialog(int mode, void* param)
-{
- return false;
-}
-
-void SystemDoPopupMenu(int nMenu, int x, int y)
-{
-}
-
-void SystemDoWaitCursor(int code)
-{
-}
-
-void SystemExportClipboard(File* clip)
-{
-}
-
-File* SystemImportClipboard()
-{
- return NULL;
-}
-
-void SystemSetWindowCaption(char* caption)
-{
-}
-
-void SystemPieceComboAdd(char* name)
-{
-}
-
-void SystemCaptureMouse()
-{
-}
-
-void SystemReleaseMouse()
-{
-}
-
-void SystemStartProgressBar(int nLower, int nUpper, int nStep, const char* Text)
-{
-}
-
-void SytemEndProgressBar()
-{
-}
-
-void SytemStepProgressBar()
-{
-}
-
-bool Sys_ProfileSaveInt(const char *section, const char *key, int value)
-{
- return true;
-}
-
-bool Sys_ProfileSaveString(const char *section, const char *key, const char *value)
-{
- return true;
-}
-
-int Sys_ProfileLoadInt (const char *section, const char *key, int default_value)
-{
- return default_value;
-}
-
-char* Sys_ProfileLoadString(const char *section, const char *key, const char *default_value)
-{
- return (char*)default_value;
-}
-
-void* Sys_GLGetExtension(const char *symbol)
-{
- return NULL;
-}
-
-bool Sys_GLOpenLibrary(const char* libname)
-{
- return true;
-}
-
-void Sys_GLCloseLibrary()
-{
-}
diff --git a/linux/basewnd.cpp b/linux/basewnd.cpp
index 8c4260b..5593062 100644
--- a/linux/basewnd.cpp
+++ b/linux/basewnd.cpp
@@ -11,7 +11,6 @@
BaseWnd::BaseWnd (BaseWnd *parent, int menu_count)
{
m_pMenuItems = new BaseMenuItem[menu_count];
- memset(m_pMenuItems, 0, sizeof(BaseMenuItem[menu_count]));
m_pParent = parent;
m_pXID = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -169,9 +168,6 @@ int BaseWnd::MessageBox (const char* text, const char* caption, int flags)
void BaseWnd::ShowMenuItem (int id, bool show)
{
- if (!m_pMenuItems[id].widget)
- return;
-
if (show)
gtk_widget_show (m_pMenuItems[id].widget);
else
@@ -180,17 +176,11 @@ void BaseWnd::ShowMenuItem (int id, bool show)
void BaseWnd::EnableMenuItem (int id, bool enable)
{
- if (!m_pMenuItems[id].widget)
- return;
-
gtk_widget_set_sensitive (m_pMenuItems[id].widget, enable);
}
void BaseWnd::CheckMenuItem (int id, bool check)
{
- if (!m_pMenuItems[id].widget)
- return;
-
ignore_commands = true;
gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (m_pMenuItems[id].widget), check);
ignore_commands = false;
@@ -205,9 +195,6 @@ void BaseWnd::SetMenuItemText (int id, const char *text)
gchar *pattern;
gint length;
- if (!m_pMenuItems[id].widget)
- return;
-
length = strlen (text);
pattern = g_new (gchar, length+1);
diff --git a/linux/dialogs.cpp b/linux/dialogs.cpp
index cdbd650..5318caf 100644
--- a/linux/dialogs.cpp
+++ b/linux/dialogs.cpp
@@ -23,7 +23,6 @@
#include "config.h"
#include "message.h"
#include "project.h"
-#include "libdlg.h"
// =============================================================================
// Modal dialog helper functions
@@ -294,7 +293,7 @@ static void filedlg_callback(GtkWidget *widget, gpointer data)
*cur_ret = LC_CANCEL;
}
-int filedlg_execute(const char* caption, char* filename)
+int filedlg_execute(char* caption, char* filename)
{
GtkWidget* dlg;
dlg = gtk_file_selection_new (caption);
@@ -2162,14 +2161,11 @@ static void propertiesdlg_ok(GtkWidget *widget, gpointer data)
LC_PROPERTIESDLG_STRUCT* s = (LC_PROPERTIESDLG_STRUCT*)data;
LC_PROPERTIESDLG_OPTS* opts = (LC_PROPERTIESDLG_OPTS*)s->data;
- strcpy(opts->strAuthor, gtk_entry_get_text(GTK_ENTRY(s->sum_author)));
- strcpy(opts->strDescription, gtk_entry_get_text(GTK_ENTRY(s->sum_description)));
+ strcpy(opts->strAuthor, gtk_entry_get_text (GTK_ENTRY (s->sum_author)));
+ strcpy(opts->strDescription, gtk_entry_get_text (GTK_ENTRY (s->sum_description)));
char* comments = gtk_editable_get_chars(GTK_EDITABLE(s->sum_comments), 0, -1);
- if (comments != NULL)
- {
- strcpy(opts->strComments, comments);
- g_free(comments);
- }
+ strcpy(opts->strComments, comments);
+ g_free(comments);
*cur_ret = LC_OK;
}
@@ -2540,7 +2536,7 @@ typedef struct
void* data;
} LC_GROUPEDITDLG_STRUCT;
-/*
+
static void groupeditdlg_ok(GtkWidget *widget, gpointer data)
{
// LC_GROUPEDITDLG_STRUCT* s = (LC_GROUPEDITDLG_STRUCT*)data;
@@ -2548,7 +2544,7 @@ static void groupeditdlg_ok(GtkWidget *widget, gpointer data)
*cur_ret = LC_OK;
}
-*/
+
void groupeditdlg_addchildren(GtkWidget *tree, Group *pGroup, LC_GROUPEDITDLG_OPTS *opts)
{
#if 0
@@ -2747,101 +2743,55 @@ int groupdlg_execute(void* param)
// =============================================================================
// Piece Library Dialog
+#if 0
#include "library.h"
#include "pieceinf.h"
-#include "lc_application.h"
static void librarydlg_update_list (GtkWidget *dlg)
{
- PiecesLibrary* Lib = g_App->GetPiecesLibrary();
- GtkCTree* ctree = GTK_CTREE(gtk_object_get_data(GTK_OBJECT(dlg), "tree"));
- GtkCList* clist = GTK_CLIST(gtk_object_get_data(GTK_OBJECT(dlg), "list"));
- int row;
-
- gchar* CategoryName = GTK_CELL_TEXT(GTK_CTREE_ROW(gtk_ctree_node_nth(ctree, GTK_CLIST(ctree)->focus_row))->row.cell[0])->text;
- int CategoryIndex = Lib->FindCategoryIndex((const char*)CategoryName);
-
- gtk_clist_freeze (clist);
- gtk_clist_clear (clist);
-
- if (CategoryIndex != -1)
- {
- PtrArray<PieceInfo> SinglePieces, GroupedPieces;
-
- Lib->GetCategoryEntries(CategoryIndex, false, SinglePieces, GroupedPieces);
-
- for (int i = 0; i < SinglePieces.GetSize(); i++)
- {
- PieceInfo* Info = SinglePieces[i];
-
- char *text = Info->m_strDescription;
- row = gtk_clist_append(clist, &text);
- gtk_clist_set_row_data(clist, row, Info);
- }
- }
- else
- {
- if (!strcmp(CategoryName, "Unassigned"))
- {
- // Test each piece against all categories.
- for (int i = 0; i < Lib->GetPieceCount(); i++)
- {
- PieceInfo* Info = Lib->GetPieceInfo(i);
- int j;
-
- for (j = 0; j < Lib->GetNumCategories(); j++)
- {
- if (Lib->PieceInCategory(Info, Lib->GetCategoryKeywords(j)))
- break;
- }
-
- if (j == Lib->GetNumCategories())
- {
- char *text = Info->m_strDescription;
- row = gtk_clist_append(clist, &text);
- gtk_clist_set_row_data(clist, row, Info);
- }
- }
- }
- else if (!strcmp(CategoryName, "Pieces"))
- {
- for (int i = 0; i < Lib->GetPieceCount(); i++)
- {
- PieceInfo* Info = Lib->GetPieceInfo(i);
-
- char *text = Info->m_strDescription;
- row = gtk_clist_append(clist, &text);
- gtk_clist_set_row_data(clist, row, Info);
- }
- }
- }
-
- gtk_clist_thaw(clist);
- clist->focus_row = 0;
- gtk_clist_select_row(clist, 0, 0);
+ PiecesLibrary *lib = project->GetPiecesLibrary();
+ GtkCTree *ctree = GTK_CTREE (gtk_object_get_data (GTK_OBJECT (dlg), "tree"));
+ GtkCList *clist = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (dlg), "list"));
+ int row, sel = GTK_CLIST (ctree)->focus_row;
+
+ gtk_clist_freeze (clist);
+ gtk_clist_clear (clist);
+
+ PtrArray<PieceInfo> SinglePieces, GroupedPieces;
+ lib->GetCategoryEntries(sel, false, SinglePieces, GroupedPieces);
+
+ for (int i = 0; i < SinglePieces.GetSize(); i++)
+ {
+ PieceInfo* info = SinglePieces[i];
+
+ char *text = info->m_strDescription;
+ row = gtk_clist_append (clist, &text);
+ gtk_clist_set_row_data (clist, row, info);
+ }
+
+ gtk_clist_thaw (clist);
+ clist->focus_row = 0;
+ gtk_clist_select_row (clist, 0, 0);
}
static void librarydlg_update_tree (GtkWidget *dlg)
{
- PiecesLibrary *lib = g_App->GetPiecesLibrary();
+ PiecesLibrary *lib = project->GetPiecesLibrary();
GtkCTree *ctree = GTK_CTREE (gtk_object_get_data (GTK_OBJECT (dlg), "tree"));
GtkCTreeNode *parent;
- const char *text = "Pieces";
+ char *text = "Groups";
gtk_clist_freeze (GTK_CLIST (ctree));
gtk_clist_clear (GTK_CLIST (ctree));
- parent = gtk_ctree_insert_node (ctree, NULL, NULL, (gchar**)&text, 0, NULL, NULL, NULL, NULL, FALSE, TRUE);
+ parent = gtk_ctree_insert_node (ctree, NULL, NULL, &text, 0, NULL, NULL, NULL, NULL, FALSE, TRUE);
for (int i = 0; i < lib->GetNumCategories(); i++)
{
text = lib->GetCategoryName(i);
- gtk_ctree_insert_node (ctree, parent, NULL, (gchar**)&text, 0, NULL, NULL, NULL, NULL, TRUE, TRUE);
+ gtk_ctree_insert_node (ctree, parent, NULL, &text, 0, NULL, NULL, NULL, NULL, TRUE, TRUE);
}
- text = "Unassigned";
- gtk_ctree_insert_node (ctree, parent, NULL, (gchar**)&text, 0, NULL, NULL, NULL, NULL, TRUE, TRUE);
-
gtk_clist_thaw (GTK_CLIST (ctree));
}
@@ -2850,25 +2800,24 @@ static void librarydlg_treefocus (GtkCTree *ctree, GtkCTreeNode *row, gint colum
librarydlg_update_list (GTK_WIDGET (data));
}
-static GtkWidget *last_dlg = NULL;
-
static void librarydlg_command (GtkWidget *widget, gpointer data)
{
+ /*
GtkWidget *parent = gtk_widget_get_toplevel (widget);
- LibraryDialog *dlg = (LibraryDialog*) gtk_object_get_data (GTK_OBJECT (parent), "menu_file_import_piece");
+ LibraryDialog *dlg = (LibraryDialog*) gtk_object_get_data (GTK_OBJECT (parent), "lib");
int id = GPOINTER_TO_INT (data);
- dlg = (LibraryDialog *)last_dlg;
-
dlg->HandleCommand (id);
+ */
}
int librarydlg_execute (void *param)
{
+#if 0
GtkWidget *dlg, *vbox, *clist, *scr, *ctree, *hsplit, *item, *menu, *menubar, *handle;
- GtkAccelGroup *accel;
+ GtkAccelGroup *accel, *menu_accel;
int loop = 1, ret = LC_CANCEL;
- PiecesLibrary *lib = g_App->GetPiecesLibrary();
+ LibraryManager lib;
dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (((GtkWidget*)(*main_window))));
@@ -2880,10 +2829,7 @@ int librarydlg_execute (void *param)
gtk_object_set_data (GTK_OBJECT (dlg), "loop", &loop);
gtk_object_set_data (GTK_OBJECT (dlg), "ret", &ret);
gtk_window_set_default_size (GTK_WINDOW (dlg), 500, 250);
-
- accel = gtk_accel_group_new();
- gtk_window_add_accel_group(GTK_WINDOW(dlg), accel);
-// accel = gtk_accel_group_get_default ();
+ accel = gtk_accel_group_get_default ();
vbox = gtk_vbox_new (FALSE, 5);
gtk_widget_show (vbox);
@@ -2898,73 +2844,70 @@ int librarydlg_execute (void *param)
gtk_widget_show (menubar);
// File menu
- menu = create_sub_menu (menubar, "_File", accel);
+ menu = create_sub_menu (menubar, "_File", accel, &menu_accel);
menu_tearoff (menu);
-/*
- create_menu_item (menu, "_Reset", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_RESET, "menu_file_reset");
- create_menu_item (menu, "_Open...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_OPEN, "menu_file_open");
- create_menu_item (menu, "_Save", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_SAVE, "menu_file_save");
- create_menu_item (menu, "Save _As...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_SAVEAS, "menu_file_save_as");
+ /*
+ create_menu_item (menu, "_Reset", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_RESET);
+ create_menu_item (menu, "_Open...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_OPEN);
+ create_menu_item (menu, "_Save", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_SAVE);
+ create_menu_item (menu, "Save _As...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_SAVEAS);
menu_separator (menu);
- item = create_menu_item (menu, "_Print Catalog...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_PRINTCATALOG, "menu_print_catalog");
+ item = create_menu_item (menu, "_Print Catalog...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_PRINTCATALOG);
gtk_widget_set_sensitive (item, FALSE);
-*/
- item = create_menu_item (menu, "Load _Update...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_MERGEUPDATE, "menu_file_merge_update");
- item = create_menu_item (menu, "_Import Piece...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_IMPORTPIECE, "menu_file_import_piece");
-/*
+ item = create_menu_item (menu, "Load _Update...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_MERGEUPDATE);
+ item = create_menu_item (menu, "_Import Piece...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_IMPORTPIECE);
menu_separator (menu);
- item = create_menu_item (menu, "Re_turn", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_RETURN, "menu_file_return");
- item = create_menu_item (menu, "_Cancel", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_FILE_CANCEL, "menu_file_cancel");
+ item = create_menu_item (menu, "Re_turn", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_RETURN);
+ item = create_menu_item (menu, "_Cancel", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_FILE_CANCEL);
+ */
// Group menu
- menu = create_sub_menu (menubar, "_Group", accel);
+ menu = create_sub_menu (menubar, "_Group", accel, &menu_accel);
menu_tearoff (menu);
- create_menu_item (menu, "Insert...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_GROUP_INSERT, "menu_group_insert");
- create_menu_item (menu, "Delete", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_GROUP_DELETE, "menu_group_delete");
- create_menu_item (menu, "Edit...", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_GROUP_EDIT, "menu_group_edit");
+ /*
+ create_menu_item (menu, "Insert...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_GROUP_INSERT);
+ create_menu_item (menu, "Delete", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_GROUP_DELETE);
+ create_menu_item (menu, "Edit...", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_GROUP_EDIT);
menu_separator (menu);
- create_menu_item (menu, "Move Up", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_GROUP_MOVEUP, "menu_group_moveup");
- create_menu_item (menu, "Move Down", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_GROUP_MOVEDOWN, "menu_group_down");
+ create_menu_item (menu, "Move Up", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_GROUP_MOVEUP);
+ create_menu_item (menu, "Move Down", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_GROUP_MOVEDOWN);
+ */
// Piece menu
- menu = create_sub_menu (menubar, "_Piece", accel);
+ menu = create_sub_menu (menubar, "_Piece", accel, &menu_accel);
menu_tearoff (menu);
- item = create_menu_item (menu, "_New", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_PIECE_NEW, "menu_piece_new");
+ /*
+ item = create_menu_item (menu, "_New", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_PIECE_NEW);
gtk_widget_set_sensitive (item, FALSE);
- item = create_menu_item (menu, "_Edit", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_PIECE_EDIT, "menu_piece_edit");
+ item = create_menu_item (menu, "_Edit", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_PIECE_EDIT);
gtk_widget_set_sensitive (item, FALSE);
- create_menu_item (menu, "_Delete", accel,
- GTK_SIGNAL_FUNC (librarydlg_command), GTK_OBJECT (dlg), LC_LIBDLG_PIECE_DELETE, "menu_piece_delete");
-*/
+ create_menu_item (menu, "_Delete", menu_accel,
+ GTK_SIGNAL_FUNC (librarydlg_command), LC_LIBDLG_PIECE_DELETE);
+ */
hsplit = gtk_hpaned_new ();
gtk_paned_set_gutter_size (GTK_PANED (hsplit), 12);
gtk_box_pack_start (GTK_BOX (vbox), hsplit, TRUE, TRUE, 0);
gtk_widget_show (hsplit);
gtk_container_set_border_width (GTK_CONTAINER (hsplit), 5);
- scr = gtk_scrolled_window_new ((GtkAdjustment*)NULL, (GtkAdjustment*)NULL);
- gtk_widget_show (scr);
- gtk_paned_add1 (GTK_PANED (hsplit), scr);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
-
ctree = gtk_ctree_new (1, 0);
gtk_object_set_data (GTK_OBJECT (dlg), "ctree", ctree);
gtk_widget_show (ctree);
- gtk_container_add (GTK_CONTAINER (scr), ctree);
+ gtk_paned_add1 (GTK_PANED (hsplit), ctree);
gtk_clist_column_titles_hide (GTK_CLIST (ctree));
gtk_clist_set_selection_mode (GTK_CLIST (ctree), GTK_SELECTION_BROWSE);
gtk_signal_connect (GTK_OBJECT (ctree), "tree_select_row",
@@ -2994,8 +2937,6 @@ int librarydlg_execute (void *param)
gtk_grab_add (dlg);
gtk_widget_show (dlg);
- last_dlg = dlg;
-
while (loop)
gtk_main_iteration ();
@@ -3008,8 +2949,20 @@ int librarydlg_execute (void *param)
gtk_widget_destroy (dlg);
return ret;
+#endif
+ return LC_OK;
}
+#else
+
+int librarydlg_execute (void *param)
+{
+ // TODO: FIXME !
+ return 0;
+}
+
+#endif
+
// =============================================================================
// Modify Dialog
diff --git a/linux/dialogs.h b/linux/dialogs.h
index 1cacd8b..cf69fc3 100644
--- a/linux/dialogs.h
+++ b/linux/dialogs.h
@@ -18,7 +18,7 @@ int openprojectdlg_execute (char* filename);
int saveprojectdlg_execute (char* filename);
int savepicturedlg_execute (void* param);
int msgbox_execute (const char* text, const char *caption, int flags);
-int filedlg_execute(const char* caption, char* filename);
+int filedlg_execute(char* caption, char* filename);
int arraydlg_execute(void* param);
int aboutdlg_execute(void* param);
int htmldlg_execute(void* param);
diff --git a/linux/gtkmisc.cpp b/linux/gtkmisc.cpp
index 9bc5ae0..e0d1d5e 100755
--- a/linux/gtkmisc.cpp
+++ b/linux/gtkmisc.cpp
@@ -32,7 +32,7 @@
// Load a pixmap file from the disk
void load_pixmap (const char* filename, GdkPixmap **gdkpixmap, GdkBitmap **mask)
{
- struct { const char* name; const char** data; } table[14] =
+ struct { char* name; char** data; } table[14] =
{
{ "vports01.xpm", vports01 },
{ "vports02.xpm", vports02 },
@@ -54,19 +54,19 @@ void load_pixmap (const char* filename, GdkPixmap **gdkpixmap, GdkBitmap **mask)
for (int i = 0; i < 14; i++)
if (strcmp (table[i].name, filename) == 0)
{
- *gdkpixmap = gdk_pixmap_create_from_xpm_d (GDK_ROOT_PARENT(), mask, NULL, (gchar**)table[i].data);
+ *gdkpixmap = gdk_pixmap_create_from_xpm_d (GDK_ROOT_PARENT(), mask, NULL, table[i].data);
break;
}
if (*gdkpixmap == NULL)
{
- const char *dummy[] = { "1 1 1 1", " c None", " " };
- *gdkpixmap = gdk_pixmap_create_from_xpm_d (GDK_ROOT_PARENT(), mask, NULL, (gchar**)dummy);
+ char *dummy[] = { "1 1 1 1", " c None", " " };
+ *gdkpixmap = gdk_pixmap_create_from_xpm_d (GDK_ROOT_PARENT(), mask, NULL, dummy);
}
}
// Load a xpm file and return a pixmap widget
-GtkWidget* create_pixmap (const char* filename)
+GtkWidget* create_pixmap (char* filename)
{
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
@@ -103,7 +103,7 @@ GtkWidget* menu_tearoff (GtkWidget *menu)
return menu_item;
}
-GtkWidget* create_sub_menu(GtkWidget* bar, const char* label, GtkAccelGroup* accel)
+GtkWidget* create_sub_menu (GtkWidget *bar, char *label, GtkAccelGroup *accel)
{
GtkWidget *item, *menu;
@@ -117,7 +117,7 @@ GtkWidget* create_sub_menu(GtkWidget* bar, const char* label, GtkAccelGroup* acc
return menu;
}
-GtkWidget* create_menu_in_menu(GtkWidget* menu, const char* label, GtkAccelGroup* accel)
+GtkWidget* create_menu_in_menu (GtkWidget *menu, gchar *label, GtkAccelGroup *accel)
{
GtkWidget *item, *submenu;
@@ -131,8 +131,8 @@ GtkWidget* create_menu_in_menu(GtkWidget* menu, const char* label, GtkAccelGroup
return submenu;
}
-GtkWidget* create_menu_item(GtkWidget *menu, const char *label, GtkAccelGroup *menu_accel,
- GtkSignalFunc func, GtkObject *window, int id, const char* data)
+GtkWidget* create_menu_item (GtkWidget *menu, gchar *label, GtkAccelGroup *menu_accel,
+ GtkSignalFunc func, GtkObject *window, int id, const char* data)
{
GtkWidget *item;
@@ -147,8 +147,8 @@ GtkWidget* create_menu_item(GtkWidget *menu, const char *label, GtkAccelGroup *m
return item;
}
-GtkWidget* create_pixmap_menu_item(GtkWidget *menu, const gchar *label, const char **pixmap, GtkAccelGroup *menu_accel,
- GtkSignalFunc func, GtkObject *window, int id, const char* data)
+GtkWidget* create_pixmap_menu_item (GtkWidget *menu, gchar *label, gchar **pixmap, GtkAccelGroup *menu_accel,
+ GtkSignalFunc func, GtkObject *window, int id, const char* data)
{
GtkWidget *item, *pixmap_widget;
@@ -168,8 +168,8 @@ GtkWidget* create_pixmap_menu_item(GtkWidget *menu, const gchar *label, const ch
return item;
}
-GtkWidget* create_check_menu_item(GtkWidget *menu, const char *label, GtkAccelGroup *menu_accel,
- GtkSignalFunc func, GtkObject *window, int id, const char* data)
+GtkWidget* create_check_menu_item (GtkWidget *menu, gchar *label, GtkAccelGroup *menu_accel,
+ GtkSignalFunc func, GtkObject *window, int id, const char* data)
{
GtkWidget *item;
@@ -184,9 +184,9 @@ GtkWidget* create_check_menu_item(GtkWidget *menu, const char *label, GtkAccelGr
return item;
}
-GtkWidget* create_radio_menu_item(GtkWidget *menu, GtkWidget *last, const char *label,
- GtkAccelGroup *menu_accel, GtkSignalFunc func,
- GtkObject *window, int id, const char* data)
+GtkWidget* create_radio_menu_item (GtkWidget *menu, GtkWidget *last, gchar *label,
+ GtkAccelGroup *menu_accel, GtkSignalFunc func,
+ GtkObject *window, int id, const char* data)
{
GtkWidget *item;
GSList *group = NULL;
@@ -204,9 +204,9 @@ GtkWidget* create_radio_menu_item(GtkWidget *menu, GtkWidget *last, const char *
return item;
}
-GtkWidget* create_radio_menu_pixmap(GtkWidget *menu, GtkWidget *last, const char *filename,
- GtkAccelGroup *menu_accel, GtkSignalFunc func,
- GtkObject *window, int id, const char* data)
+GtkWidget* create_radio_menu_pixmap (GtkWidget *menu, GtkWidget *last, gchar *filename,
+ GtkAccelGroup *menu_accel, GtkSignalFunc func,
+ GtkObject *window, int id, const char* data)
{
GtkWidget *item, *pixmap;
GSList *group = NULL;
diff --git a/linux/gtkmisc.h b/linux/gtkmisc.h
index fac67a7..eed42d3 100755
--- a/linux/gtkmisc.h
+++ b/linux/gtkmisc.h
@@ -4,22 +4,22 @@
GtkWidget* create_pixmap (char* filename);
void load_pixmap (const char* filename, GdkPixmap **gdkpixmap, GdkBitmap **mask);
-GtkWidget* menu_separator(GtkWidget *menu);
-GtkWidget* menu_tearoff(GtkWidget *menu);
-GtkWidget* create_sub_menu(GtkWidget *bar, const char *label, GtkAccelGroup *accel);
-GtkWidget* create_menu_in_menu(GtkWidget *menu, const char *label, GtkAccelGroup *accel);
-GtkWidget* create_menu_item(GtkWidget *menu, const char *label, GtkAccelGroup *accel,
- GtkSignalFunc func, GtkObject *window, int id, const char* data);
-GtkWidget* create_pixmap_menu_item(GtkWidget *menu, const char *label, const char **pixmap, GtkAccelGroup *accel,
- GtkSignalFunc func, GtkObject *window, int id, const char* data);
-GtkWidget* create_check_menu_item(GtkWidget *menu, const char *label, GtkAccelGroup *menu_accel,
- GtkSignalFunc func, GtkObject *window, int id, const char* data);
-GtkWidget* create_radio_menu_item(GtkWidget *menu, GtkWidget *last, const char *label,
- GtkAccelGroup *menu_accel, GtkSignalFunc func,
- GtkObject *window, int id, const char* data);
-GtkWidget* create_radio_menu_pixmap(GtkWidget *menu, GtkWidget *last, const char *filename,
- GtkAccelGroup *menu_accel, GtkSignalFunc func,
- GtkObject *window, int id, const char* data);
+GtkWidget* menu_separator (GtkWidget *menu);
+GtkWidget* menu_tearoff (GtkWidget *menu);
+GtkWidget* create_sub_menu (GtkWidget *bar, char *label, GtkAccelGroup *accel);
+GtkWidget* create_menu_in_menu (GtkWidget *menu, gchar *label, GtkAccelGroup *accel);
+GtkWidget* create_menu_item (GtkWidget *menu, gchar *label, GtkAccelGroup *accel,
+ GtkSignalFunc func, GtkObject *window, int id, const char* data);
+GtkWidget* create_pixmap_menu_item (GtkWidget *menu, gchar *label, gchar **pixmap, GtkAccelGroup *accel,
+ GtkSignalFunc func, GtkObject *window, int id, const char* data);
+GtkWidget* create_check_menu_item (GtkWidget *menu, gchar *label, GtkAccelGroup *menu_accel,
+ GtkSignalFunc func, GtkObject *window, int id, const char* data);
+GtkWidget* create_radio_menu_item (GtkWidget *menu, GtkWidget *last, gchar *label,
+ GtkAccelGroup *menu_accel, GtkSignalFunc func,
+ GtkObject *window, int id, const char* data);
+GtkWidget* create_radio_menu_pixmap (GtkWidget *menu, GtkWidget *last, gchar *filename,
+ GtkAccelGroup *menu_accel, GtkSignalFunc func,
+ GtkObject *window, int id, const char* data);
#endif // _GTKMISC_H_
diff --git a/linux/gtktools.cpp b/linux/gtktools.cpp
index 40cf51e..d285ce5 100644
--- a/linux/gtktools.cpp
+++ b/linux/gtktools.cpp
@@ -4,22 +4,23 @@
#include <gtk/gtk.h>
#include "gtktools.h"
-GtkWidget* new_pixmap(GtkWidget *widget, const char **data)
+GtkWidget* new_pixmap (GtkWidget *widget, char **data)
{
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
- gdkpixmap = gdk_pixmap_create_from_xpm_d(widget->window, &mask, &widget->style->bg[GTK_STATE_NORMAL], (gchar**)data);
- pixmap = gtk_pixmap_new(gdkpixmap, mask);
+ gdkpixmap = gdk_pixmap_create_from_xpm_d (widget->window, &mask,
+ &widget->style->bg[GTK_STATE_NORMAL], data);
+ pixmap = gtk_pixmap_new (gdkpixmap, mask);
- gdk_pixmap_unref(gdkpixmap);
- gdk_pixmap_unref(mask);
+ gdk_pixmap_unref (gdkpixmap);
+ gdk_pixmap_unref (mask);
return pixmap;
}
-GtkWidget* clist_title_with_arrow(GtkWidget* clist, char col, const char* label_text)
+GtkWidget* clist_title_with_arrow (GtkWidget* clist, char col, char* label_text)
{
GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
GtkWidget *arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
@@ -31,11 +32,10 @@ GtkWidget* clist_title_with_arrow(GtkWidget* clist, char col, const char* label_
gtk_widget_show (hbox);
gtk_clist_set_column_widget (GTK_CLIST (clist), col, hbox);
-
return arrow;
}
-void set_notebook_tab(GtkWidget *notebook, gint page_num, GtkWidget *widget)
+void set_notebook_tab (GtkWidget *notebook, gint page_num, GtkWidget *widget)
{
gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num), widget);
/*
@@ -52,7 +52,7 @@ void set_notebook_tab(GtkWidget *notebook, gint page_num, GtkWidget *widget)
*/
}
-void set_button_pixmap(GtkWidget* widget, float* color)
+void set_button_pixmap (GtkWidget* widget, float* color)
{
if (widget->window == NULL)
return;
@@ -79,7 +79,7 @@ void set_button_pixmap(GtkWidget* widget, float* color)
gdk_gc_destroy(gc);
}
-void set_button_pixmap2(GtkWidget* widget, unsigned char* color)
+void set_button_pixmap2 (GtkWidget* widget, unsigned char* color)
{
GdkColor c;
GdkGC* gc;
diff --git a/linux/gtktools.h b/linux/gtktools.h
index e0a4207..e524500 100644
--- a/linux/gtktools.h
+++ b/linux/gtktools.h
@@ -2,11 +2,11 @@
#ifndef _GTKTOOLS_H_
#define _GTKTOOLS_H_
-GtkWidget* new_pixmap(GtkWidget* widget, const char** data);
-GtkWidget* clist_title_with_arrow(GtkWidget* clist, char col, const char* label_text);
-void set_notebook_tab(GtkWidget* notebook, gint page_num, GtkWidget* widget);
-void set_button_pixmap(GtkWidget* widget, float* color);
-void set_button_pixmap2(GtkWidget* widget, unsigned char* color);
+GtkWidget* new_pixmap (GtkWidget *widget, char **data);
+GtkWidget* clist_title_with_arrow (GtkWidget* clist, char col, char* label_text);
+void set_notebook_tab (GtkWidget *notebook, gint page_num, GtkWidget *widget);
+void set_button_pixmap (GtkWidget* widget, float* color);
+void set_button_pixmap2 (GtkWidget* widget, unsigned char* color);
#endif // _GTKTOOLS_H_
diff --git a/linux/libdlg.cpp b/linux/libdlg.cpp
deleted file mode 100644
index ad741e3..0000000
--- a/linux/libdlg.cpp
+++ /dev/null
@@ -1,432 +0,0 @@
-// LibDlg.cpp : implementation file
-//
-
-#include <limits.h>
-//#include "leocad.h"
-#include "libdlg.h"
-//#include "GroupDlg.h"
-//#include "Print.h"
-//#include "Tools.h"
-#include "project.h"
-#include "pieceinf.h"
-#include "globals.h"
-#include "system.h"
-#include "library.h"
-#include "lc_application.h"
-
-bool LibraryDialog::HandleCommand(int id)
-{
- switch (id)
- {
- case LC_LIBDLG_FILE_OPEN:
- {
- lcGetPiecesLibrary()->LoadCategories(NULL);
-// UpdateTree();
- return true;
- }
-
- case LC_LIBDLG_FILE_SAVE:
- {
- lcGetPiecesLibrary()->DoSaveCategories(false);
- return true;
- }
-
- case LC_LIBDLG_FILE_SAVEAS:
- {
- lcGetPiecesLibrary()->DoSaveCategories(true);
- return true;
- }
-
-/*
- case LC_LIBDLG_FILE_PRINTCATALOG:
- {
- PRINT_PARAMS* param = (PRINT_PARAMS*)malloc(sizeof(PRINT_PARAMS));
- param->pParent = this;
- param->pMainFrame = (CFrameWnd*)AfxGetMainWnd();
- AfxBeginThread(PrintCatalogFunction, param);
-
- return true;
- }
-*/
-
- case LC_LIBDLG_FILE_MERGEUPDATE:
- {
- char filename[PATH_MAX];
- LC_FILEOPENDLG_OPTS opts;
-
- strcpy(opts.path, "");
- opts.type = LC_FILEOPENDLG_LUP;
-
- if (SystemDoDialog(LC_DLG_FILE_OPEN, filename))
- {
- lcGetPiecesLibrary()->LoadUpdate(filename);
-// UpdateTree();
- }
-
- return true;
- }
-
- case LC_LIBDLG_FILE_IMPORTPIECE:
- {
- char filename[PATH_MAX];
- LC_FILEOPENDLG_OPTS opts;
-
- strcpy(opts.path, Sys_ProfileLoadString ("Default", "LDraw Pieces Path", ""));
- opts.type = LC_FILEOPENDLG_DAT;
-
- if (SystemDoDialog (LC_DLG_FILE_OPEN, filename))
- {
-/*
- for (int i = 0; i < opts.numfiles; i++)
- {
- lcGetPiecesLibrary ()->ImportLDrawPiece (opts.filenames[i]);
- free (opts.filenames[i]);
- }
- free (opts.filenames);
-*/
- lcGetPiecesLibrary ()->ImportLDrawPiece (filename);
- Sys_ProfileSaveString ("Default", "LDraw Pieces Path", filename);
-
-// UpdateList();
- }
-
- return true;
- }
-
-/*
- case LC_LIBDLG_FILE_TEXTURES:
- {
- CTexturesDlg dlg;
- dlg.DoModal();
- } break;
-*/
-
- case LC_LIBDLG_CATEGORY_RESET:
- {
- if (SystemDoMessageBox("Are you sure you want to reset the categories?", LC_MB_YESNO | LC_MB_ICONQUESTION) == LC_YES)
- {
- lcGetPiecesLibrary()->ResetCategories();
-
-// UpdateList();
-// UpdateTree();
- }
-
- return true;
- }
-
- case LC_LIBDLG_CATEGORY_NEW:
- {
- LC_CATEGORYDLG_OPTS Opts;
- Opts.Name = "New Category";
- Opts.Keywords = "";
-
- if (SystemDoDialog(LC_DLG_EDITCATEGORY, &Opts))
- {
- lcGetPiecesLibrary()->AddCategory(Opts.Name, Opts.Keywords);
- }
-
-// UpdateTree();
-
- return true;
- }
-
- case LC_LIBDLG_CATEGORY_REMOVE:
- {
-/*
- HTREEITEM Item = m_Tree.GetSelectedItem();
-
- if (Item == NULL)
- break;
-
- PiecesLibrary* Lib = lcGetPiecesLibrary();
- CString CategoryName = m_Tree.GetItemText(Item);
- int Index = Lib->FindCategoryIndex((const char*)CategoryName);
-
- if (Index == -1)
- break;
-
- char Msg[1024];
- String Name = Lib->GetCategoryName(Index);
- sprintf(Msg, "Are you sure you want to remove the %s category?", Name);
-
- if (SystemDoMessageBox(Msg, LC_MB_YESNO | LC_MB_ICONQUESTION) == LC_YES)
- {
- Lib->RemoveCategory(Index);
- }
-
- UpdateTree();
-*/
- return true;
- }
-
- case LC_LIBDLG_CATEGORY_EDIT:
- {
-/*
- HTREEITEM Item = m_Tree.GetSelectedItem();
-
- if (Item == NULL)
- break;
-
- PiecesLibrary* Lib = lcGetPiecesLibrary();
- CString CategoryName = m_Tree.GetItemText(Item);
- int Index = Lib->FindCategoryIndex((const char*)CategoryName);
-
- if (Index == -1)
- break;
-
- LC_CATEGORYDLG_OPTS Opts;
- Opts.Name = Lib->GetCategoryName(Index);
- Opts.Keywords = Lib->GetCategoryKeywords(Index);
-
- if (SystemDoDialog(LC_DLG_EDITCATEGORY, &Opts))
- {
- String OldName = Lib->GetCategoryName(Index);
- Lib->SetCategory(Index, Opts.Name, Opts.Keywords);
- }
-
- UpdateTree();
-
-*/
- return true;
- }
-
- case LC_LIBDLG_PIECE_NEW:
- {
- return true;
- }
-
- case LC_LIBDLG_PIECE_EDIT:
- {
- return true;
- }
-
- case LC_LIBDLG_PIECE_DELETE:
- {
-/*
- PtrArray<PieceInfo> Pieces;
-
- for (int i = 0; i < m_List.GetItemCount(); i++)
- {
- if (m_List.GetItemState(i, LVIS_SELECTED))
- Pieces.Add((PieceInfo*)m_List.GetItemData(i));
- }
-
- if (Pieces.GetSize() == 0)
- return true;
-
- if (SystemDoMessageBox ("Are you sure you want to permanently delete the selected pieces?", LC_MB_YESNO|LC_MB_ICONQUESTION) != LC_YES)
- return true;
-
- lcGetPiecesLibrary()->DeletePieces(Pieces);
-
- UpdateList();
-*/
- return true;
- }
- }
-
-// return CDialog::OnCommand(wParam, lParam);
- return true;
-}
-
-/*
-void CLibraryDlg::UpdateList()
-{
- m_List.DeleteAllItems();
- m_List.SetRedraw(false);
-
- PiecesLibrary *Lib = lcGetPiecesLibrary();
-
- HTREEITEM CategoryItem = m_Tree.GetSelectedItem();
- CString CategoryName = m_Tree.GetItemText(CategoryItem);
- int CategoryIndex = Lib->FindCategoryIndex((const char*)CategoryName);
-
- if (CategoryIndex != -1)
- {
- PtrArray<PieceInfo> SinglePieces, GroupedPieces;
-
- Lib->GetCategoryEntries(CategoryIndex, false, SinglePieces, GroupedPieces);
-
- for (int i = 0; i < SinglePieces.GetSize(); i++)
- {
- PieceInfo* Info = SinglePieces[i];
-
- LVITEM lvi;
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.iItem = 0;
- lvi.iSubItem = 0;
- lvi.lParam = (LPARAM)Info;
- lvi.pszText = Info->m_strDescription;
- int idx = m_List.InsertItem(&lvi);
-
- m_List.SetItemText(idx, 1, Info->m_strName);
- }
- }
- else
- {
- if (CategoryName == "Unassigned")
- {
- // Test each piece against all categories.
- for (int i = 0; i < Lib->GetPieceCount(); i++)
- {
- PieceInfo* Info = Lib->GetPieceInfo(i);
-
- for (int j = 0; j < Lib->GetNumCategories(); j++)
- {
- if (Lib->PieceInCategory(Info, Lib->GetCategoryKeywords(j)))
- break;
- }
-
- if (j == Lib->GetNumCategories())
- {
- LVITEM lvi;
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.iItem = 0;
- lvi.iSubItem = 0;
- lvi.lParam = (LPARAM)Info;
- lvi.pszText = Info->m_strDescription;
- int idx = m_List.InsertItem(&lvi);
-
- m_List.SetItemText(idx, 1, Info->m_strName);
- }
- }
- }
- else if (CategoryName == "Pieces")
- {
- for (int i = 0; i < Lib->GetPieceCount(); i++)
- {
- PieceInfo* Info = Lib->GetPieceInfo(i);
-
- LVITEM lvi;
- lvi.mask = LVIF_TEXT | LVIF_PARAM;
- lvi.iItem = 0;
- lvi.iSubItem = 0;
- lvi.lParam = (LPARAM)Info;
- lvi.pszText = Info->m_strDescription;
- int idx = m_List.InsertItem(&lvi);
-
- m_List.SetItemText(idx, 1, Info->m_strName);
- }
- }
- }
-
- m_List.SortItems((PFNLVCOMPARE)ListCompare, m_SortColumn);
- m_List.SetRedraw(true);
-}
-
-void CLibraryDlg::UpdateTree()
-{
- m_Tree.SetRedraw(false);
- m_Tree.DeleteAllItems();
-
- HTREEITEM Root = m_Tree.InsertItem(TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT, "Pieces", 0, 1, 0, 0, 0, TVI_ROOT, TVI_SORT);
-
- PiecesLibrary *Lib = lcGetPiecesLibrary();
- for (int i = 0; i < Lib->GetNumCategories(); i++)
- m_Tree.InsertItem(TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT, Lib->GetCategoryName(i), 0, 1, 0, 0, 0, Root, TVI_SORT);
-
- m_Tree.InsertItem(TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM|TVIF_TEXT, "Unassigned", 0, 1, 0, 0, 0, Root, TVI_LAST);
-
- m_Tree.Expand(Root, TVE_EXPAND);
- m_Tree.SetRedraw(true);
- m_Tree.Invalidate();
-}
-
-void CLibraryDlg::OnSelChangedTree(NMHDR* pNMHDR, LRESULT* pResult)
-{
- NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
- UpdateList();
- *pResult = 0;
-}
-
-void CLibraryDlg::OnCancel()
-{
- // Check if it's ok to close the dialog
- if (!lcGetPiecesLibrary()->SaveCategories())
- return;
-
- CDialog::OnCancel();
-}
-
-void CLibraryDlg::OnOK()
-{
- // Check if it's ok to close the dialog
- if (!lcGetPiecesLibrary()->SaveCategories())
- return;
-
- CDialog::OnOK();
-}
-
-BOOL CLibraryDlg::ContinueModal()
-{
- HTREEITEM h = m_Tree.GetSelectedItem();
- BOOL bValid = (h != m_Tree.GetRootItem()) && (h != NULL);
-
- EnableControl(LC_LIBDLG_GROUP_RENAME, bValid);
- EnableControl(LC_LIBDLG_GROUP_DELETE, bValid);
-
- return CDialog::ContinueModal();
-}
-
-void CLibraryDlg::EnableControl(UINT nID, BOOL bEnable)
-{
- GetMenu()->GetSubMenu(1)->EnableMenuItem(nID, MF_BYCOMMAND | (bEnable ? MF_ENABLED : (MF_DISABLED | MF_GRAYED)));
- int state = m_wndToolBar.GetToolBarCtrl().GetState(nID) & ~TBSTATE_ENABLED;
- if (bEnable)
- state |= TBSTATE_ENABLED;
- m_wndToolBar.GetToolBarCtrl().SetState(nID, state);
-}
-
-BOOL CLibraryDlg::OnToolTipText(UINT, NMHDR* pNMHDR, LRESULT* pResult)
-{
- ASSERT(pNMHDR->code == TTN_NEEDTEXTA || pNMHDR->code == TTN_NEEDTEXTW);
-
- // allow top level routing frame to handle the message
- if (GetRoutingFrame() != NULL)
- return false;
-
- // need to handle both ANSI and UNICODE versions of the message
- TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
- TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
- CString cstTipText;
- UINT nID = pNMHDR->idFrom;
-
- if (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
- pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
- {
- // idFrom is actually the HWND of the tool
- nID = ((UINT)(WORD)::GetDlgCtrlID((HWND)nID));
- }
-
- if (nID != 0) // will be zero on a separator
- {
- cstTipText.LoadString(nID);
- }
-
- // Non-UNICODE Strings only are shown in the tooltip window...
- if (pNMHDR->code == TTN_NEEDTEXTA)
- lstrcpyn(pTTTA->szText, cstTipText, (sizeof(pTTTA->szText)/sizeof(pTTTA->szText[0])));
- else
- _mbstowcsz(pTTTW->szText, cstTipText, (sizeof(pTTTW->szText)/sizeof(pTTTW->szText[0])));
-
- *pResult = 0;
-
- // bring the tooltip window above other popup windows
- ::SetWindowPos(pNMHDR->hwndFrom, HWND_TOP, 0, 0, 0, 0,
- SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE);
-
- return true; // message was handled
-}
-
-void CLibraryDlg::OnListColumnClick(NMHDR* pNMHDR, LRESULT* pResult)
-{
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
-
- // Save the column index.
- m_SortColumn = pNMListView->iSubItem;
-
- m_List.SortItems((PFNLVCOMPARE)ListCompare, m_SortColumn);
-
- *pResult = 0;
-}
-*/
diff --git a/linux/libdlg.h b/linux/libdlg.h
deleted file mode 100644
index f4a762b..0000000
--- a/linux/libdlg.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _LIBDLG_H_
-#define _LIBDLG_H_
-
-class PieceInfo;
-
-// =============================================================================
-// LibraryDialog class
-
-class LibraryDialog {
-public:
- bool HandleCommand(int id);
-};
-
-#endif // _LIBDLG_H_
diff --git a/linux/main.cpp b/linux/main.cpp
index e83687b..2e482bc 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -328,16 +328,6 @@ static gint key_press_event(GtkWidget* widget, GdkEventKey* event, gpointer data
}
}
- if ((code >= '0') && (code <= '9') && ((event->state & GDK_CONTROL_MASK) == 0))
- {
- if (event->state & GDK_SHIFT_MASK)
- lcGetActiveProject()->HandleCommand((LC_COMMANDS)(LC_EDIT_MOVEZ_SNAP_0 + code - '0'), 0);
- else
- lcGetActiveProject()->HandleCommand((LC_COMMANDS)(LC_EDIT_MOVEXY_SNAP_0 + code - '0'), 0);
-
- return TRUE;
- }
-
if (code != 0)
{
if (lcGetActiveProject()->OnKeyDown(code, (event->state & GDK_CONTROL_MASK) != 0,
@@ -674,8 +664,8 @@ int main (int argc, char* argv[])
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
- gdkpixmap = gdk_pixmap_create_from_xpm_d(((GtkWidget*)(*main_window))->window, &mask,
- &((GtkWidget*)(*main_window))->style->bg[GTK_STATE_NORMAL], (gchar**)icon32);
+ gdkpixmap = gdk_pixmap_create_from_xpm_d (((GtkWidget*)(*main_window))->window, &mask,
+ &((GtkWidget*)(*main_window))->style->bg[GTK_STATE_NORMAL], icon32);
gdk_window_set_icon (((GtkWidget*)(*main_window))->window, NULL, gdkpixmap, mask);
gtk_widget_show (GTK_WIDGET (((GtkWidget*)(*main_window))));
diff --git a/linux/menu.cpp b/linux/menu.cpp
index 6b3db7b..8d48354 100644
--- a/linux/menu.cpp
+++ b/linux/menu.cpp
@@ -59,10 +59,6 @@ void create_main_menu (GtkObject *window, GtkWidget *vbox)
window, LC_FILE_HTML, "menu_file_html");
create_menu_item (menu_in_menu, "_POV-Ray...", accel, GTK_SIGNAL_FUNC (OnCommandDirect),
window, LC_FILE_POVRAY, "menu_file_povray");
- create_menu_item (menu_in_menu, "_VRML97...", accel, GTK_SIGNAL_FUNC (OnCommandDirect),
- window, LC_FILE_VRML97, "menu_file_vrml97");
- create_menu_item (menu_in_menu, "_Rigid Body Physics X3DV Draft...", accel, GTK_SIGNAL_FUNC (OnCommandDirect),
- window, LC_FILE_X3DV, "menu_file_x3dv");
create_menu_item (menu_in_menu, "_Wavefront...", accel, GTK_SIGNAL_FUNC (OnCommandDirect),
window, LC_FILE_WAVEFRONT, "menu_file_wavefront");
menu_separator (menu);
diff --git a/linux/module.mk b/linux/module.mk
index fe45824..853b7e7 100644
--- a/linux/module.mk
+++ b/linux/module.mk
@@ -2,4 +2,4 @@ SRC += linux/profile.cpp \
linux/dialogs.cpp linux/dlgpiece.cpp linux/dlgfile.cpp \
linux/gtktools.cpp linux/main.cpp linux/menu.cpp \
linux/system.cpp linux/toolbar.cpp linux/gtkmisc.cpp \
- linux/linux_gl.cpp linux/basewnd.cpp linux/glwindow.cpp linux/libdlg.cpp
+ linux/linux_gl.cpp linux/basewnd.cpp linux/glwindow.cpp
diff --git a/linux/pixmaps/ac-brick.xpm b/linux/pixmaps/ac-brick.xpm
index b034104..f56ac14 100644
--- a/linux/pixmaps/ac-brick.xpm
+++ b/linux/pixmaps/ac-brick.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_brick[] = {
+static char *ac_brick[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c #00007f",
diff --git a/linux/pixmaps/ac-cam.xpm b/linux/pixmaps/ac-cam.xpm
index cfb6913..00516b9 100644
--- a/linux/pixmaps/ac-cam.xpm
+++ b/linux/pixmaps/ac-cam.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* ac_cam[] = {
+static char * ac_cam[] = {
"16 15 6 1",
". c None",
"+ c #7F7F7F",
diff --git a/linux/pixmaps/ac-erase.xpm b/linux/pixmaps/ac-erase.xpm
index 650f0e4..afce83f 100644
--- a/linux/pixmaps/ac-erase.xpm
+++ b/linux/pixmaps/ac-erase.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_erase[] = {
+static char *ac_erase[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-light.xpm b/linux/pixmaps/ac-light.xpm
index 388b959..d3aeb7e 100644
--- a/linux/pixmaps/ac-light.xpm
+++ b/linux/pixmaps/ac-light.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* ac_light[] = {
+static char * ac_light[] = {
"16 15 5 1",
". c None",
"+ c #000000",
diff --git a/linux/pixmaps/ac-move.xpm b/linux/pixmaps/ac-move.xpm
index 845cca4..df6f9a1 100644
--- a/linux/pixmaps/ac-move.xpm
+++ b/linux/pixmaps/ac-move.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_move[] = {
+static char *ac_move[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-next.xpm b/linux/pixmaps/ac-next.xpm
index 4f9d417..e1bb7a0 100644
--- a/linux/pixmaps/ac-next.xpm
+++ b/linux/pixmaps/ac-next.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_next[] = {
+static char *ac_next[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-paint.xpm b/linux/pixmaps/ac-paint.xpm
index ba511da..416542d 100644
--- a/linux/pixmaps/ac-paint.xpm
+++ b/linux/pixmaps/ac-paint.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_paint[] = {
+static char *ac_paint[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-pan.xpm b/linux/pixmaps/ac-pan.xpm
index ce88b77..1b312c7 100644
--- a/linux/pixmaps/ac-pan.xpm
+++ b/linux/pixmaps/ac-pan.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_pan[] = {
+static char *ac_pan[] = {
"16 15 5 1",
". c None",
"+ c #000000",
diff --git a/linux/pixmaps/ac-prev.xpm b/linux/pixmaps/ac-prev.xpm
index 1bfcdd3..0e8b3aa 100644
--- a/linux/pixmaps/ac-prev.xpm
+++ b/linux/pixmaps/ac-prev.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_prev[] = {
+static char *ac_prev[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-roll.xpm b/linux/pixmaps/ac-roll.xpm
index c61ff1a..ab2dc78 100644
--- a/linux/pixmaps/ac-roll.xpm
+++ b/linux/pixmaps/ac-roll.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_roll[] = {
+static char *ac_roll[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-rot.xpm b/linux/pixmaps/ac-rot.xpm
index 360f69c..e02a276 100644
--- a/linux/pixmaps/ac-rot.xpm
+++ b/linux/pixmaps/ac-rot.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_rot[] = {
+static char *ac_rot[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-rotv.xpm b/linux/pixmaps/ac-rotv.xpm
index 94b441d..16ef97f 100644
--- a/linux/pixmaps/ac-rotv.xpm
+++ b/linux/pixmaps/ac-rotv.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_rotv[] = {
+static char *ac_rotv[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-sel.xpm b/linux/pixmaps/ac-sel.xpm
index fef7ec5..5a0d157 100644
--- a/linux/pixmaps/ac-sel.xpm
+++ b/linux/pixmaps/ac-sel.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_sel[] = {
+static char *ac_sel[] = {
/* columns rows colors chars-per-pixel */
"16 15 2 1",
" c Gray0",
diff --git a/linux/pixmaps/ac-spot.xpm b/linux/pixmaps/ac-spot.xpm
index 4ad9388..cc96760 100644
--- a/linux/pixmaps/ac-spot.xpm
+++ b/linux/pixmaps/ac-spot.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* ac_spot[] = {
+static char * ac_spot[] = {
"16 15 6 1",
". c None",
"+ c #000000",
diff --git a/linux/pixmaps/ac-zoom.xpm b/linux/pixmaps/ac-zoom.xpm
index b5dc0cc..86d5ba7 100644
--- a/linux/pixmaps/ac-zoom.xpm
+++ b/linux/pixmaps/ac-zoom.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_zoom[] = {
+static char *ac_zoom[] = {
"16 15 7 1",
". c None",
"+ c #00007F",
diff --git a/linux/pixmaps/ac-zoome.xpm b/linux/pixmaps/ac-zoome.xpm
index 60833fb..e7a0b4c 100644
--- a/linux/pixmaps/ac-zoome.xpm
+++ b/linux/pixmaps/ac-zoome.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_zoome[] = {
+static char *ac_zoome[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c #00007f",
diff --git a/linux/pixmaps/ac-zoomr.xpm b/linux/pixmaps/ac-zoomr.xpm
index 8d6188c..bbbb268 100644
--- a/linux/pixmaps/ac-zoomr.xpm
+++ b/linux/pixmaps/ac-zoomr.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*ac_zoomr[] = {
+static char *ac_zoomr[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c Gray0",
diff --git a/linux/pixmaps/an-anim.xpm b/linux/pixmaps/an-anim.xpm
index 04b21f2..77003b6 100644
--- a/linux/pixmaps/an-anim.xpm
+++ b/linux/pixmaps/an-anim.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* an_anim[] = {
+static char * an_anim[] = {
"16 15 5 1",
". c #000000",
"+ c #7F7F7F",
diff --git a/linux/pixmaps/an-first.xpm b/linux/pixmaps/an-first.xpm
index d27c819..50be91d 100644
--- a/linux/pixmaps/an-first.xpm
+++ b/linux/pixmaps/an-first.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_first[] = {
+static char *an_first[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c #00007f",
diff --git a/linux/pixmaps/an-key.xpm b/linux/pixmaps/an-key.xpm
index 546c269..67ea35c 100644
--- a/linux/pixmaps/an-key.xpm
+++ b/linux/pixmaps/an-key.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_key[] = {
+static char *an_key[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c Gray0",
diff --git a/linux/pixmaps/an-last.xpm b/linux/pixmaps/an-last.xpm
index 14ffa05..d603cca 100644
--- a/linux/pixmaps/an-last.xpm
+++ b/linux/pixmaps/an-last.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_last[] = {
+static char *an_last[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c #00007f",
diff --git a/linux/pixmaps/an-next.xpm b/linux/pixmaps/an-next.xpm
index 891a24e..93bbbf8 100644
--- a/linux/pixmaps/an-next.xpm
+++ b/linux/pixmaps/an-next.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_next[] = {
+static char *an_next[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c #00007f",
diff --git a/linux/pixmaps/an-play.xpm b/linux/pixmaps/an-play.xpm
index f1f0aad..e07663c 100644
--- a/linux/pixmaps/an-play.xpm
+++ b/linux/pixmaps/an-play.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_play[] = {
+static char *an_play[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c #00007f",
diff --git a/linux/pixmaps/an-prev.xpm b/linux/pixmaps/an-prev.xpm
index b0ef885..01e536d 100644
--- a/linux/pixmaps/an-prev.xpm
+++ b/linux/pixmaps/an-prev.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_prev[] = {
+static char *an_prev[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c #00007f",
diff --git a/linux/pixmaps/an-stop.xpm b/linux/pixmaps/an-stop.xpm
index a70eb48..a15274b 100644
--- a/linux/pixmaps/an-stop.xpm
+++ b/linux/pixmaps/an-stop.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*an_stop[] = {
+static char *an_stop[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c #00007f",
diff --git a/linux/pixmaps/cr_brick.xpm b/linux/pixmaps/cr_brick.xpm
index 2595cf2..78b9a0c 100644
--- a/linux/pixmaps/cr_brick.xpm
+++ b/linux/pixmaps/cr_brick.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_brick[] = {
+static char *cr_brick[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_cam.xpm b/linux/pixmaps/cr_cam.xpm
index c413f1e..87c27bf 100644
--- a/linux/pixmaps/cr_cam.xpm
+++ b/linux/pixmaps/cr_cam.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_cam[] = {
+static char *cr_cam[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_erase.xpm b/linux/pixmaps/cr_erase.xpm
index ad34e45..b801260 100644
--- a/linux/pixmaps/cr_erase.xpm
+++ b/linux/pixmaps/cr_erase.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_erase[] = {
+static char *cr_erase[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_light.xpm b/linux/pixmaps/cr_light.xpm
index 7ce3039..563cfb5 100644
--- a/linux/pixmaps/cr_light.xpm
+++ b/linux/pixmaps/cr_light.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_light[] = {
+static char *cr_light[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_move.xpm b/linux/pixmaps/cr_move.xpm
index e9cf1b0..a5d5b3f 100644
--- a/linux/pixmaps/cr_move.xpm
+++ b/linux/pixmaps/cr_move.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_move[] = {
+static char *cr_move[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_paint.xpm b/linux/pixmaps/cr_paint.xpm
index 16190d3..51177ff 100644
--- a/linux/pixmaps/cr_paint.xpm
+++ b/linux/pixmaps/cr_paint.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_paint[] = {
+static char *cr_paint[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_pan.xpm b/linux/pixmaps/cr_pan.xpm
index 94763e0..a640dad 100644
--- a/linux/pixmaps/cr_pan.xpm
+++ b/linux/pixmaps/cr_pan.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_pan[] = {
+static char *cr_pan[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_roll.xpm b/linux/pixmaps/cr_roll.xpm
index 1b5e340..279bd53 100644
--- a/linux/pixmaps/cr_roll.xpm
+++ b/linux/pixmaps/cr_roll.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_roll[] = {
+static char *cr_roll[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_rot.xpm b/linux/pixmaps/cr_rot.xpm
index bca82a2..8dbbcc6 100644
--- a/linux/pixmaps/cr_rot.xpm
+++ b/linux/pixmaps/cr_rot.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_rot[] = {
+static char *cr_rot[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_rotv.xpm b/linux/pixmaps/cr_rotv.xpm
index b92b0a0..9ebea8a 100644
--- a/linux/pixmaps/cr_rotv.xpm
+++ b/linux/pixmaps/cr_rotv.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_rotv[] = {
+static char *cr_rotv[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_sel.xpm b/linux/pixmaps/cr_sel.xpm
index cb0e27c..5bb7885 100644
--- a/linux/pixmaps/cr_sel.xpm
+++ b/linux/pixmaps/cr_sel.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_sel[] = {
+static char *cr_sel[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_selm.xpm b/linux/pixmaps/cr_selm.xpm
index 7488ea9..331db8b 100644
--- a/linux/pixmaps/cr_selm.xpm
+++ b/linux/pixmaps/cr_selm.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_selm[] = {
+static char *cr_selm[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_spot.xpm b/linux/pixmaps/cr_spot.xpm
index 1301227..72b445d 100644
--- a/linux/pixmaps/cr_spot.xpm
+++ b/linux/pixmaps/cr_spot.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_spot[] = {
+static char *cr_spot[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_zoom.xpm b/linux/pixmaps/cr_zoom.xpm
index 5820aed..07b4038 100644
--- a/linux/pixmaps/cr_zoom.xpm
+++ b/linux/pixmaps/cr_zoom.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_zoom[] = {
+static char *cr_zoom[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/cr_zoomr.xpm b/linux/pixmaps/cr_zoomr.xpm
index 7e417ed..6da8c8c 100644
--- a/linux/pixmaps/cr_zoomr.xpm
+++ b/linux/pixmaps/cr_zoomr.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* cr_zoomr[] = {
+static char *cr_zoomr[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c None",
diff --git a/linux/pixmaps/icon32.xpm b/linux/pixmaps/icon32.xpm
index d0ea2ea..230ca60 100644
--- a/linux/pixmaps/icon32.xpm
+++ b/linux/pixmaps/icon32.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* icon32[] = {
+static char *icon32[] = {
/* columns rows colors chars-per-pixel */
"32 32 3 1",
" c Gray0",
diff --git a/linux/pixmaps/info.xpm b/linux/pixmaps/info.xpm
index 8d26786..d37937d 100644
--- a/linux/pixmaps/info.xpm
+++ b/linux/pixmaps/info.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* info[] = {
+static char *info[] = {
/* width height ncolors chars_per_pixel */
"16 15 4 1",
/* colors */
diff --git a/linux/pixmaps/photo.xpm b/linux/pixmaps/photo.xpm
index 30dbbbf..9ae4b91 100644
--- a/linux/pixmaps/photo.xpm
+++ b/linux/pixmaps/photo.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* photo[] = {
+static char *photo[] = {
/* width height ncolors chars_per_pixel */
"16 15 6 1",
/* colors */
diff --git a/linux/pixmaps/pi-acces.xpm b/linux/pixmaps/pi-acces.xpm
index db31015..bf4792a 100644
--- a/linux/pixmaps/pi-acces.xpm
+++ b/linux/pixmaps/pi-acces.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_acces[] = {
+static char *pi_acces[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-brick.xpm b/linux/pixmaps/pi-brick.xpm
index e5a4267..1690760 100644
--- a/linux/pixmaps/pi-brick.xpm
+++ b/linux/pixmaps/pi-brick.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_brick[] = {
+static char *pi_brick[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-extra.xpm b/linux/pixmaps/pi-extra.xpm
index 3b0e220..5702389 100644
--- a/linux/pixmaps/pi-extra.xpm
+++ b/linux/pixmaps/pi-extra.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_extra[] = {
+static char *pi_extra[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-misc.xpm b/linux/pixmaps/pi-misc.xpm
index 4450f98..2e5d5e0 100644
--- a/linux/pixmaps/pi-misc.xpm
+++ b/linux/pixmaps/pi-misc.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_misc[] = {
+static char *pi_misc[] = {
/* columns rows colors chars-per-pixel */
"16 15 2 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-plate.xpm b/linux/pixmaps/pi-plate.xpm
index 6a5d564..c253307 100644
--- a/linux/pixmaps/pi-plate.xpm
+++ b/linux/pixmaps/pi-plate.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_plate[] = {
+static char *pi_plate[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-slope.xpm b/linux/pixmaps/pi-slope.xpm
index 1a043b3..a2d9cdf 100644
--- a/linux/pixmaps/pi-slope.xpm
+++ b/linux/pixmaps/pi-slope.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_slope[] = {
+static char *pi_slope[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-space.xpm b/linux/pixmaps/pi-space.xpm
index b338d07..d5c69b9 100644
--- a/linux/pixmaps/pi-space.xpm
+++ b/linux/pixmaps/pi-space.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_space[] = {
+static char *pi_space[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-tech.xpm b/linux/pixmaps/pi-tech.xpm
index ea0dfa9..0c1c80a 100644
--- a/linux/pixmaps/pi-tech.xpm
+++ b/linux/pixmaps/pi-tech.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_tech[] = {
+static char *pi_tech[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-tile.xpm b/linux/pixmaps/pi-tile.xpm
index 7b8746b..f3421f4 100644
--- a/linux/pixmaps/pi-tile.xpm
+++ b/linux/pixmaps/pi-tile.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_tile[] = {
+static char *pi_tile[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/pi-train.xpm b/linux/pixmaps/pi-train.xpm
index ae3a98c..a0037af 100644
--- a/linux/pixmaps/pi-train.xpm
+++ b/linux/pixmaps/pi-train.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* pi_train[] = {
+static char *pi_train[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/st-about.xpm b/linux/pixmaps/st-about.xpm
index fa2060f..e0dd59e 100644
--- a/linux/pixmaps/st-about.xpm
+++ b/linux/pixmaps/st-about.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_about[] = {
+static char *st_about[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/st-bg.xpm b/linux/pixmaps/st-bg.xpm
index 31362e9..0843ac0 100644
--- a/linux/pixmaps/st-bg.xpm
+++ b/linux/pixmaps/st-bg.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* st_bg[] = {
+static char * st_bg[] = {
"16 15 5 1",
". c None",
"+ c #000000",
diff --git a/linux/pixmaps/st-copy.xpm b/linux/pixmaps/st-copy.xpm
index 6dfb848..4a1bd19 100644
--- a/linux/pixmaps/st-copy.xpm
+++ b/linux/pixmaps/st-copy.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_copy[] = {
+static char *st_copy[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/st-cut.xpm b/linux/pixmaps/st-cut.xpm
index b4be3c3..eace7c9 100644
--- a/linux/pixmaps/st-cut.xpm
+++ b/linux/pixmaps/st-cut.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_cut[] = {
+static char *st_cut[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/st-fast.xpm b/linux/pixmaps/st-fast.xpm
index dce93c5..6c21876 100644
--- a/linux/pixmaps/st-fast.xpm
+++ b/linux/pixmaps/st-fast.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* st_fast[] = {
+static char * st_fast[] = {
"16 15 3 1",
". c None",
"+ c #7F7F7F",
diff --git a/linux/pixmaps/st-help.xpm b/linux/pixmaps/st-help.xpm
index ba99d46..d1396ce 100644
--- a/linux/pixmaps/st-help.xpm
+++ b/linux/pixmaps/st-help.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_help[] = {
+static char *st_help[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/st-new.xpm b/linux/pixmaps/st-new.xpm
index 21d4e84..a34f0d2 100644
--- a/linux/pixmaps/st-new.xpm
+++ b/linux/pixmaps/st-new.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_new[] = {
+static char *st_new[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c Gray0",
diff --git a/linux/pixmaps/st-open.xpm b/linux/pixmaps/st-open.xpm
index 50d9e93..62424f3 100644
--- a/linux/pixmaps/st-open.xpm
+++ b/linux/pixmaps/st-open.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_open[] = {
+static char *st_open[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c Gray0",
diff --git a/linux/pixmaps/st-paste.xpm b/linux/pixmaps/st-paste.xpm
index f2c7244..526f54a 100644
--- a/linux/pixmaps/st-paste.xpm
+++ b/linux/pixmaps/st-paste.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_paste[] = {
+static char *st_paste[] = {
/* columns rows colors chars-per-pixel */
"16 15 8 1",
" c Gray0",
diff --git a/linux/pixmaps/st-prev.xpm b/linux/pixmaps/st-prev.xpm
index d8be122..1487070 100644
--- a/linux/pixmaps/st-prev.xpm
+++ b/linux/pixmaps/st-prev.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* st_prev[] = {
+static char * st_prev[] = {
"16 15 6 1",
"+ c None",
". c #000000",
diff --git a/linux/pixmaps/st-print.xpm b/linux/pixmaps/st-print.xpm
index a3dc02a..3d9c902 100644
--- a/linux/pixmaps/st-print.xpm
+++ b/linux/pixmaps/st-print.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* st_print[] = {
+static char * st_print[] = {
"16 15 6 1",
". c None",
"+ c #000000",
diff --git a/linux/pixmaps/st-redo.xpm b/linux/pixmaps/st-redo.xpm
index c1c8234..0487db7 100644
--- a/linux/pixmaps/st-redo.xpm
+++ b/linux/pixmaps/st-redo.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_redo[] = {
+static char *st_redo[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c #00007f",
diff --git a/linux/pixmaps/st-save.xpm b/linux/pixmaps/st-save.xpm
index 862aea8..7f7b00d 100644
--- a/linux/pixmaps/st-save.xpm
+++ b/linux/pixmaps/st-save.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_save[] = {
+static char *st_save[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c Gray0",
diff --git a/linux/pixmaps/st-snap.xpm b/linux/pixmaps/st-snap.xpm
index 95414e4..42a7495 100644
--- a/linux/pixmaps/st-snap.xpm
+++ b/linux/pixmaps/st-snap.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_snap[] = {
+static char *st_snap[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c Gray0",
diff --git a/linux/pixmaps/st-snapa.xpm b/linux/pixmaps/st-snapa.xpm
index 5a691d7..4be915c 100644
--- a/linux/pixmaps/st-snapa.xpm
+++ b/linux/pixmaps/st-snapa.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* st_snapa[] = {
+static char * st_snapa[] = {
"16 15 5 1",
". c None",
"+ c #000000",
diff --git a/linux/pixmaps/st-undo.xpm b/linux/pixmaps/st-undo.xpm
index 30fefaf..de76087 100644
--- a/linux/pixmaps/st-undo.xpm
+++ b/linux/pixmaps/st-undo.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char*st_undo[] = {
+static char *st_undo[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c #00007f",
diff --git a/linux/pixmaps/vports01.xpm b/linux/pixmaps/vports01.xpm
index 9e6e25d..92c7b93 100755
--- a/linux/pixmaps/vports01.xpm
+++ b/linux/pixmaps/vports01.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports01[] = {
+static char * vports01[] = {
"41 31 2 1",
". c #000000",
"+ c #808080",
diff --git a/linux/pixmaps/vports02.xpm b/linux/pixmaps/vports02.xpm
index d78f0d2..f62ac43 100755
--- a/linux/pixmaps/vports02.xpm
+++ b/linux/pixmaps/vports02.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports02[] = {
+static char * vports02[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports03.xpm b/linux/pixmaps/vports03.xpm
index da35c97..17d3062 100755
--- a/linux/pixmaps/vports03.xpm
+++ b/linux/pixmaps/vports03.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports03[] = {
+static char * vports03[] = {
"41 31 3 1",
". c #000000",
"+ c #808080",
diff --git a/linux/pixmaps/vports04.xpm b/linux/pixmaps/vports04.xpm
index f723fc0..0759397 100755
--- a/linux/pixmaps/vports04.xpm
+++ b/linux/pixmaps/vports04.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports04[] = {
+static char * vports04[] = {
"41 31 3 1",
". c #000000",
"+ c #808080",
diff --git a/linux/pixmaps/vports05.xpm b/linux/pixmaps/vports05.xpm
index 61493e2..6f380c3 100755
--- a/linux/pixmaps/vports05.xpm
+++ b/linux/pixmaps/vports05.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports05[] = {
+static char * vports05[] = {
"41 31 3 1",
". c #000000",
"+ c #808080",
diff --git a/linux/pixmaps/vports06.xpm b/linux/pixmaps/vports06.xpm
index bd161a0..94af19f 100755
--- a/linux/pixmaps/vports06.xpm
+++ b/linux/pixmaps/vports06.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports06[] = {
+static char * vports06[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports07.xpm b/linux/pixmaps/vports07.xpm
index 8be7f61..292e157 100755
--- a/linux/pixmaps/vports07.xpm
+++ b/linux/pixmaps/vports07.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports07[] = {
+static char * vports07[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports08.xpm b/linux/pixmaps/vports08.xpm
index 6b0218c..d304f88 100755
--- a/linux/pixmaps/vports08.xpm
+++ b/linux/pixmaps/vports08.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports08[] = {
+static char * vports08[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports09.xpm b/linux/pixmaps/vports09.xpm
index a16554e..e65369a 100755
--- a/linux/pixmaps/vports09.xpm
+++ b/linux/pixmaps/vports09.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports09[] = {
+static char * vports09[] = {
"41 31 3 1",
". c #000000",
"+ c #808080",
diff --git a/linux/pixmaps/vports10.xpm b/linux/pixmaps/vports10.xpm
index dd9afc2..b346695 100755
--- a/linux/pixmaps/vports10.xpm
+++ b/linux/pixmaps/vports10.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports10[] = {
+static char * vports10[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports11.xpm b/linux/pixmaps/vports11.xpm
index 4cec015..05d30ea 100755
--- a/linux/pixmaps/vports11.xpm
+++ b/linux/pixmaps/vports11.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports11[] = {
+static char * vports11[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports12.xpm b/linux/pixmaps/vports12.xpm
index 7ad6c38..15885b9 100755
--- a/linux/pixmaps/vports12.xpm
+++ b/linux/pixmaps/vports12.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports12[] = {
+static char * vports12[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/pixmaps/vports13.xpm b/linux/pixmaps/vports13.xpm
index 69d7047..b9e72c8 100755
--- a/linux/pixmaps/vports13.xpm
+++ b/linux/pixmaps/vports13.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports13[] = {
+static char * vports13[] = {
"41 31 3 1",
". c #000000",
"+ c #808080",
diff --git a/linux/pixmaps/vports14.xpm b/linux/pixmaps/vports14.xpm
index b1d1f91..1930532 100755
--- a/linux/pixmaps/vports14.xpm
+++ b/linux/pixmaps/vports14.xpm
@@ -1,5 +1,5 @@
/* XPM */
-static const char* vports14[] = {
+static char * vports14[] = {
"41 31 3 1",
". c #000000",
"+ c #C0C0C0",
diff --git a/linux/system.cpp b/linux/system.cpp
index 3dae29e..cdf9921 100644
--- a/linux/system.cpp
+++ b/linux/system.cpp
@@ -15,7 +15,6 @@
#include "toolbar.h"
#include "dialogs.h"
#include "globals.h"
-#include "lc_application.h"
// =============================================================================
// Cursor functions
@@ -180,7 +179,7 @@ void SystemUpdateCategories(bool SearchOnly)
{
}
-static void create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, const char **xpm)
+static void create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
{
int height, width, colors;
char pixmap_buffer [(32 * 32)/8];
@@ -241,7 +240,7 @@ void SystemUpdateAction(int new_action, int old_action)
return;
GtkWidget* button;
- const char** xpm = NULL;
+ char** xpm = NULL;
int x, y;
switch (new_action)
@@ -293,9 +292,9 @@ void SystemUpdateAction(int new_action, int old_action)
if (xpm != NULL)
{
- create_bitmap_and_mask_from_xpm(&bitmap, &mask, xpm);
- cursor = gdk_cursor_new_from_pixmap(bitmap, mask, &white, &black, x, y);
- gdk_window_set_cursor(drawing_area->window, cursor);
+ create_bitmap_and_mask_from_xpm (&bitmap, &mask, xpm);
+ cursor = gdk_cursor_new_from_pixmap (bitmap, mask, &white, &black, x, y);
+ gdk_window_set_cursor (drawing_area->window, cursor);
}
else
{
@@ -491,13 +490,13 @@ void SystemUpdateSnap(unsigned short move_snap, unsigned short RotateSnap)
if (!label_snap)
return;
- char Text[256], xy[32], z[32];
-
- lcGetActiveProject()->GetSnapDistanceText(xy, z);
-
- sprintf(Text, " M: %s %s R: %d ", xy, z, RotateSnap);
+ char text[11];
+ if (move_snap)
+ sprintf (text, "Move x%i", move_snap);
+ else
+ strcpy (text, "Move /2");
- gtk_label_set (GTK_LABEL (label_snap), Text);
+ gtk_label_set (GTK_LABEL (label_snap), text);
}
void SystemUpdateSelected(unsigned long flags, int SelectedCount, Object* Focus)
@@ -512,7 +511,7 @@ void SystemUpdateSelected(unsigned long flags, int SelectedCount, Object* Focus)
gtk_widget_set_sensitive (item, (flags & LC_SEL_UNSELECTED) != 0);
item = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "menu_edit_select_none"));
- gtk_widget_set_sensitive (item, (flags & (LC_SEL_PIECE|LC_SEL_CAMERA|LC_SEL_LIGHT)) != 0);
+ gtk_widget_set_sensitive (item, flags & (LC_SEL_PIECE|LC_SEL_CAMERA|LC_SEL_LIGHT) != 0);
item = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "menu_edit_select_invert"));
gtk_widget_set_sensitive (item, (flags & LC_SEL_NO_PIECES) == 0);
item = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "menu_edit_select_byname"));
@@ -610,74 +609,80 @@ void SystemFinish()
}
// FIXME: remove
-int SystemDoMessageBox(const char* prompt, int mode)
+int SystemDoMessageBox(char* prompt, int mode)
{
- return msgbox_execute(prompt, "LeoCAD", mode);
+ return msgbox_execute (prompt, "LeoCAD", mode);
}
bool SystemDoDialog(int mode, void* param)
{
switch (mode)
{
- case LC_DLG_FILE_OPEN_PROJECT:
+ case LC_DLG_FILE_OPEN_PROJECT: {
return openprojectdlg_execute ((char*)param) == LC_OK;
+ } break;
- case LC_DLG_FILE_SAVE_PROJECT:
+ case LC_DLG_FILE_SAVE_PROJECT: {
return saveprojectdlg_execute ((char*)param) == LC_OK;
+ } break;
- case LC_DLG_FILE_MERGE_PROJECT:
- return openprojectdlg_execute ((char*)param) == LC_OK;
-
- case LC_DLG_FILE_OPEN:
+ case LC_DLG_FILE_MERGE_PROJECT: {
return openprojectdlg_execute ((char*)param) == LC_OK;
+ } break;
- case LC_DLG_ABOUT:
+ case LC_DLG_ABOUT: {
return aboutdlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_ARRAY:
+ case LC_DLG_ARRAY: {
return arraydlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_HTML:
+ case LC_DLG_HTML: {
return htmldlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_POVRAY:
+ case LC_DLG_POVRAY: {
return povraydlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_VRML97:
- return filedlg_execute("Save File", (char*)param) == LC_OK;
-
- case LC_DLG_X3DV:
+ case LC_DLG_WAVEFRONT: {
return filedlg_execute("Save File", (char*)param) == LC_OK;
+ } break;
- case LC_DLG_WAVEFRONT:
- return filedlg_execute("Save File", (char*)param) == LC_OK;
-
- case LC_DLG_PREFERENCES:
+ case LC_DLG_PREFERENCES: {
return preferencesdlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_PICTURE_SAVE:
+ case LC_DLG_PICTURE_SAVE: {
return savepicturedlg_execute (param) == LC_OK;
+ } break;
- case LC_DLG_MINIFIG:
+ case LC_DLG_MINIFIG: {
return minifigdlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_PROPERTIES:
+ case LC_DLG_PROPERTIES: {
return propertiesdlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_LIBRARY:
+ case LC_DLG_LIBRARY: {
return librarydlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_SELECTBYNAME:
- break;
+ case LC_DLG_SELECTBYNAME: {
+ } break;
- case LC_DLG_STEPCHOOSE:
- break;
+ case LC_DLG_STEPCHOOSE: {
+ } break;
- case LC_DLG_EDITGROUPS:
+ case LC_DLG_EDITGROUPS: {
return groupeditdlg_execute(param) == LC_OK;
+ } break;
- case LC_DLG_GROUP:
+ case LC_DLG_GROUP: {
return groupdlg_execute(param) == LC_OK;
+ } break;
}
return false;
@@ -689,22 +694,17 @@ void SystemDoPopupMenu(int nMenu, int x, int y)
void SystemDoWaitCursor(int code)
{
- GdkWindow* window = ((GtkWidget*)(*main_window))->window;
-
- if (!GDK_IS_WINDOW(window))
- return;
-
if (code == 1)
{
- GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(window, cursor);
- gdk_cursor_destroy(cursor);
+ GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
+ gdk_window_set_cursor (((GtkWidget*)(*main_window))->window, cursor);
+ gdk_cursor_destroy (cursor);
}
else
{
- GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
- gdk_window_set_cursor(window, cursor);
- gdk_cursor_destroy(cursor);
+ GdkCursor *cursor = gdk_cursor_new (GDK_LEFT_PTR);
+ gdk_window_set_cursor (((GtkWidget*)(*main_window))->window, cursor);
+ gdk_cursor_destroy (cursor);
}
}
diff --git a/linux/toolbar.cpp b/linux/toolbar.cpp
index 04a955f..431fffb 100644
--- a/linux/toolbar.cpp
+++ b/linux/toolbar.cpp
@@ -866,7 +866,7 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, TRUE, 0);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_widget_set_usize (frame, 120, -1);
+ gtk_widget_set_usize (frame, 70, -1);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), hbox1);
diff --git a/macosx/system.cpp b/macosx/system.cpp
index 363734a..afe0516 100644
--- a/macosx/system.cpp
+++ b/macosx/system.cpp
@@ -168,7 +168,7 @@ void SystemFinish()
}
// FIXME: remove
-int SystemDoMessageBox(const char* prompt, int mode)
+int SystemDoMessageBox(char* prompt, int mode)
{
return 0;
}
diff --git a/win/Cadview.cpp b/win/Cadview.cpp
index 5098986..f38c80b 100644
--- a/win/Cadview.cpp
+++ b/win/Cadview.cpp
@@ -3,7 +3,6 @@
#include "stdafx.h"
#include "LeoCAD.h"
-#include <windowsx.h>
#include "CADDoc.h"
#include "CADView.h"
diff --git a/win/Clrpick.cpp b/win/Clrpick.cpp
index 7b5ddae..1d920fa 100644
--- a/win/Clrpick.cpp
+++ b/win/Clrpick.cpp
@@ -142,9 +142,7 @@ void CColorPicker::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
for (int x = rect.left; x < rect.right; x++)
{
- int y;
-
- for (y = rect.top; y < rect.bottom; y+=4)
+ for (int y = rect.top; y < rect.bottom; y+=4)
{
if (y == rect.top) y += x%4;
pDC->SetPixel (x,y,RGB(255,255,255));
diff --git a/win/Clrpopup.cpp b/win/Clrpopup.cpp
index 8a5ae3c..aa3daa9 100644
--- a/win/Clrpopup.cpp
+++ b/win/Clrpopup.cpp
@@ -783,14 +783,11 @@ void CColorPopup::DrawCell(CDC* pDC, int nIndex)
{
for (int x = rect.left; x < rect.right; x++)
{
- int y;
-
- for (y = rect.top; y < rect.bottom; y+=4)
+ for (int y = rect.top; y < rect.bottom; y+=4)
{
if (y == rect.top) y += x%4;
pDC->SetPixel (x,y,RGB(255,255,255));
}
-
for (y = rect.bottom; y > rect.top; y-=4)
{
if (y == rect.bottom) y-= x%4;
diff --git a/win/Colorlst.cpp b/win/Colorlst.cpp
index b335247..06eb038 100644
--- a/win/Colorlst.cpp
+++ b/win/Colorlst.cpp
@@ -62,14 +62,11 @@ void CColorsList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
if (x > 13 && x < 22)
for (x = lpDIS->rcItem.left; x < lpDIS->rcItem.right; x++)
{
- int y;
-
- for (y = lpDIS->rcItem.top; y < lpDIS->rcItem.bottom; y+=4)
+ for (int y = lpDIS->rcItem.top; y < lpDIS->rcItem.bottom; y+=4)
{
if (y == lpDIS->rcItem.top) y += x%4;
SetPixelV (lpDIS->hDC, x,y,RGB(255,255,255));
}
-
for (y = lpDIS->rcItem.bottom; y > lpDIS->rcItem.top; y-=4)
{
if (y == lpDIS->rcItem.bottom) y-= x%4;
diff --git a/win/Figdlg.cpp b/win/Figdlg.cpp
index ed01889..3b78e52 100644
--- a/win/Figdlg.cpp
+++ b/win/Figdlg.cpp
@@ -99,9 +99,7 @@ LRESULT CALLBACK GLWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPara
m_pMinifigWnd->CreateEx (0, MINIFIG_CLASSNAME, "LeoCAD",
WS_BORDER | WS_CHILD | WS_VISIBLE, r, this, 0, m_pMinifig);
- int i;
-
- for (i = 0; i < LC_MFW_NUMITEMS; i++)
+ for (int i = 0; i < LC_MFW_NUMITEMS; i++)
((CColorPicker*)GetDlgItem (IDC_MF_HATCOLOR+i))->SetColorIndex (m_pMinifig->m_Colors[i]);
for (i = 0; i < LC_MFW_NUMITEMS; i++)
diff --git a/win/Flatbar.cpp b/win/Flatbar.cpp
index 187f575..4f6de8e 100644
--- a/win/Flatbar.cpp
+++ b/win/Flatbar.cpp
@@ -459,9 +459,8 @@ CSize CFlatToolBar::CalcLayout(DWORD dwMode, int nLength)
int nControlCount = 0;
BOOL bIsDelayed = m_bDelayedButtonLayout;
m_bDelayedButtonLayout = FALSE;
- int i;
- for(i = 0; i < nCount; i++)
+ for(int i = 0; i < nCount; i++)
if ((pData[i].fsStyle & TBSTYLE_SEP) && (pData[i].idCommand != 0))
nControlCount++;
diff --git a/win/Libdlg.cpp b/win/Libdlg.cpp
index 17a0964..7fb05b3 100644
--- a/win/Libdlg.cpp
+++ b/win/Libdlg.cpp
@@ -382,9 +382,8 @@ void CLibraryDlg::UpdateList()
for (int i = 0; i < Lib->GetPieceCount(); i++)
{
PieceInfo* Info = Lib->GetPieceInfo(i);
- int j;
- for (j = 0; j < Lib->GetNumCategories(); j++)
+ for (int j = 0; j < Lib->GetNumCategories(); j++)
{
if (Lib->PieceInCategory(Info, Lib->GetCategoryKeywords(j)))
break;
diff --git a/win/Piecebar.cpp b/win/Piecebar.cpp
index 7cce48c..b72b5c5 100644
--- a/win/Piecebar.cpp
+++ b/win/Piecebar.cpp
@@ -434,7 +434,7 @@ void CPiecesBar::OnPaint()
CPaintDC dc(this);
}
-NCHITTESTRETURN CPiecesBar::OnNcHitTest(CPoint point)
+UINT CPiecesBar::OnNcHitTest(CPoint point)
{
if (IsFloating())
return CControlBar::OnNcHitTest(point);
diff --git a/win/Piecebar.h b/win/Piecebar.h
index 3e2736c..609419f 100644
--- a/win/Piecebar.h
+++ b/win/Piecebar.h
@@ -111,7 +111,7 @@ protected:
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnCaptureChanged(CWnd *pWnd);
- afx_msg NCHITTESTRETURN OnNcHitTest(CPoint point);
+ afx_msg UINT OnNcHitTest(CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
diff --git a/win/Print.cpp b/win/Print.cpp
index 09a18b5..6f693f8 100644
--- a/win/Print.cpp
+++ b/win/Print.cpp
@@ -5,8 +5,6 @@
#include "stdafx.h"
#include "leocad.h"
-#include <windowsx.h>
-
#include "Print.h"
#include "project.h"
#include "pieceinf.h"
@@ -24,12 +22,9 @@ static void PrintCatalogThread (CWnd* pParent, CFrameWnd* pMainFrame)
PiecesLibrary *pLib = lcGetPiecesLibrary();
int bricks = 0;
- int j;
-
- for (j = 0; j < pLib->GetPieceCount (); j++)
+ for (int j = 0; j < pLib->GetPieceCount (); j++)
if (pLib->GetPieceInfo(j)->m_strDescription[0] != '~')
bricks++;
-
int rows = theApp.GetProfileInt("Default", "Catalog Rows", 10);
int cols = theApp.GetProfileInt("Default", "Catalog Columns", 3);
PD->m_pd.lpfnPrintHook = PrintHookProc;
diff --git a/win/Stdafx.h b/win/Stdafx.h
index e92ba02..1332794 100644
--- a/win/Stdafx.h
+++ b/win/Stdafx.h
@@ -1,6 +1,7 @@
// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently,
-// but are changed infrequently
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
#if !defined(AFX_STDAFX_H__195E1F4C_3FF2_11D2_8202_D2B1707B2D1B__INCLUDED_)
#define AFX_STDAFX_H__195E1F4C_3FF2_11D2_8202_D2B1707B2D1B__INCLUDED_
@@ -9,39 +10,12 @@
#pragma once
#endif // _MSC_VER >= 1000
-#define _CRT_SECURE_NO_DEPRECATE 1
-
-#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
-#endif
-
-#if _MSC_VER >= 1400
-
-#ifndef WINVER // Allow use of features specific to Windows XP or later.
-#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
-#endif
-
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
-#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
-#endif
-
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
-#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
-#endif
-#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
-#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
-#endif
-
-#endif
-
-// turns off MFC's hiding of some common and often safely ignored warning messages
-#define _AFX_ALL_WARNINGS
+#include <windowsx.h> // GlobalFreePtr()
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
-#include <afxcoll.h>
-#include <afxtempl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
@@ -53,19 +27,7 @@ typedef DWORD ACTIVATEAPPPARAM;
typedef HTASK ACTIVATEAPPPARAM;
#endif
-#if _MFC_VER < 0x0800
-#define _strcmpi strcmp
-#define _strlwr strlwr
-#define _strupr strupr
-#else
-#define snprintf _snprintf
-#endif
-
-#if _MFC_VER >= 0x0800
-typedef LRESULT NCHITTESTRETURN;
-#else
-typedef UINT NCHITTESTRETURN;
-#endif
+//#include <afxadv.h> // CSharedFile
#include "opengl.h"
diff --git a/win/System.cpp b/win/System.cpp
index a60a5ca..652346a 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -1128,16 +1128,21 @@ void SystemSetWindowCaption(char* caption)
AfxSetWindowText(AfxGetMainWnd()->m_hWnd, caption);
}
-int SystemDoMessageBox(const char* prompt, int nMode)
+int SystemDoMessageBox(char* prompt, int nMode)
{
return AfxMessageBox(prompt, nMode);
}
int Sys_MessageBox (const char* text, const char* caption, int type)
+
{
+
return AfxMessageBox(text, type);
+
}
+
+
extern BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
bool SystemDoDialog(int nMode, void* param)
diff --git a/win/Tools.cpp b/win/Tools.cpp
index 4028a72..cdf49a4 100644
--- a/win/Tools.cpp
+++ b/win/Tools.cpp
@@ -547,10 +547,8 @@ void Export3DStudio()
{
if (j == *info)
{
- UINT k;
-
info++;
- for (k = 0; k < *info; k += 4)
+ for (UINT k = 0; k < *info; k += 4)
{
mobj->matarray[i].faceindex[facecount] = curface;
facecount++;
diff --git a/win/arraydlg.cpp b/win/arraydlg.cpp
index 37aa5a8..f033510 100644
--- a/win/arraydlg.cpp
+++ b/win/arraydlg.cpp
@@ -90,9 +90,8 @@ BOOL CArrayDlg::OnInitDialog()
IDC_ARRAY_3D_X_SPIN, IDC_ARRAY_3D_Y_SPIN, IDC_ARRAY_3D_Z_SPIN,
IDC_ARRAY_MOVE_X_SPIN, IDC_ARRAY_ROTATE_X_SPIN, IDC_ARRAY_MOVE_Y_SPIN,
IDC_ARRAY_ROTATE_Y_SPIN, IDC_ARRAY_MOVE_Z_SPIN, IDC_ARRAY_ROTATE_Z_SPIN };
- int i;
- for (i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++)
((CSpinButtonCtrl*)GetDlgItem(IDs[i]))->SetRange(1, 1000);
for (i = 3; i < 15; i++)
((CSpinButtonCtrl*)GetDlgItem(IDs[i]))->SetRange(-1000, 1000);
@@ -108,10 +107,7 @@ void CArrayDlg::OnArrayDimension()
return;
UpdateData();
-
- UINT u;
-
- for (u = IDC_ARRAY_2D_COUNT; u <= IDC_ARRAY_2D_Z; u++)
+ for (UINT u = IDC_ARRAY_2D_COUNT; u <= IDC_ARRAY_2D_Z; u++)
GetDlgItem(u)->EnableWindow(m_nArrayDimension > 0);
for (u = IDC_ARRAY_2D_X_SPIN; u <= IDC_ARRAY_2D_Z_SPIN; u++)
GetDlgItem(u)->EnableWindow(m_nArrayDimension > 0);
diff --git a/win/config.h b/win/config.h
index a06cff5..db1fe75 100644
--- a/win/config.h
+++ b/win/config.h
@@ -8,7 +8,7 @@
#define _CONFIG_H_
#define LC_VERSION_MAJOR 0
-#define LC_VERSION_MINOR 74
+#define LC_VERSION_MINOR 75
#define LC_VERSION_PATCH 0
#define LC_VERSION_OSNAME "Windows"
#define LC_VERSION_TEXT "0.75"
diff --git a/win/disabtab.cpp b/win/disabtab.cpp
index 69e5a74..930a686 100644
--- a/win/disabtab.cpp
+++ b/win/disabtab.cpp
@@ -32,7 +32,7 @@ CTabCtrlWithDisable::~CTabCtrlWithDisable()
}
// Subclass the tab control: also make ownder-draw
-BOOL CTabCtrlWithDisable::SubclassDlgItem(UINT nID, CWnd* pParent)
+CTabCtrlWithDisable::SubclassDlgItem(UINT nID, CWnd* pParent)
{
if (!CTabCtrl::SubclassDlgItem(nID, pParent))
return FALSE;
diff --git a/win/rmodel.h b/win/rmodel.h
index c81dcbe..5a110cc 100644
--- a/win/rmodel.h
+++ b/win/rmodel.h
@@ -86,7 +86,7 @@ protected:
int build_hierarchy();
- friend int RAPID_Collide(double R1[3][3], double T1[3], double s1, CRModel *RAPID_model1,
+ friend RAPID_Collide(double R1[3][3], double T1[3], double s1, CRModel *RAPID_model1,
double R2[3][3], double T2[3], double s2, CRModel *RAPID_model2, int flag);
};
diff --git a/win/terrctrl.cpp b/win/terrctrl.cpp
index 284d8db..853138f 100644
--- a/win/terrctrl.cpp
+++ b/win/terrctrl.cpp
@@ -511,9 +511,7 @@ void CTerrainCtrl::OnDraw(CDC* pDC)
*/
// calc bottom
int bottom = GetFixedRowHeight();
- int i;
-
- for (i = idTopLeft.row; i < m_nRows; i++)
+ for (int i = idTopLeft.row; i < m_nRows; i++)
{
bottom += GetRowHeight(i);
if (bottom >= clientRect.bottom)
@@ -1295,9 +1293,7 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck)
else if (point.x < fixedColWidth) // in fixed col
{
int xpos = 0;
- int col;
-
- for (col = 0; col < m_nFixedCols; col++)
+ for (int col = 0; col < m_nFixedCols; col++)
{
xpos += GetColumnWidth(col);
if (xpos > point.x) break;
@@ -1307,9 +1303,7 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck)
else // in non-fixed col
{
int xpos = fixedColWidth;
- int col;
-
- for (col = idTopLeft.col; col < m_nCols; col++)
+ for (int col = idTopLeft.col; col < m_nCols; col++)
{
xpos += GetColumnWidth(col);
if (xpos > point.x) break;
@@ -1328,9 +1322,7 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck)
else if (point.y < fixedRowHeight) // in fixed col
{
int ypos = 0;
- int row;
-
- for (row = 0; row < m_nFixedRows; row++)
+ for (int row = 0; row < m_nFixedRows; row++)
{
ypos += GetRowHeight(row);
if (ypos > point.y) break;
@@ -1340,9 +1332,7 @@ CELLID CTerrainCtrl::GetCellFromPt(CPoint point, BOOL bAllowFixedCellCheck)
else
{
int ypos = fixedRowHeight;
- int row;
-
- for (row = idTopLeft.row; row < GetRowCount(); row++)
+ for (int row = idTopLeft.row; row < GetRowCount(); row++)
{
ypos += GetRowHeight(row);
if (ypos > point.y) break;
@@ -1802,9 +1792,7 @@ void CTerrainCtrl::EnsureVisible(int nRow, int nCol)
// calc bottom
int bottom = GetFixedRowHeight();
- int i;
-
- for (i = idTopLeft.row; i < m_nRows; i++)
+ for (int i = idTopLeft.row; i < m_nRows; i++)
{
bottom += GetRowHeight(i);
if (bottom >= rect.bottom)