Changed: #825 Remove all warning when compiling Ryzom

This commit is contained in:
kervala 2010-08-12 19:42:33 +02:00
parent 9984b638fb
commit ab11ddb805
4 changed files with 51 additions and 46 deletions

View file

@ -15,20 +15,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// // ---------------------------------------------------------------------------
// Includes // Includes
// // ---------------------------------------------------------------------------
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include <sstream>
#ifdef NL_OS_WINDOWS
# include <windows.h>
# undef min
# undef max
#endif
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/bitmap.h" #include "nel/misc/bitmap.h"
@ -44,6 +37,11 @@
#include "nel/3d/transform_shape.h" #include "nel/3d/transform_shape.h"
#include "nel/3d/event_mouse_listener.h" #include "nel/3d/event_mouse_listener.h"
#ifdef NL_OS_WINDOWS
# define NOMINMAX
# include <windows.h>
#endif // NL_OS_WINDOWS
#ifndef CV_DIR #ifndef CV_DIR
# define CV_DIR "." # define CV_DIR "."
#endif #endif
@ -117,15 +115,17 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
FILE *f = fopen (CPath::lookup(ScriptName).c_str(),"rb"); FILE *f = fopen (CPath::lookup(ScriptName).c_str(),"rb");
fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
int file_size = ftell (f); uint file_size = ftell (f);
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);
char *file_buf = (char*)malloc(file_size+1); char *file_buf = (char*)malloc(file_size+1);
fread (file_buf, 1, file_size, f); if (fread (file_buf, 1, file_size, f) != file_size)
nlwarning("Can't read %d elements", file_size);
file_buf[file_size] = 0; file_buf[file_size] = 0;
++file_size; ++file_size;
fclose (f); fclose (f);
char *buf_ptr = file_buf; char *buf_ptr = file_buf;
int nLastNbPlus = 0; sint nLastNbPlus = 0;
vector<CInstanceGroup*> pile; vector<CInstanceGroup*> pile;
pile.clear (); pile.clear ();
pile.push_back (pScene->getGlobalInstanceGroup()); pile.push_back (pScene->getGlobalInstanceGroup());
@ -134,7 +134,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
do do
{ {
char Line[256], *line_ptr; char Line[256], *line_ptr;
int nNbPlus = 0; sint nNbPlus = 0;
line_ptr = &Line[0]; line_ptr = &Line[0];
buf_ptr = readLine (line_ptr, buf_ptr); buf_ptr = readLine (line_ptr, buf_ptr);
@ -384,7 +384,6 @@ int main()
CNELU::Driver->swapBuffers (); CNELU::Driver->swapBuffers ();
// Keys management // Keys management
// --------------- // ---------------

View file

@ -486,7 +486,7 @@ void CLightingManager::computeModelLightContributions(NLMISC::CRGBA sunAmbient,
v= NLMISC::OptFastFloor(mergedAmbient.R); fastClamp8(v); amb.R= v; v= NLMISC::OptFastFloor(mergedAmbient.R); fastClamp8(v); amb.R= v;
v= NLMISC::OptFastFloor(mergedAmbient.G); fastClamp8(v); amb.G= v; v= NLMISC::OptFastFloor(mergedAmbient.G); fastClamp8(v); amb.G= v;
v= NLMISC::OptFastFloor(mergedAmbient.B); fastClamp8(v); amb.B= v; v= NLMISC::OptFastFloor(mergedAmbient.B); fastClamp8(v); amb.B= v;
amb.R = 255; amb.A = 255;
lightContrib.MergedPointLight= amb; lightContrib.MergedPointLight= amb;
// Indicate we use the merged pointLight => the model must recompute lighting each frame // Indicate we use the merged pointLight => the model must recompute lighting each frame

View file

@ -21,26 +21,31 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/file.h"
#include "nel/misc/bitmap.h"
#include "nel/misc/file.h"
#include "nel/misc/path.h"
#include "nel/misc/bitmap.h"
#include "nel/misc/events.h"
#include "nel/misc/time_nl.h"
#include "nel/misc/event_server.h" #include "nel/misc/event_server.h"
#include "nel/misc/event_listener.h" #include "nel/misc/event_listener.h"
#include "nel/misc/events.h"
#include "nel/misc/path.h"
#include "nel/misc/time_nl.h"
#include "nel/3d/driver.h"
#include "nel/3d/nelu.h" #include "nel/3d/nelu.h"
#include "nel/3d/driver.h"
#include "nel/3d/scene_group.h" #include "nel/3d/scene_group.h"
#include "nel/3d/text_context.h"
#include "nel/3d/transform_shape.h" #include "nel/3d/transform_shape.h"
#include "nel/3d/event_mouse_listener.h" #include "nel/3d/event_mouse_listener.h"
#include "nel/3d/text_context.h"
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# define NOMINMAX # define NOMINMAX
# include <windows.h> # include <windows.h>
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
#ifndef CV_DIR
# define CV_DIR "."
#endif
using namespace std; using namespace std;
using namespace NL3D; using namespace NL3D;
using namespace NLMISC; using namespace NLMISC;
@ -109,7 +114,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
FILE *f = fopen (ScriptName,"rb"); FILE *f = fopen (ScriptName,"rb");
fseek (f, 0, SEEK_END); fseek (f, 0, SEEK_END);
sint file_size = ftell (f); uint file_size = ftell (f);
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);
char *file_buf = (char*)malloc(file_size+1); char *file_buf = (char*)malloc(file_size+1);
if (fread (file_buf, 1, file_size, f) != file_size) if (fread (file_buf, 1, file_size, f) != file_size)
@ -194,7 +199,6 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Main // Main
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) int CALLBACK WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
#else // NL_OS_WINDOWS #else // NL_OS_WINDOWS
@ -204,7 +208,6 @@ int main(int argc, char **argv)
double rGlobalTime = 0; double rGlobalTime = 0;
double rOldGlobalTime = 0; double rOldGlobalTime = 0;
double rDeltaTime = 0; double rDeltaTime = 0;
double rMoveTime = 0;
vector<SDispCS> DispCS; vector<SDispCS> DispCS;
@ -217,18 +220,19 @@ int main(int argc, char **argv)
CNELU::init (800, 600, CViewport(), 32, true); CNELU::init (800, 600, CViewport(), 32, true);
CPath::addSearchPath("shapes/"); CNELU::Scene->enableLightingSystem(true);
CPath::addSearchPath("groups/"); CNELU::Scene->setAmbientGlobal(CRGBA(128,128,128));
CPath::addSearchPath("maps/");
CPath::addSearchPath("lightmaps/"); CPath::addSearchPath(CV_DIR);
CPath::addSearchPath("anims/"); CPath::addSearchPath(CV_DIR"/shapes");
///// CPath::addSearchPath("fonts/"); CPath::addSearchPath(CV_DIR"/groups");
CPath::addSearchPath(CV_DIR"/fonts");
CFontManager FontManager; CFontManager FontManager;
CTextContext TextContext; CTextContext TextContext;
TextContext.init (CNELU::Driver, &FontManager); TextContext.init (CNELU::Driver, &FontManager);
TextContext.setFontGenerator ("fonts/n019003l.pfb"); TextContext.setFontGenerator (NLMISC::CPath::lookup("n019003l.pfb"));
TextContext.setHotSpot (CComputedString::TopLeft); TextContext.setHotSpot (CComputedString::TopLeft);
TextContext.setColor (CRGBA(255,255,255)); TextContext.setColor (CRGBA(255,255,255));
TextContext.setFontSize (20); TextContext.setFontSize (20);
@ -242,21 +246,18 @@ int main(int argc, char **argv)
// Force to automatically find the cluster system // Force to automatically find the cluster system
CNELU::Camera->setClusterSystem ((CInstanceGroup*)-1); CNELU::Camera->setClusterSystem ((CInstanceGroup*)-1);
CClipTrav *pClipTrav = &CNELU::Scene->getClipTrav(); CClipTrav *pClipTrav = &CNELU::Scene->getClipTrav();
dcsTemp.Name = "Root"; dcsTemp.Name = "Root";
dcsTemp.pIG = NULL; dcsTemp.pIG = NULL;
DispCS.push_back (dcsTemp); DispCS.push_back (dcsTemp);
// Add all instance that create the scene // Add all instance that create the scene
// -------------------------------------- // --------------------------------------
// Begining of script reading // Beginning of script reading
CVector CameraStart; CVector CameraStart;
LoadSceneScript ("view_cs.txt", CNELU::Scene, DispCS, CameraStart); LoadSceneScript ("view_cs.txt", CNELU::Scene, DispCS, CameraStart);
CNELU::Scene->enableLightingSystem(true);
CMatrix m = MouseListener.getViewMatrix(); CMatrix m = MouseListener.getViewMatrix();
m.setPos (CameraStart); m.setPos (CameraStart);
MouseListener.setMatrix (m); MouseListener.setMatrix (m);
@ -353,8 +354,6 @@ int main(int argc, char **argv)
sAllClusters += ", "; sAllClusters += ", ";
} }
TextContext.printfAt (0, 1-0.028f, sAllClusters.c_str()); TextContext.printfAt (0, 1-0.028f, sAllClusters.c_str());
} }
// ----------------------------------------------------- // -----------------------------------------------------
@ -362,14 +361,13 @@ int main(int argc, char **argv)
CNELU::Driver->swapBuffers (); CNELU::Driver->swapBuffers ();
// Keys management // Keys management
// --------------- // ---------------
if (CNELU::AsyncListener.isKeyDown (KeySHIFT)) if (CNELU::AsyncListener.isKeyDown (KeySHIFT))
MouseListener.setSpeed (10.0f); MouseListener.setSpeed (50.0f);
else else
MouseListener.setSpeed (2.0f); MouseListener.setSpeed (10.0f);
CNELU::Camera->setMatrix (MouseListener.getViewMatrix()); CNELU::Camera->setMatrix (MouseListener.getViewMatrix());
@ -419,6 +417,7 @@ int main(int argc, char **argv)
} }
} }
while (!CNELU::AsyncListener.isKeyPushed (KeyESCAPE)); while ((!CNELU::AsyncListener.isKeyPushed(KeyESCAPE)) && CNELU::Driver->isActive());
return 0;
return EXIT_SUCCESS;
} }

View file

@ -76,6 +76,13 @@ struct CWeldableVertexInfos
sint PatchIndex; // patch sint PatchIndex; // patch
uint8 PatchVertex; // 0,1,2,3 uint8 PatchVertex; // 0,1,2,3
CWeldableVertexInfos()
{
IndexInZone = 0;
PatchIndex = 0;
PatchVertex = 0;
}
bool operator< (const CWeldableVertexInfos& wvinf) const bool operator< (const CWeldableVertexInfos& wvinf) const
{ {
if(IndexInZone<wvinf.IndexInZone) if(IndexInZone<wvinf.IndexInZone)