mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-30 15:45:59 +00:00
merge
This commit is contained in:
commit
3edb9289f7
7 changed files with 67 additions and 47 deletions
|
@ -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
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -152,7 +157,7 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector<SDispCS> &D
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nLastNbPlus >= nNbPlus)
|
if (nLastNbPlus >= nNbPlus)
|
||||||
for (int i = 0; i < ((nLastNbPlus-nNbPlus)+1); ++i)
|
for (int i = 0; i < ((nLastNbPlus-nNbPlus)+1); ++i)
|
||||||
if (pile.size() > 0)
|
if (pile.size() > 0)
|
||||||
pile.pop_back();
|
pile.pop_back();
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
|
ADD_SUBDIRECTORY(data)
|
||||||
|
ADD_SUBDIRECTORY(patcher)
|
||||||
|
|
||||||
IF(UNIX AND NOT APPLE)
|
IF(UNIX AND NOT APPLE)
|
||||||
ADD_SUBDIRECTORY(unix)
|
ADD_SUBDIRECTORY(unix)
|
||||||
ENDIF(UNIX AND NOT APPLE)
|
ENDIF(UNIX AND NOT APPLE)
|
||||||
|
|
||||||
INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX})
|
IF(RYZOM_SHARE_PREFIX)
|
||||||
|
CONFIGURE_FILE(client_default.cfg.in "${CMAKE_CURRENT_BINARY_DIR}/client_default.cfg")
|
||||||
|
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/client_default.cfg" DESTINATION ${RYZOM_ETC_PREFIX})
|
||||||
|
ELSE(RYZOM_SHARE_PREFIX)
|
||||||
|
INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX})
|
||||||
|
ENDIF(RYZOM_SHARE_PREFIX)
|
||||||
|
|
5
code/ryzom/client/data/CMakeLists.txt
Normal file
5
code/ryzom/client/data/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Uncomment next lines if you want to create gamedev.bnp
|
||||||
|
#ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_BINARY_DIR}/share/gamedev.bnp"
|
||||||
|
# COMMAND bnp_make -p ${CMAKE_CURRENT_SOURCE_DIR}/gamedev ${CMAKE_BINARY_DIR}/share > /dev/null)
|
||||||
|
|
||||||
|
#ADD_CUSTOM_TARGET(gamedev ALL DEPENDS "${CMAKE_BINARY_DIR}/share/gamedev.bnp")
|
3
code/ryzom/client/patcher/CMakeLists.txt
Normal file
3
code/ryzom/client/patcher/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FILE(GLOB SRC *.uxt)
|
||||||
|
|
||||||
|
INSTALL(FILES ${SRC} DESTINATION "${RYZOM_SHARE_PREFIX}/patcher")
|
Loading…
Reference in a new issue