diff --git a/code/tool/all.sln b/code/tool/all.sln
index f5a071982..b5e91c45c 100644
--- a/code/tool/all.sln
+++ b/code/tool/all.sln
@@ -25,11 +25,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ren_date", "ren_date\ren_da
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResSwap", "resswap\ResSwap.vcproj", "{45255B61-CD45-484A-89DB-B4D75EF04993}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zviewer", "zviewer\zviewer.vcproj", "{B798D9FF-AA33-4918-8B51-1B4FA9C5160A}"
- ProjectSection(ProjectDependencies) = postProject
- {2B48BE83-108B-4E8E-8A55-6627CF09AC5A} = {2B48BE83-108B-4E8E-8A55-6627CF09AC5A}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3d", "..\nel\src\3d.vcproj", "{2B48BE83-108B-4E8E-8A55-6627CF09AC5A}"
ProjectSection(ProjectDependencies) = postProject
{44B21233-EFCC-4825-B5E5-3A3BD6CC5516} = {44B21233-EFCC-4825-B5E5-3A3BD6CC5516}
@@ -115,14 +110,6 @@ Global
{45255B61-CD45-484A-89DB-B4D75EF04993}.Release|Win32.Build.0 = Release|Win32
{45255B61-CD45-484A-89DB-B4D75EF04993}.Release|x64.ActiveCfg = Release|x64
{45255B61-CD45-484A-89DB-B4D75EF04993}.Release|x64.Build.0 = Release|x64
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Debug|Win32.ActiveCfg = Debug|Win32
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Debug|Win32.Build.0 = Debug|Win32
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Debug|x64.ActiveCfg = Debug|x64
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Debug|x64.Build.0 = Debug|x64
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Release|Win32.ActiveCfg = Release|Win32
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Release|Win32.Build.0 = Release|Win32
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Release|x64.ActiveCfg = Release|x64
- {B798D9FF-AA33-4918-8B51-1B4FA9C5160A}.Release|x64.Build.0 = Release|x64
{2B48BE83-108B-4E8E-8A55-6627CF09AC5A}.Debug|Win32.ActiveCfg = Debug|Win32
{2B48BE83-108B-4E8E-8A55-6627CF09AC5A}.Debug|Win32.Build.0 = Debug|Win32
{2B48BE83-108B-4E8E-8A55-6627CF09AC5A}.Debug|x64.ActiveCfg = Debug|x64
diff --git a/code/tool/zviewer/heightmap.tga b/code/tool/zviewer/heightmap.tga
deleted file mode 100644
index 6b1f2a620..000000000
Binary files a/code/tool/zviewer/heightmap.tga and /dev/null differ
diff --git a/code/tool/zviewer/move_listener.cpp b/code/tool/zviewer/move_listener.cpp
deleted file mode 100644
index 47c116661..000000000
--- a/code/tool/zviewer/move_listener.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-// NeL - MMORPG Framework
-// Copyright (C) 2010 Winch Gate Property Limited
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-#include
-#include
-#include
-
-#include "move_listener.h"
-
-
-using namespace NLMISC;
-
-namespace NL3D {
-
-
-
-
-
-/****************************************************************\
- CMoveListener()
-\****************************************************************/
-CMoveListener::CMoveListener()
-{
- _ViewMatrix.identity();
- _Viewport.initFullScreen();
-
- _Mode = WALK;
-
- _MouseFree = false;
-
- _CursorInit = false;
-
- _Width = 0;
- _Height = 0;
-
- _Top=1.f;
- _Bottom=1.f;
- _Left=1.f;
- _Right=1.f;
- _Depth=1.f;
-
- _RotZ = 0;
- _RotX = 0;
-
- _TransSpeed = 1.66f;
- _RotSpeed = 1;
-
- _CurrentTime = 0;
- _LastTime = 0;
-
- _EyesHeight = 1.80f;
-}
-
-
-/****************************************************************\
- changeViewMatrix()
-\****************************************************************/
-void CMoveListener::changeViewMatrix()
-{
- float time = (sint64)(_CurrentTime-_LastTime)*0.001f;
-
- // Forward
- if(CNELU::AsyncListener.isKeyDown(KeyUP))
- {
- if(_Mode==WALK)
- {
- _Pos.x -= time*_TransSpeed * (float)sin(_RotZ);
- _Pos.y += time*_TransSpeed * (float)cos(_RotZ);
- }
- else
- {
- _Pos.x -= time*_TransSpeed * (float)sin(_RotZ)*(float)cos(_RotX);
- _Pos.y += time*_TransSpeed * (float)cos(_RotZ)*(float)cos(_RotX);
- _Pos.z += time*_TransSpeed * (float)sin(_RotX);
- }
- }
- // Backward
- if(CNELU::AsyncListener.isKeyDown(KeyDOWN))
- {
- if(_Mode==WALK)
- {
- _Pos.x += time*_TransSpeed * (float)sin(_RotZ);
- _Pos.y -= time*_TransSpeed * (float)cos(_RotZ);
- }
- else
- {
- _Pos.x += time*_TransSpeed * (float)sin(_RotZ)*(float)cos(_RotX);
- _Pos.y -= time*_TransSpeed * (float)cos(_RotZ)*(float)cos(_RotX);
- _Pos.z -= time*_TransSpeed * (float)sin(_RotX);
- }
- }
-
- // Strafe left
- if(CNELU::AsyncListener.isKeyDown(KeyLEFT))
- {
- _Pos.x = _Pos.x - time*_TransSpeed*(float)cos(_RotZ);
- _Pos.y = _Pos.y - time*_TransSpeed*(float)sin(_RotZ);
- }
- // Strafe right
- if(CNELU::AsyncListener.isKeyDown(KeyRIGHT))
- {
- _Pos.x = _Pos.x + time*_TransSpeed*(float)cos(_RotZ);
- _Pos.y = _Pos.y + time*_TransSpeed*(float)sin(_RotZ);
- }
- // Up
- if(CNELU::AsyncListener.isKeyDown(KeySHIFT))
- {
- _Pos.z += time*_TransSpeed;
- }
- // Down
- if(CNELU::AsyncListener.isKeyDown(KeyCONTROL))
- {
- _Pos.z -= time*_TransSpeed;
- }
-
- if(CNELU::AsyncListener.isKeyPushed(Key1))
- {
- _TransSpeed = 5/3.6f; // 5km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key2))
- {
- _TransSpeed = 10/3.6f; // 10km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key3))
- {
- _TransSpeed = 20/3.6f; // 20km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key4))
- {
- _TransSpeed = 40/3.6f; //40km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key5))
- {
- _TransSpeed = 80/3.6f; //80km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key6))
- {
- _TransSpeed = 160/3.6f; //160km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key7))
- {
- _TransSpeed = 320/3.6f; //320km/h
- }
- if(CNELU::AsyncListener.isKeyPushed(Key8))
- {
- _TransSpeed = 640/3.6f; //640km/h
- }
-
- // Transform view matrix
- _ViewMatrix.identity();
- _ViewMatrix.translate(CVector(0,0,_EyesHeight));
- _ViewMatrix.translate(_Pos);
- _ViewMatrix.rotateZ(_RotZ);
- _ViewMatrix.rotateX(_RotX);
-
- CNELU::Camera->setMatrix(_ViewMatrix);
-
-}
-
-
-/****************************************************************\
- operator()
-\****************************************************************/
-void CMoveListener::operator()(const CEvent& event)
-{
- static const float eps = 0.001f;
-
- // Rotation
- if (event==EventMouseMoveId)
- {
- CEventMouse* mouseEvent=(CEventMouse*)&event;
-
- if(!_MouseFree)
- {
- if(_CursorInit)
- {
- float difx = 0.5f-mouseEvent->X;
- if ( (float)fabs(difx) > eps)
- {
- _RotZ += _RotSpeed*(difx);
- }
- float dify = -(0.5f-mouseEvent->Y);
- if ( (float)fabs(dify) > eps)
- {
- _RotX += _RotSpeed*(dify);
- }
- }
- else
- {
- _CursorInit = true;
- }
- _Scene->getDriver()->setMousePos(0.5,0.5);
- }
- }
-
- changeViewMatrix();
-}
-
-
-/****************************************************************\
- addToServer()
-\****************************************************************/
-void CMoveListener::addToServer(CEventServer& server)
-{
- server.addListener (EventMouseMoveId, this);
-}
-
-
-/****************************************************************\
- removeFromServer()
-\****************************************************************/
-void CMoveListener::removeFromServer (CEventServer& server)
-{
- server.removeListener (EventMouseMoveId, this);
-}
-
-}; // NL3D
diff --git a/code/tool/zviewer/move_listener.h b/code/tool/zviewer/move_listener.h
deleted file mode 100644
index 2e8cf50a2..000000000
--- a/code/tool/zviewer/move_listener.h
+++ /dev/null
@@ -1,221 +0,0 @@
-// NeL - MMORPG Framework
-// Copyright (C) 2010 Winch Gate Property Limited
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-#ifndef NL_MOVE_LISTENER_H
-#define NL_MOVE_LISTENER_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-
-namespace NL3D
-{
-
-
-/**
- * CMoveListener is a listener that handle a 3d matrix with mouse events.
- * \author Stephane Coutelas
- * \author Nevrax France
- * \date 2000
- */
-class CMoveListener : public NLMISC::IEventListener
-{
-
-public :
-
- /**
- * TMoveMode.
- * moving modes
- */
- enum TMoveMode
- {
- WALK,
- FREE
- };
-
-private:
-
- /// Internal use
- virtual void operator()(const NLMISC::CEvent& event);
-
- /// moving mode
- TMoveMode _Mode;
-
- /// view matrix
- NLMISC::CMatrix _ViewMatrix;
-
- /// viewport
- NL3D::CViewport _Viewport;
-
- /// true if first setMousePos done
- bool _CursorInit;
-
- CScene * _Scene;
-
- /// screen width
- uint _Width;
-
- /// screen height
- uint _Height;
-
- ///frustum parameters
- float _Top;
- float _Bottom;
- float _Left;
- float _Right;
- float _Depth;
-
- /// current position
- CVector _Pos;
-
- /// eyes height
- float _EyesHeight;
-
- ///current rotation z angle
- float _RotZ;
-
- ///current rotation x angle
- float _RotX;
-
- /// last local time measured
- NLMISC::TTime _LastTime;
-
- /// current local time
- NLMISC::TTime _CurrentTime;
-
- /// step for translation
- float _TransSpeed;
-
- /// step for rotation
- float _RotSpeed;
-
- /// false if mouse is use to move
- bool _MouseFree;
-
-public:
-
-
- /**
- * Constructor.
- * You should call init then.
- */
- CMoveListener();
-
-
- /**
- * Constructor.
- * You should call init then.
- * \param scene the scene
- * \param w screen width in pixels
- * \param h screen height in pixels
- * \param camera the camera
- */
- void init(CScene * scene, uint w, uint h, const class CCamera& camera)
- {
- _Scene = scene;
- _Width = w;
- _Height = h;
-
- _Viewport = scene->getViewport();
-
- float dummy;
- _ViewMatrix = camera.getMatrix ();
- camera.getFrustum (_Left, _Right, _Bottom, _Top, _Depth, dummy);
- }
-
- /**
- * Set the moving mode
- * \param m the moving mode
- */
- void setMode(TMoveMode m)
- {
- _Mode = m;
- }
-
- void swapMode()
- {
- if(_Mode==WALK)
- {
- _Mode = FREE;
- }
- else
- {
- _Mode = WALK;
- }
- }
-
- TMoveMode getMode() const
- {
- return _Mode;
- }
-
- void changeViewMatrix();
-
- /**
- * Register the listener to the server.
- */
- void addToServer (NLMISC::CEventServer& server);
-
- /**
- * Unregister the listener to the server.
- */
- void removeFromServer (NLMISC::CEventServer& server);
-
- void setEyesHeight(float eh) { _EyesHeight = eh; }
- float getEyesHeight() const { return _EyesHeight; }
-
- void setPos(CVector pos) { _Pos = pos; }
- CVector getPos() const { return _Pos; }
-
- float getRotX() const { return _RotX; }
- float getRotZ() const { return _RotZ; }
-
- float getSpeed() const { return _TransSpeed; }
-
- void setLocalTime(NLMISC::TTime time)
- {
- _LastTime = _CurrentTime;
- _CurrentTime = time;
- }
-
- void changeControlMode()
- {
- _MouseFree = ! _MouseFree;
- if(_MouseFree)
- {
- _Scene->getDriver()->showCursor(true);
- }
- else
- {
- _Scene->getDriver()->showCursor(false);
- }
- }
-
-
-}; // NL3D
-
-}
-
-#endif // NL_MOVE_LISTENER_H
-
-/* End of move_listener.h */
diff --git a/code/tool/zviewer/nevraxpill.ico b/code/tool/zviewer/nevraxpill.ico
deleted file mode 100644
index 1d50caa86..000000000
Binary files a/code/tool/zviewer/nevraxpill.ico and /dev/null differ
diff --git a/code/tool/zviewer/readme.txt b/code/tool/zviewer/readme.txt
deleted file mode 100644
index 5dba3d8f4..000000000
--- a/code/tool/zviewer/readme.txt
+++ /dev/null
@@ -1,175 +0,0 @@
-
- ====================
- ZVIEWER
- ====================
-
-
-ZVIEWER permet de visioner une ou plusieurs zones exportées depuis 3DSMax
-au format de NeL, en utilisant le moteur.
-
-
-1. Le fichier zviewer.cfg
- -----------------------
-
-Le répertoire d'où est exécuté le programme doit contenir le fichier ZVIEWER.CFG
-qui contient les paramètres de configuration. Sans ce fichier aucune zone ne sera
-affichée.
-Lorsqu'il n'y a pas de fichier de configuration à l'execution un fichier type est
-généré.
-
-Exemple de config :
-
-FullScreen = 0;
-Width = 800;
-Height = 600;
-Depth = 32;
-Position = { 1088.9, -925.7, -1234.0 };
-EyesHeight = 1.80;
-Background = { 100, 100, 255 };
-ZFar = 1000.0;
-LandscapeTileNear = 50.0;
-LandscapeThreshold = 0.001;
-BanksPath = "C:\WINDOWS\Bureau\zviewer\" ;
-Bank = "fyros_landf.bank" ;
-TilesPath = "C:\WINDOWS\Bureau\zviewer\tiles" ;
-ZonesPath = "C:\WINDOWS\Bureau\zviewer\zones" ;
-IgPath = "C:\WINDOWS\Bureau\zviewer\ig" ;
-ShapePath = "C:\WINDOWS\Bureau\zviewer\shapes" ;
-MapsPath = "C:\WINDOWS\Bureau\zviewer\maps" ;
-Zones = { "3_AC.zonel","3_AD.zonel" };
-Zonessave = { "3_AC.zonel","3_AD.zonel" };
-Zones = { "3_AC.zonel","3_AD.zonel" };
-Ig = { "3_AC.ig","3_AD.ig" };
-
-Avec :
-
-Fullscreen :
-0 : windowed
-1 : fullscreen
-
-Width :
-largeur de la fenetre.
-
-Height :
-hauteur de la fenetre.
-
-Depth :
-nombre de couleurs (32bits,24bits,...).
-
-Position :
-position initiale (x,y,z). Correspond aux coordonnées dans Max (Generic Units).
-La position est automatiquement snapée au sol quelque soit la coordonnée en z.
-
-EyesHeight :
-hauteur des yeux pour le mode Walk.
-
-Background :
-couleur rgb du fond.
-
-ZFar :
-distance de clipping. Plus la distance est grande, plus on voit loin.
-
-LandscapeTileNear :
-valeur du near. Plus cette valeur est grande, plus la zone du near est grande.
-
-LandscapeThreshold :
-seuil utilisé pour la subdivision adaptative. Quand la valeur augmente, la qualité
-de la subdivision diminue (reduit le temps de calcul). Mis au minimum par defaut (0.001).
-
-BanksPath :
-chemin des banks (.bank et .farbank).
-
-Bank :
-nom de la bank (meme racine que la farbank)
-
-ZonesPath :
-chemin des zones.
-
-Zones :
-liste des noms des zones
-
-
-2. Les déplacements
- ----------------
-
-Les déplacements se font à l'aide de la combinaison clavier/souris.
-Il existe 2 modes de déplacement : FreeLook et Walk (defaut).
-
-- Le mode FreeLook permet de se déplacer dans la direction du regard(idem cstrike).
-- Dans le mode Walk le déplacement se fait au niveau du sol, à hauteur des yeux.
- L'utilisateur reste collé au sol.
-
-La souris permet d'orienter le regard dans toutes les directions
-Le clavier permet de se déplacer.
-
-
-3. Les touches
- -----------
-ESC : quitter le viewer
-F1 : Afficher/Masquer les infos
-F3 : basculer entre le mode plein et le mode fil de fer
-F12 : faire un screenshot
-ESPACE : basculer entre les modes Walk et Free-Look
-RETURN : libérer ou capturer la souris
-UP : avancer
-DOWN : reculer
-LEFT : déplacement latéral à gauche
-RIGHT : déplacement latéral à droite
-SHIFT : augmenter l'altitude
-CTRL : baisser d'altitude
-1 : 5 km/h
-2 : 10 km/h
-3 : 20 km/h
-4 : 40 km/h
-5 : 80 km/h
-6 : 160 km/h
-7 : 320 km/h
-8 : 640 km/h
-PAGEUP : augmenter la distance de clipping
-PAGEDOWN : diminuer la distance de clipping
-HOME : augmenter le near
-END : diminuer le near
-INSERT : augmenter le threshold
-DELETE : diminuer le threshold
-ADD : augmenter la hauteur des yeux
-SUBTRACT : diminuer la hauteur des yeux
-
-==================== ZVIEWER ENGLISH ====================
-
-ZViewer allows you to view one or more zones exported from 3DSMax inside the NeL Engine
-
-
-When you run ZViewer for the first time if no configuration file is located one will be created with default values.
-The Configuration file defines the zones to load and other vital information and will not work in it's default state
-
-
-Keys
-
-ESC: exit ZViewer
-F1: toggles information
-F3: toggles between full and the wire frame mode
-F12: screenshot
-SPACE: toggles between Walk and Free-Look mode
-RETURN: release or capture mouse
-UP: move forward
-DOWN: move back
-LEFT: turn left
-RIGHT: turn right
-SHIFT: increases altitude
-CTRL: decreases altitude
-1: 5 km/h
-2: 10 km/h
-3: 20 km/h
-4: 40 km/h
-5: 80 km/h
-6: 160 km/h
-7: 320 km/h
-8: 640 km/h
-PAGEUP: increases the clipping distance
-PAGEDOWN: decreases the clipping distance
-HOME: increases tilenear
-END: decreases the tilenear
-INSERT: increases threshold
-DELETE: decreases threshold
-ADD: increases the eye height
-SUBTRACT: decreases the eye height
diff --git a/code/tool/zviewer/resource.h b/code/tool/zviewer/resource.h
deleted file mode 100644
index c2dc7f840..000000000
--- a/code/tool/zviewer/resource.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// NeL - MMORPG Framework
-// Copyright (C) 2010 Winch Gate Property Limited
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by zviewer.rc
-//
-#define IDI_ICON1 101
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/code/tool/zviewer/zviewer.cfg b/code/tool/zviewer/zviewer.cfg
deleted file mode 100644
index 9e9bedc8e..000000000
--- a/code/tool/zviewer/zviewer.cfg
+++ /dev/null
@@ -1,37 +0,0 @@
-FullScreen = 0;
-Width = 800;
-Height = 600;
-Depth = 32;
-Position = { 1676, -7361, 0.000000 };
-EyesHeight = 1.800000;
-Background = { 100, 100, 255 };
-ZFar = 1000.000000;
-AutoLight = 0;
-LightDir = { 1.000000, 0.000000, 0.000000 };
-LandscapeNoise = 0;
-LandscapeTileNear = 50.000000;
-LandscapeThreshold = 0.001000;
-BanksPath = "R:\code\snowballs2\client\data\tiles";
-TilesPath = "R:\code\snowballs2\client\data\tiles";
-UseDDS = "1";
-AllPathRelative = "0";
-Bank = "bank.bank";
-ZonesPath = "R:\code\snowballs2\client\data\zones";
-IgPath = "R:\code\snowballs2\client\data\zones";
-ShapePath = "R:\code\snowballs2\client\data\shapes";
-MapsPath = "R:\code\snowballs2\client\data\maps";
-FontPath = "C:\Windows\fonts\arial.ttf";
-HeightFieldName = "";
-HeightFieldMaxZ = 100.000000;
-HeightFieldOriginX = 16000.000000;
-HeightFieldOriginY = -24000.000000;
-HeightFieldSizeX = 160.000000;
-HeightFieldSizeY = 160.000000;
-LandAmbient = { 0, 0, 0};
-LandDiffuse = { 255, 255, 255};
-Zones = {
-"3_AC.zonel",
-"3_AD.zonel",
-};
-Ig = {
-};
diff --git a/code/tool/zviewer/zviewer.cpp b/code/tool/zviewer/zviewer.cpp
deleted file mode 100644
index 3f642d352..000000000
--- a/code/tool/zviewer/zviewer.cpp
+++ /dev/null
@@ -1,975 +0,0 @@
-// NeL - MMORPG Framework
-// Copyright (C) 2010 Winch Gate Property Limited
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-//#include "nel/net/local_entity.h"
-
-#include "move_listener.h"
-
-// Tempyoyo.
-#include
-
-
-#include
-#include
-
-using namespace std;
-using namespace NLMISC;
-using namespace NL3D;
-
-
-#define BANK_PAH_RELATIVE
-
-
-/**
- * CViewerConfig
- */
-struct CViewerConfig
-{
- bool Windowed;
- uint Width;
- uint Height;
- uint Depth;
- CVector Position;
- CVector Heading;
- CVector EyesHeight;
- CRGBA Background;
-
- // Landscape
- bool AutoLight;
- CVector LightDir;
- string ZonesPath;
- string BanksPath;
- string TilesPath;
- bool UseDDS;
- bool AllPathRelative;
-
- string IgPath;
- string ShapePath;
- string MapsPath;
- string Bank;
- string FontPath;
- CTextContext TextContext;
- CFontManager FontManager;
- float ZFar;
- float LandscapeTileNear;
- float LandscapeThreshold;
- bool LandscapeNoise;
- vector Zones;
- vector Igs;
-
- // HeightField.
- string HeightFieldName;
- float HeightFieldMaxZ;
- float HeightFieldOriginX;
- float HeightFieldOriginY;
- float HeightFieldSizeX;
- float HeightFieldSizeY;
-
- // StaticLight
- CRGBA LandAmbient;
- CRGBA LandDiffuse;
-
- CViewerConfig()
- {
- Windowed = true;
- Width = 800;
- Height = 600;
- Depth = 32;
- Position = CVector( 1088.987793f, -925.732178f, 0.0f );
- Heading = CVector(0,1,0);
- EyesHeight = CVector(0,0,1.8f);
- Background = CRGBA(100,100,255);
- AutoLight = false;
- LightDir = CVector (1, 0, 0);
- ZonesPath = "./";
- BanksPath = "./";
- TilesPath = "./";
- UseDDS = false;
- AllPathRelative = false;
- IgPath = "./";
- ShapePath = "./";
- MapsPath = "./";
- Bank = "bank.bank";
- FontPath = "\\\\server\\code\\fonts\\arialuni.ttf";
- ZFar = 1000;
- LandscapeTileNear = 50.0f;
- LandscapeThreshold = 0.001f;
- LandscapeNoise = true;
-
- HeightFieldName= "";
- HeightFieldMaxZ= 100;
- HeightFieldOriginX= 16000;
- HeightFieldOriginY= -24000;
- HeightFieldSizeX= 160;
- HeightFieldSizeY= 160;
-
- CRGBA diffuse (241, 226, 244);
- CRGBA ambiant (17, 54, 100);
- LandDiffuse= diffuse;
- LandAmbient= ambiant;
-
- }
-};
-
-CViewerConfig ViewerCfg;
-
-
-
-CLandscapeModel *Landscape = NULL;
-CMoveListener MoveListener;
-CMiniCol CollisionManager;
-
-
-
-
-
-
-
-
-
-
-
-/*******************************************************************\
- getZoneNameByCoord()
-\*******************************************************************/
-string getZoneNameByCoord(float x, float y)
-{
- const float zoneDim = 160.0f;
-
- float xcount = x/zoneDim;
- float ycount = -y/zoneDim + 1;
-
- string zoneName;
- char ych[32];
- sprintf(ych,"%d",(sint)ycount);
- sint sz = strlen(ych);
- for(sint i = 0; iactiveVertexBuffer(vb);
-
- CIndexBuffer pbTri;
- pbTri.setNumIndexes (3);
- {
- CIndexBufferReadWrite iba;
- pbTri.lock (iba);
- iba.setTri (0, 0, 1, 2);
- }
-
- CIndexBuffer pbQuad;
- pbQuad.setNumIndexes (6);
- {
- CIndexBufferReadWrite iba;
- pbQuad.lock(iba);
- iba.setTri (0, 3, 4, 5);
- iba.setTri (3, 5, 6, 3);
- }
-
- CNELU::Driver->setFrustum (0.f, 4.f/3.f, 0.f, 1.f, -1.f, 1.f, false);
- CMatrix mtx;
- mtx.identity();
- CNELU::Driver->setupViewMatrix (mtx);
-
- mat.setColor(CRGBA(50,255,255,150));
-
- // up
- mtx.identity();
- mtx.translate(CVector(x,0,y));
- mtx.rotateY(MoveListener.getRotZ() );
- mtx.translate(CVector(0,0,radius));
- CNELU::Driver->setupModelMatrix (mtx);
- CNELU::Driver->activeVertexBuffer(vb);
- CNELU::Driver->activeIndexBuffer(pbTri);
- CNELU::Driver->renderTriangles(mat, 0, pbTri.getNumIndexes()/3);
-
- mat.setColor(CRGBA(50,50,255,150));
-
- // down
- mtx.identity();
- mtx.translate(CVector(x,0,y));
- mtx.rotateY(MoveListener.getRotZ() + (float)Pi);
- mtx.translate(CVector(0,0,radius));
- CNELU::Driver->setupModelMatrix (mtx);
- CNELU::Driver->renderTriangles(mat, 0, pbTri.getNumIndexes()/3);
-
- // left
- mtx.identity();
- mtx.translate(CVector(x,0,y));
- mtx.rotateY(MoveListener.getRotZ() - (float)Pi/2);
- mtx.translate(CVector(0,0,radius));
- CNELU::Driver->setupModelMatrix (mtx);
- CNELU::Driver->renderTriangles(mat, 0, pbTri.getNumIndexes()/3);
-
- // right
- mtx.identity();
- mtx.translate(CVector(x,0,y));
- mtx.rotateY(MoveListener.getRotZ() + (float)Pi/2);
- mtx.translate(CVector(0,0,radius));
- CNELU::Driver->setupModelMatrix (mtx);
- CNELU::Driver->renderTriangles(mat, 0, pbTri.getNumIndexes()/3);
-
- // center
- mtx.identity();
- mtx.translate(CVector(x,0,y));
- mtx.rotateY(MoveListener.getRotZ());
- CNELU::Driver->setupModelMatrix (mtx);
- CNELU::Driver->activeIndexBuffer(pbQuad);
- CNELU::Driver->renderTriangles(mat, 0, pbQuad.getNumIndexes()/3);
-}
-
-
-
-
-
-/*********************************************************\
- displayZone()
-\*********************************************************/
-void displayZones()
-{
- const float zFarStep = 5.0f;
- const float tileNearStep = 10.0f;
- const float thresholdStep = 0.005f;
-
- ViewerCfg.TextContext.setHotSpot(CComputedString::MiddleMiddle);
- ViewerCfg.TextContext.setColor(CRGBA(255,255,255));
- ViewerCfg.TextContext.setFontSize(20);
-
- CNELU::clearBuffers(CRGBA(0,0,0));
- CNELU::swapBuffers();
-
-
-
- // Create landscape
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Creating landscape...");
- CNELU::swapBuffers();
-
- Landscape = (CLandscapeModel*)CNELU::Scene->createModel(LandscapeModelId);
- Landscape->Landscape.setNoiseMode (ViewerCfg.LandscapeNoise);
- Landscape->Landscape.setTileNear(ViewerCfg.LandscapeTileNear);
- Landscape->Landscape.setThreshold(ViewerCfg.LandscapeThreshold);
-
- Landscape->Landscape.enableAutomaticLighting (ViewerCfg.AutoLight);
- Landscape->Landscape.setupAutomaticLightDir (ViewerCfg.LightDir);
-
- // Enable Additive Tiles.
- Landscape->enableAdditive(true);
-
- // HeightField.
- CBitmap heightBitmap;
- if( ViewerCfg.HeightFieldName!="" && heightBitmap.load(CIFile(ViewerCfg.HeightFieldName)) )
- {
- CHeightMap heightMap;
- heightMap.buildFromBitmap(heightBitmap);
- heightMap.MaxZ= ViewerCfg.HeightFieldMaxZ;
- heightMap.OriginX= ViewerCfg.HeightFieldOriginX;
- heightMap.OriginY= ViewerCfg.HeightFieldOriginY;
- heightMap.SizeX = ViewerCfg.HeightFieldSizeX;
- heightMap.SizeY = ViewerCfg.HeightFieldSizeY;
- Landscape->Landscape.setHeightField(heightMap);
- }
-
-
- // Init TileBank.
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Initializing TileBanks...");
- CNELU::swapBuffers();
-
- try
- {
- CIFile bankFile (ViewerCfg.BanksPath + "/" + ViewerCfg.Bank);
- Landscape->Landscape.TileBank.serial(bankFile);
- }
- catch(Exception)
- {
- string tmp = string("Cant load bankfile ")+ViewerCfg.BanksPath + "/" + ViewerCfg.Bank;
- nlerror (tmp.c_str());
- }
-
- if ((Landscape->Landscape.TileBank.getAbsPath ()!="")&&(ViewerCfg.TilesPath!=""))
- Landscape->Landscape.TileBank.setAbsPath (ViewerCfg.TilesPath + "/");
-
- if (ViewerCfg.UseDDS)
- {
- Landscape->Landscape.TileBank.makeAllExtensionDDS();
- }
-
- if (ViewerCfg.AllPathRelative)
- Landscape->Landscape.TileBank.makeAllPathRelative();
-
- sint idx = ViewerCfg.Bank.find(".");
- string farBank = ViewerCfg.Bank.substr(0,idx);
- farBank += ".farbank";
-
- try
- {
- CIFile farbankFile(ViewerCfg.BanksPath + "/" + farBank);
- Landscape->Landscape.TileFarBank.serial(farbankFile);
- }
- catch(Exception)
- {
- string tmp = string("Cant load bankfile ")+ViewerCfg.BanksPath + "/" + farBank;
- nlerror (tmp.c_str());
- }
-
- if ( ! Landscape->Landscape.initTileBanks() )
- {
- nlwarning( "You need to recompute bank.farbank for the far textures" );
- }
-
- // Init light color
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Initializing Light...");
- CNELU::swapBuffers();
-
- Landscape->Landscape.setupStaticLight (ViewerCfg.LandDiffuse, ViewerCfg.LandAmbient, 1.1f);
-
- // Init collision manager
- CollisionManager.init( &(Landscape->Landscape), 200);
-
-
- // Preload of TileBank
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Loading TileBank...");
- CNELU::swapBuffers();
-
- for (int ts=0; tsLandscape.TileBank.getTileSetCount (); ts++)
- {
- CTileSet *tileSet=Landscape->Landscape.TileBank.getTileSet (ts);
- sint tl;
- for (tl=0; tlgetNumTile128(); tl++)
- Landscape->Landscape.flushTiles (CNELU::Scene->getDriver(), (uint16)tileSet->getTile128(tl), 1);
- for (tl=0; tlgetNumTile256(); tl++)
- Landscape->Landscape.flushTiles (CNELU::Scene->getDriver(), (uint16)tileSet->getTile256(tl), 1);
- for (tl=0; tlLandscape.flushTiles (CNELU::Scene->getDriver(), (uint16)tileSet->getTransition(tl)->getTile (), 1);
- }
-
-
- // Build zones.
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Loading zones...");
- CNELU::swapBuffers();
- uint32 i;
- for(i =0; iLandscape.addZone(zone);
-
- // Add it to collision manager.
- CollisionManager.addZone(zone.getZoneId());
- }
- catch(Exception &e)
- {
- printf(e.what ());
- }
- }
-
-
-
-
- // Load instance group.
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Loading objects...");
- CNELU::swapBuffers();
- for(i =0; iserial(file);
- file.close();
-
- // Add it to the scene.
- group->addToScene (*CNELU::Scene);
- }
- catch(Exception &e)
- {
- printf(e.what ());
- }
- }
-
- // Init collision Manager.
- CNELU::clearBuffers(CRGBA(0,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.5f,"Initializing collision manager...");
- CNELU::swapBuffers();
-
-
- CollisionManager.setCenter(ViewerCfg.Position);
- ViewerCfg.Position.z = 0.0f;
- CollisionManager.snapToGround( ViewerCfg.Position, 1000.0f );
-
-
-
- // hide mouse cursor
- CNELU::Driver->showCursor(false);
-#ifdef NL_RELEASE
- CNELU::Driver->setCapture(true);
-#endif
-
-
-
- // Events management
- CNELU::EventServer.addEmitter(CNELU::Driver->getEventEmitter());
- CNELU::AsyncListener.addToServer(CNELU::EventServer);
-
- MoveListener.init(CNELU::Scene, ViewerCfg.Width, ViewerCfg.Height, *CNELU::Camera);
- MoveListener.addToServer(CNELU::EventServer);
- MoveListener.setPos( ViewerCfg.Position );
-
- CNELU::Camera->setPerspective (float(80.0*Pi/180.0), 1.33f, 0.1f, 1000.0f);
-
- bool showInfos = true;
-
-
- // initializing Z-Clip Far
- float left;
- float right;
- float bottom;
- float top;
- float znear;
- float zfar;
- CNELU::Camera->getFrustum(left, right, bottom, top, znear, zfar);
- zfar = ViewerCfg.ZFar;
- CNELU::Camera->setFrustum(left, right, bottom, top, znear, zfar);
-
-
- do
- {
- // Time mgt.
- //==========
- static sint64 t0 = (sint64)CTime::getLocalTime();
- static sint64 t1 = (sint64)CTime::getLocalTime();
- static sint64 ts = 0;
-
- t0 = t1;
- t1 = (sint64)CTime::getLocalTime();
- sint64 dt64 = t1-t0;
- ts += dt64;
- float dt= ((float)dt64)*0.001f;
-
-
- CNELU::EventServer.pump();
-
-
- // Manage movement and collision
- MoveListener.setLocalTime(CTime::getLocalTime());
- CVector oldpos = MoveListener.getPos();
- MoveListener.changeViewMatrix();
- if(MoveListener.getMode()==CMoveListener::WALK)
- {
- CVector pos = MoveListener.getPos();
- CollisionManager.snapToGround( pos , 1000.0f );
- MoveListener.setPos( pos );
- }
- CollisionManager.setCenter(MoveListener.getPos());
-
-
- // Change move mode
- if(CNELU::AsyncListener.isKeyPushed(KeySPACE))
- {
- MoveListener.swapMode();
- }
-
-
- // Change displaying infos state
- if(CNELU::AsyncListener.isKeyPushed(KeyF1))
- {
- showInfos = !showInfos;
- }
-
-
- // Change eyes height
- float eh = MoveListener.getEyesHeight();
- if(CNELU::AsyncListener.isKeyPushed(KeyADD))
- {
- ViewerCfg.EyesHeight.z += 0.1f;
- eh += 0.1f;
- }
- if(CNELU::AsyncListener.isKeyPushed(KeySUBTRACT))
- {
- ViewerCfg.EyesHeight.z -= 0.1f;
- eh -= 0.1f;
- }
- if(ViewerCfg.EyesHeight.z<0.1f) ViewerCfg.EyesHeight.z = 0.1f;
- if(eh<0.1f) eh = 0.1f;
- MoveListener.setEyesHeight(eh);
-
-
- // Change TileNear
- float tileNear = Landscape->Landscape.getTileNear();
- if(CNELU::AsyncListener.isKeyPushed(KeyHOME))
- tileNear += tileNearStep;
- if(CNELU::AsyncListener.isKeyPushed(KeyEND))
- tileNear -= tileNearStep;
- if(tileNear<0) tileNear = 0;
- Landscape->Landscape.setTileNear(tileNear);
-
-
- // Change Z-Far
- CNELU::Camera->getFrustum(left, right, bottom, top, znear, zfar);
- if(CNELU::AsyncListener.isKeyDown(KeyPRIOR))
- zfar += zFarStep;
- if(CNELU::AsyncListener.isKeyDown(KeyNEXT))
- zfar -= zFarStep;
- if(zfar<0) zfar = 0;
- CNELU::Camera->setFrustum(left, right, bottom, top, znear, zfar);
-
-
- // Change Threshold
- float threshold = Landscape->Landscape.getThreshold();
- if(CNELU::AsyncListener.isKeyPushed(KeyINSERT))
- threshold += thresholdStep;
- if(CNELU::AsyncListener.isKeyPushed(KeyDELETE))
- threshold -= thresholdStep;
- if(threshold<0.001f) threshold = 0.001f;
- if(threshold>0.1f) threshold = 0.1f;
- Landscape->Landscape.setThreshold(threshold);
-
-
- // Switch between wired and filled scene display
- if(CNELU::AsyncListener.isKeyPushed(KeyF3))
- {
- if (CNELU::Driver->getPolygonMode ()==IDriver::Filled)
- CNELU::Driver->setPolygonMode (IDriver::Line);
- else
- CNELU::Driver->setPolygonMode (IDriver::Filled);
- }
-
-
- // Switch between mouse move and keyboard-only move
- if(CNELU::AsyncListener.isKeyPushed(KeyRETURN))
- {
- MoveListener.changeControlMode();
- }
-
-
-
- // Render
- //=======
- CNELU::clearBuffers(ViewerCfg.Background);
- CNELU::Driver->clearZBuffer();
- CNELU::Scene->render();
-
-
- if(showInfos)
- {
-
- // black top quad
- CDRU::drawQuad(0,0.97f,1.0f,1.0f,*CNELU::Driver,CRGBA(0,0,0),CNELU::Scene->getViewport());
-
- // black bottom quad
- CDRU::drawQuad(0,0,1.0f,0.03f,*CNELU::Driver,CRGBA(0,0,0),CNELU::Scene->getViewport());
-
-
- ViewerCfg.TextContext.setFontSize(12);
- ViewerCfg.TextContext.setHotSpot(CComputedString::MiddleTop);
- ViewerCfg.TextContext.setColor(CRGBA(255,255,255));
-
- // Display fps.
- ViewerCfg.TextContext.printfAt(0.05f,0.99f,"%.1f fps",1/dt);
-
- // Display ms
- ViewerCfg.TextContext.printfAt(0.12f,0.99f,"%d ms",dt64);
-
- // Display Tile Near
- ViewerCfg.TextContext.printfAt(0.75f,0.99f,"Tile Near : %.1f",tileNear);
-
- //Display moving mode
- ViewerCfg.TextContext.setColor(CRGBA(255,0,0));
- switch(MoveListener.getMode())
- {
- case CMoveListener::WALK :
- ViewerCfg.TextContext.printfAt(0.5f,0.99f,"Walk Mode");
- break;
- case CMoveListener::FREE :
- ViewerCfg.TextContext.printfAt(0.5f,0.99f,"Free-Look Mode");
- break;
- default:
- break;
- }
- ViewerCfg.TextContext.setColor(CRGBA(255,255,255));
-
- // Display Threshold
- ViewerCfg.TextContext.printfAt(0.3f,0.99f,"Threshold : %.3f",threshold);
-
- // Display Clip Far
- ViewerCfg.TextContext.printfAt(0.92f,0.99f,"Clip Far : %.1f",zfar);
-
-
- ViewerCfg.TextContext.setHotSpot(CComputedString::MiddleBottom);
-
- // Display current zone name
- CVector pos = MoveListener.getPos();
- string zoneName = getZoneNameByCoord(pos.x, pos.y);
- ViewerCfg.TextContext.printfAt(0.3f,0.01f,"Zone : %s",zoneName.c_str());
-
- // Position
- ViewerCfg.TextContext.printfAt(0.1f,0.01f,"Position : %d %d %d",(sint)pos.x,(sint)pos.y,(sint)pos.z);
-
- // Eyes height
- ViewerCfg.TextContext.printfAt(0.7f,0.01f,"Eyes : %.2f m",ViewerCfg.EyesHeight.z);
-
- // Display speed in km/h
- ViewerCfg.TextContext.setColor(CRGBA(255,0,0));
- ViewerCfg.TextContext.printfAt(0.5f,0.01f,"Speed : %d km/h",(sint)(MoveListener.getSpeed()*3.6f));
- ViewerCfg.TextContext.setColor(CRGBA(255,255,255));
-
- // Heading
- sint heading = -(sint)(MoveListener.getRotZ()*180/Pi)%360;
- if(heading<0) heading += 360;
- ViewerCfg.TextContext.printfAt(0.9f,0.01f,"Heading : %d degrees",heading);
-
- // Display the cool compass.
- displayOrientation();
- }
-
-
- CNELU::swapBuffers();
- CNELU::screenshot();
- }
- while(!CNELU::AsyncListener.isKeyPushed(KeyESCAPE));
-
-
-
-
-
- ViewerCfg.Position = MoveListener.getPos();
-
- CNELU::AsyncListener.removeFromServer(CNELU::EventServer);
- MoveListener.removeFromServer(CNELU::EventServer);
-
- CNELU::Driver->showCursor(true);
-#ifdef NL_RELEASE
- CNELU::Driver->setCapture(false);
-#endif
-}
-
-
-
-
-/****************************************************************\
- writeConfigFile
-\****************************************************************/
-void writeConfigFile(const char * configFileName)
-{
- FILE * f = fopen(configFileName,"wt");
-
- if(f==NULL)
- {
- fprintf(stderr,"can't open file '%s'\n",configFileName);
- }
-
- fprintf(f,"FullScreen = %d;\n",ViewerCfg.Windowed?0:1);
- fprintf(f,"Width = %d;\n",ViewerCfg.Width);
- fprintf(f,"Height = %d;\n",ViewerCfg.Height);
- fprintf(f,"Depth = %d;\n",ViewerCfg.Depth);
- fprintf(f,"Position = { %f, %f, %f };\n", ViewerCfg.Position.x,ViewerCfg.Position.y,ViewerCfg.Position.z);
- fprintf(f,"EyesHeight = %f;\n", ViewerCfg.EyesHeight.z);
- fprintf(f,"Background = { %d, %d, %d };\n", ViewerCfg.Background.R,ViewerCfg.Background.G,ViewerCfg.Background.B);
- fprintf(f,"ZFar = %f;\n", ViewerCfg.ZFar);
-
- fprintf(f,"AutoLight = %d;\n", ViewerCfg.AutoLight?1:0);
- fprintf(f,"LightDir = { %f, %f, %f };\n", ViewerCfg.LightDir.x, ViewerCfg.LightDir.y, ViewerCfg.LightDir.z);
- fprintf(f,"LandscapeTileNear = %f;\n", ViewerCfg.LandscapeTileNear);
- fprintf(f,"LandscapeThreshold = %f;\n", ViewerCfg.LandscapeThreshold);
- fprintf(f,"LandscapeNoise = %d;\n", (int)ViewerCfg.LandscapeNoise);
- fprintf(f,"BanksPath = \"%s\";\n",ViewerCfg.BanksPath.c_str());
- fprintf(f,"TilesPath = \"%s\";\n",ViewerCfg.TilesPath.c_str());
- fprintf(f,"UseDDS = \"%d\";\n",ViewerCfg.UseDDS?1:0);
- fprintf(f,"AllPathRelative = \"%d\";\n",ViewerCfg.AllPathRelative?1:0);
- fprintf(f,"Bank = \"%s\";\n",ViewerCfg.Bank.c_str());
- fprintf(f,"ZonesPath = \"%s\";\n",ViewerCfg.ZonesPath.c_str());
- fprintf(f,"IgPath = \"%s\";\n",ViewerCfg.IgPath.c_str());
- fprintf(f,"ShapePath = \"%s\";\n",ViewerCfg.ShapePath.c_str());
- fprintf(f,"MapsPath = \"%s\";\n",ViewerCfg.MapsPath.c_str());
- fprintf(f,"FontPath = \"%s\";\n",ViewerCfg.FontPath.c_str());
-
- fprintf(f,"HeightFieldName = \"%s\";\n", ViewerCfg.HeightFieldName.c_str());
- fprintf(f,"HeightFieldMaxZ = %f;\n", ViewerCfg.HeightFieldMaxZ);
- fprintf(f,"HeightFieldOriginX = %f;\n", ViewerCfg.HeightFieldOriginX);
- fprintf(f,"HeightFieldOriginY = %f;\n", ViewerCfg.HeightFieldOriginY);
- fprintf(f,"HeightFieldSizeX = %f;\n", ViewerCfg.HeightFieldSizeX);
- fprintf(f,"HeightFieldSizeY = %f;\n", ViewerCfg.HeightFieldSizeY);
-
- fprintf(f,"LandAmbient = { %d, %d, %d };\n", ViewerCfg.LandAmbient.R,ViewerCfg.LandAmbient.G,ViewerCfg.LandAmbient.B);
- fprintf(f,"LandDiffuse = { %d, %d, %d };\n", ViewerCfg.LandDiffuse.R,ViewerCfg.LandDiffuse.G,ViewerCfg.LandDiffuse.B);
-
- fprintf(f,"Zones = {\n");
- fprintf(f,"};\n");
-
- fprintf(f,"Ig = {\n");
- fprintf(f,"};\n");
-
- fclose(f);
-}
-
-
-
-/****************************************************************\
- init()
-\****************************************************************/
-void initViewerConfig(const char * configFileName)
-{
- FILE * f = fopen(configFileName,"rt");
- if(f==NULL)
- {
- nlwarning("'%s' not found, default values used", configFileName);
- writeConfigFile(configFileName);
- }
- else fclose (f);
-
- try
- {
- CConfigFile cf;
-
- cf.load(configFileName);
-
- CConfigFile::CVar &cvFullScreen = cf.getVar("FullScreen");
- ViewerCfg.Windowed = cvFullScreen.asInt() ? false : true;
-
- CConfigFile::CVar &cvWidth = cf.getVar("Width");
- ViewerCfg.Width = cvWidth.asInt();
-
- CConfigFile::CVar &cvHeight = cf.getVar("Height");
- ViewerCfg.Height = cvHeight.asInt();
-
- CConfigFile::CVar &cvDepth = cf.getVar("Depth");
- ViewerCfg.Depth = cvDepth.asInt();
-
- CConfigFile::CVar &cvPosition = cf.getVar("Position");
- nlassert(cvPosition.size()==3);
- ViewerCfg.Position.x = cvPosition.asFloat(0);
- ViewerCfg.Position.y = cvPosition.asFloat(1);
- ViewerCfg.Position.z = cvPosition.asFloat(2);
-
- CConfigFile::CVar &cvEyesHeight = cf.getVar("EyesHeight");
- ViewerCfg.EyesHeight = CVector(0,0,cvEyesHeight.asFloat());
-
- CConfigFile::CVar &cvBackColor = cf.getVar("Background");
- nlassert(cvBackColor.size()==3);
- ViewerCfg.Background.R = cvBackColor.asInt(0);
- ViewerCfg.Background.G = cvBackColor.asInt(1);
- ViewerCfg.Background.B = cvBackColor.asInt(2);
-
- CConfigFile::CVar &cvZFar = cf.getVar("ZFar");
- ViewerCfg.ZFar = cvZFar.asFloat();
-
- CConfigFile::CVar &cvAutoLight = cf.getVar("AutoLight");
- ViewerCfg.AutoLight = cvAutoLight.asInt() ? true : false;
-
- CConfigFile::CVar &cvLightDir = cf.getVar("LightDir");
- nlassert(cvLightDir.size()==3);
- ViewerCfg.LightDir.x = cvLightDir.asFloat(0);
- ViewerCfg.LightDir.y = cvLightDir.asFloat(1);
- ViewerCfg.LightDir.z = cvLightDir.asFloat(2);
-
- CConfigFile::CVar &cvLandscapeTileNear = cf.getVar("LandscapeTileNear");
- ViewerCfg.LandscapeTileNear = cvLandscapeTileNear.asFloat();
-
- CConfigFile::CVar &cvLandscapeThreshold = cf.getVar("LandscapeThreshold");
- ViewerCfg.LandscapeThreshold = cvLandscapeThreshold.asFloat();
-
- CConfigFile::CVar &cvLandscapeNoise = cf.getVar("LandscapeNoise");
- ViewerCfg.LandscapeNoise = cvLandscapeNoise.asInt() != 0;
-
- CConfigFile::CVar &cvBanksPath = cf.getVar("BanksPath");
- ViewerCfg.BanksPath = cvBanksPath.asString();
-
- CConfigFile::CVar &cvTilesPath = cf.getVar("TilesPath");
- ViewerCfg.TilesPath = cvTilesPath.asString();
-
- CConfigFile::CVar &cvUseDDS = cf.getVar("UseDDS");
- ViewerCfg.UseDDS = cvUseDDS.asInt() ? true : false;
-
- CConfigFile::CVar &cvAllPathRelative = cf.getVar("AllPathRelative");
- ViewerCfg.AllPathRelative = cvAllPathRelative.asInt() ? true : false;
-
- CConfigFile::CVar &cvBank = cf.getVar("Bank");
- ViewerCfg.Bank = cvBank.asString();
-
- CConfigFile::CVar &cvZonesPath = cf.getVar("ZonesPath");
- ViewerCfg.ZonesPath = cvZonesPath.asString();
- CPath::addSearchPath(cvZonesPath.asString());
-
- CConfigFile::CVar &cvIgPath = cf.getVar("IgPath");
- ViewerCfg.IgPath = cvIgPath.asString();
- CPath::addSearchPath(cvIgPath.asString());
-
- CConfigFile::CVar &cvShapePath = cf.getVar("ShapePath");
- ViewerCfg.ShapePath = cvShapePath.asString();
- CPath::addSearchPath(cvShapePath.asString());
-
- CConfigFile::CVar &cvMapsPath = cf.getVar("MapsPath");
- ViewerCfg.MapsPath = cvMapsPath.asString();
- CPath::addSearchPath(cvMapsPath.asString());
-
- CConfigFile::CVar &cvFontPath = cf.getVar("FontPath");
- ViewerCfg.FontPath = cvFontPath.asString();
-
- CConfigFile::CVar &cvHeightFieldName = cf.getVar("HeightFieldName");
- ViewerCfg.HeightFieldName = cvHeightFieldName.asString();
-
- CConfigFile::CVar &cvHeightFieldMaxZ = cf.getVar("HeightFieldMaxZ");
- ViewerCfg.HeightFieldMaxZ = cvHeightFieldMaxZ.asFloat();
-
- CConfigFile::CVar &cvHeightFieldOriginX = cf.getVar("HeightFieldOriginX");
- ViewerCfg.HeightFieldOriginX = cvHeightFieldOriginX.asFloat();
-
- CConfigFile::CVar &cvHeightFieldOriginY = cf.getVar("HeightFieldOriginY");
- ViewerCfg.HeightFieldOriginY = cvHeightFieldOriginY.asFloat();
-
- CConfigFile::CVar &cvHeightFieldSizeX = cf.getVar("HeightFieldSizeX");
- ViewerCfg.HeightFieldSizeX = cvHeightFieldSizeX.asFloat();
-
- CConfigFile::CVar &cvHeightFieldSizeY = cf.getVar("HeightFieldSizeY");
- ViewerCfg.HeightFieldSizeY = cvHeightFieldSizeY.asFloat();
-
-
- CConfigFile::CVar &cvLandAmb = cf.getVar("LandAmbient");
- nlassert(cvLandAmb.size()==3);
- ViewerCfg.LandAmbient.R = cvLandAmb.asInt(0);
- ViewerCfg.LandAmbient.G = cvLandAmb.asInt(1);
- ViewerCfg.LandAmbient.B = cvLandAmb.asInt(2);
-
- CConfigFile::CVar &cvLandDiff = cf.getVar("LandDiffuse");
- nlassert(cvLandDiff.size()==3);
- ViewerCfg.LandDiffuse.R = cvLandDiff.asInt(0);
- ViewerCfg.LandDiffuse.G = cvLandDiff.asInt(1);
- ViewerCfg.LandDiffuse.B = cvLandDiff.asInt(2);
-
-
- CConfigFile::CVar &cvZones = cf.getVar("Zones");
- for(uint i=0; isetTransformMode(ITransformable::DirectMatrix);
-
- // Init the font manager
-
- initViewerConfig("zviewer.cfg");
-
- ViewerCfg.TextContext.init (CNELU::Driver, &ViewerCfg.FontManager);
- ViewerCfg.TextContext.setFontGenerator(ViewerCfg.FontPath);
- ViewerCfg.TextContext.setFontSize(12);
- ViewerCfg.FontManager.setMaxMemory(2000000);
-
- displayZones();
-
- // release nelu
- NL3D::CNELU::release();
-
- }
- catch (Exception &e)
- {
- fprintf (stderr,"main trapped an exception: '%s'", e.what ());
- }
-}
diff --git a/code/tool/zviewer/zviewer.rc b/code/tool/zviewer/zviewer.rc
deleted file mode 100644
index f7af331e6..000000000
--- a/code/tool/zviewer/zviewer.rc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-IDI_ICON1 ICON "nevraxpill.ico"
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/code/tool/zviewer/zviewer.vcproj b/code/tool/zviewer/zviewer.vcproj
deleted file mode 100644
index d9d3b23d4..000000000
--- a/code/tool/zviewer/zviewer.vcproj
+++ /dev/null
@@ -1,353 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-