Index: bldfiles/ncterrain2-tools.bld
===================================================================
--- bldfiles/ncterrain2-tools.bld (revision 2962)
+++ bldfiles/ncterrain2-tools.bld (working copy)
@@ -141,6 +141,8 @@
ngui
ncterrain2
nnetwork
+ ntoollib
+ ndsound
}
endtarget
Index: bldfiles/ncterrain2.bld
===================================================================
--- bldfiles/ncterrain2.bld (revision 2962)
+++ bldfiles/ncterrain2.bld (working copy)
@@ -59,5 +59,7 @@
ndshow
ngui
nnetwork
+ ntoollib
+ ndsound
}
endworkspace
Index: inc/ncterrain2/nchunklodmesh.h
===================================================================
--- inc/ncterrain2/nchunklodmesh.h (revision 2962)
+++ inc/ncterrain2/nchunklodmesh.h (working copy)
@@ -86,7 +86,7 @@
{
renderParams.shader->SetFloat4(nShaderState::MatDiffuse,
this->matDiffuse);
}
-
+/*
if (this->refMesh->GetRefillBuffersMode() == nMesh2::NeededNow)
{
// initiate loading process
@@ -99,10 +99,10 @@
n_sleep(0.001f);
}
}
-
+*/
nMesh2* mesh = this->refMesh.get();
n_assert(mesh->IsValid());
- renderParams.gfxServer->SetMesh(mesh);
+ renderParams.gfxServer->SetMesh(mesh, mesh);
renderParams.gfxServer->SetVertexRange(0, mesh->GetNumVertices());
renderParams.gfxServer->SetIndexRange(0, mesh->GetNumIndices());
renderParams.gfxServer->DrawIndexedNS(nGfxServer2::TriangleStrip);
Index: src/nct2tools/nbttotga.cc
===================================================================
--- src/nct2tools/nbttotga.cc (revision 2962)
+++ src/nct2tools/nbttotga.cc (working copy)
@@ -18,8 +18,8 @@
// get cmd line args
bool helpArg = args.GetBoolArg("-help");
- const char* inArg = args.GetStringArg("-in", 0);
- const char* outArg = args.GetStringArg("-out", 0);
+ nString inArg = args.GetStringArg("-in", 0);
+ nString outArg = args.GetStringArg("-out", 0);
int sizeArg = args.GetIntArg("-size", 256);
bool normalMapArg = args.GetBoolArg("-nmap");
float vscaleArg = args.GetFloatArg("-vscale", 10000.0f);
@@ -39,12 +39,12 @@
}
// check args
- if (!inArg)
+ if (!inArg.IsValid())
{
printf("-in arg expected!\n");
return 10;
}
- if (!outArg)
+ if (!outArg.IsValid())
{
printf("-out arg expected!\n");
return 10;
@@ -54,9 +54,9 @@
// open the bt file
nBtFile btFile(&kernelServer);
- if (!btFile.Open(inArg))
+ if (!btFile.Open(inArg.Get()))
{
- printf("Could not open bt file '%s' for reading.\n", inArg);
+ printf("Could not open bt file '%s' for reading.\n",
inArg.Get());
return 10;
}
@@ -64,9 +64,9 @@
nTgaFile tgaFile(&kernelServer);
tgaFile.SetWidth(sizeArg);
tgaFile.SetHeight(sizeArg);
- if (!tgaFile.OpenWrite(outArg))
+ if (!tgaFile.OpenWrite(outArg.Get()))
{
- printf("Could not open tga file for writing '%s'.\n", outArg);
+ printf("Could not open tga file for writing '%s'.\n",
outArg.Get());
return 10;
}
Index: src/nct2tools/nchopbtfile.cc
===================================================================
--- src/nct2tools/nchopbtfile.cc (revision 2962)
+++ src/nct2tools/nchopbtfile.cc (working copy)
@@ -16,8 +16,8 @@
// get cmd line args
bool helpArg = args.GetBoolArg("-help");
- const char* inArg = args.GetStringArg("-in", 0);
- const char* outArg = args.GetStringArg("-out", "out.bt");
+ nString inArg = args.GetStringArg("-in", 0);
+ nString outArg = args.GetStringArg("-out", "out.bt");
int xArg = args.GetIntArg("-x", 0);
int yArg = args.GetIntArg("-y", 0);
int wArg = args.GetIntArg("-w", 0);
@@ -41,7 +41,7 @@
}
// check args
- if (!inArg)
+ if (!inArg.IsValid())
{
printf("-in arg expected!");
return 10;
@@ -54,9 +54,9 @@
nKernelServer kernelServer;
nBtFile btFile(&kernelServer);
- if (!btFile.Open(inArg))
+ if (!btFile.Open(inArg.Get()))
{
- printf("Could not open -in file '%s'\n", inArg);
+ printf("Could not open -in file '%s'\n", inArg.Get());
return 10;
}
Index: src/nct2tools/nmaketerraintexture.cc
===================================================================
--- src/nct2tools/nmaketerraintexture.cc (revision 2962)
+++ src/nct2tools/nmaketerraintexture.cc (working copy)
@@ -17,7 +17,7 @@
// get cmd line args
bool helpArg = args.GetBoolArg("-help");
- const char* confArg = args.GetStringArg("-conf", 0);
+ nString confArg = args.GetStringArg("-conf", 0);
if (helpArg)
{
@@ -30,7 +30,7 @@
}
// check args
- if (!confArg)
+ if (!confArg.IsValid())
{
n_printf("-conf arg expected!\n");
return 10;
@@ -38,7 +38,7 @@
// create and configure a GenTerrainTexture object
nGenTerrainTexture genTexture(&kernelServer);
- genTexture.SetConfigFilename(confArg);
+ genTexture.SetConfigFilename(confArg.Get());
if (!genTexture.Run())
{
n_printf("Generating texture failed with: %s\n",
genTexture.GetError());
Index: src/nct2tools/nmaketqt2.cc
===================================================================
--- src/nct2tools/nmaketqt2.cc (revision 2962)
+++ src/nct2tools/nmaketqt2.cc (working copy)
@@ -20,9 +20,9 @@
// get cmd line args
bool helpArg = args.GetBoolArg("-help");
- const char* inFile = args.GetStringArg("-in", 0);
- const char* outFile = args.GetStringArg("-out", 0);
- const char* tmpFile = args.GetStringArg("-tmp", "home:tmp.tqt2");
+ nString inFile = args.GetStringArg("-in", 0);
+ nString outFile = args.GetStringArg("-out", 0);
+ nString tmpFile = args.GetStringArg("-tmp", "home:tmp.tqt2");
int depth = args.GetIntArg("-depth", 4);
int tileSize = args.GetIntArg("-tilesize", 256);
bool dxt1 = args.GetBoolArg("-dxt1");
@@ -43,12 +43,12 @@
return 5;
}
- if (!inFile)
+ if (!inFile.IsValid())
{
n_printf("Input filename required [-in]!\n");
return 10;
}
- if (!outFile)
+ if (!outFile.IsValid())
{
n_printf("Output filename required [-out]!\n");
return 10;
@@ -59,8 +59,8 @@
if (!compress)
{
nTqt2FileMaker fileMaker(&kernelServer);
- fileMaker.SetSourceFile(inFile);
- fileMaker.SetTargetFile(outFile);
+ fileMaker.SetSourceFile(inFile.Get());
+ fileMaker.SetTargetFile(outFile.Get());
fileMaker.SetTileSize(tileSize);
fileMaker.SetTreeDepth(depth);
if (!fileMaker.Run())
@@ -75,7 +75,7 @@
{
n_printf("-> compressing generated texture tiles...\n");
nTqt2Compressor compressor(&kernelServer);
- compressor.SetSourceFile(inFile);
+ compressor.SetSourceFile(inFile.Get());
if (dxt1)
{
compressor.SetMode(nTqt2Compressor::DXT1);
@@ -84,7 +84,7 @@
{
compressor.SetMode(nTqt2Compressor::DXT5);
}
- compressor.SetTargetFile(outFile);
+ compressor.SetTargetFile(outFile.Get());
if (!compressor.Run())
{
n_printf("TQT2 Compressor failed with: %s\n",
compressor.GetError());
Index: src/nct2viewer/nct2viewer.cc
===================================================================
--- src/nct2viewer/nct2viewer.cc (revision 2962)
+++ src/nct2viewer/nct2viewer.cc (working copy)
@@ -57,6 +57,7 @@
nNebulaUsePackage(ngui);
nNebulaUsePackage(nnetwork);
nNebulaUsePackage(ncterrain2);
+nNebulaUsePackage(ndsound);
//------------------------------------------------------------------------------
/*
@@ -103,11 +104,11 @@
nCmdLineArgs args(argc, argv);
#endif
- const char* scriptserverArg = args.GetStringArg("-scriptserver",
"ntclserver");
- const char* sceneserverArg = args.GetStringArg("-sceneserver", 0);
- const char* startupArg = args.GetStringArg("-startup",
"home:bin/startup.tcl");
- const char* viewArg = args.GetStringArg("-view", 0);
- const char* stageArg = args.GetStringArg("-stage",
"home:export/gfxlib/stdlight.n2");
+ nString scriptserverArg = args.GetStringArg("-scriptserver",
"ntclserver");
+ nString sceneserverArg = args.GetStringArg("-sceneserver", 0);
+ nString startupArg = args.GetStringArg("-startup",
"home:data/scripts/startup.tcl");
+ nString viewArg = args.GetStringArg("-view", 0);
+ nString stageArg = args.GetStringArg("-stage",
"home:export/gfxlib/stdlight.n2");
bool fullscreenArg = args.GetBoolArg("-fullscreen");
bool alwaysOnTopArg = args.GetBoolArg("-alwaysontop");
bool helpArg = args.GetBoolArg("-help");
@@ -115,10 +116,10 @@
int yPosArg = args.GetIntArg("-y", 0);
int widthArg = args.GetIntArg("-w", 640);
int heightArg = args.GetIntArg("-h", 480);
- const char* projDir = args.GetStringArg("-projdir", 0);
+ nString projDir = args.GetStringArg("-projdir", 0);
- const char* gfxServerClass = args.GetStringArg("-gfxserver", 0);
- const char* featureSetArg = args.GetStringArg("-featureset", 0);
+ nString gfxServerClass = args.GetStringArg("-gfxserver", 0);
+ nString featureSetArg = args.GetStringArg("-featureset", 0);
// If the user needs an explanation, just provide one, and don't
do anything else this execution
if (helpArg)
@@ -158,10 +159,11 @@
kernelServer.AddPackage(ngui);
kernelServer.AddPackage(nnetwork);
kernelServer.AddPackage(ncterrain2);
+ kernelServer.AddPackage(ndsound);
// initialize a display mode object
nString title;
- if (viewArg)
+ if (viewArg.IsValid())
{
title.Append(viewArg);
title.Append(" - ");
@@ -172,15 +174,15 @@
displayMode.SetDialogBoxMode(true);
if (fullscreenArg)
{
- displayMode.Set(title.Get(), nDisplayMode2::Fullscreen,
xPosArg, yPosArg, widthArg, heightArg, false);
+ displayMode.Set(title.Get(), nDisplayMode2::Fullscreen,
xPosArg, yPosArg, widthArg, heightArg, false, false, 0);
}
else if (alwaysOnTopArg)
{
- displayMode.Set(title.Get(), nDisplayMode2::AlwaysOnTop,
xPosArg, yPosArg, widthArg, heightArg, false);
+ displayMode.Set(title.Get(), nDisplayMode2::AlwaysOnTop,
xPosArg, yPosArg, widthArg, heightArg, false, false, 0);
}
else
{
- displayMode.Set(title.Get(), nDisplayMode2::Windowed, xPosArg,
yPosArg, widthArg, heightArg, false);
+ displayMode.Set(title.Get(), nDisplayMode2::Windowed, xPosArg,
yPosArg, widthArg, heightArg, false, false, 0);
}
// under Win32 check if we should read the project directory from
the registry
@@ -199,17 +201,17 @@
// initialize a viewer app object
nViewerApp viewerApp;
viewerApp.SetDisplayMode(displayMode);
- if (gfxServerClass) viewerApp.SetGfxServerClass(gfxServerClass);
- if (viewArg) viewerApp.SetSceneFile(viewArg);
- if (projDir) viewerApp.SetProjDir(projDir);
- if (featureSetArg)
+ if (gfxServerClass.IsValid())
viewerApp.SetGfxServerClass(gfxServerClass);
+ if (viewArg.IsValid()) viewerApp.SetSceneFile(viewArg);
+ if (projDir.IsValid()) viewerApp.SetProjDir(projDir);
+ if (featureSetArg.IsValid())
{
- nGfxServer2::FeatureSet featureSet =
nGfxServer2::StringToFeatureSet(featureSetArg);
+ nGfxServer2::FeatureSet featureSet =
nGfxServer2::StringToFeatureSet(featureSetArg.Get());
viewerApp.SetFeatureSetOverride(featureSet);
}
viewerApp.SetScriptServerClass(scriptserverArg);
- if (sceneserverArg)
viewerApp.SetSceneServerClass(sceneserverArg);
+ if (sceneserverArg.IsValid())
viewerApp.SetSceneServerClass(sceneserverArg);
viewerApp.SetStartupScript(startupArg);
viewerApp.SetStageScript(stageArg);
Index: src/ncterrain2/nchunklodmesh_main.cc
===================================================================
--- src/ncterrain2/nchunklodmesh_main.cc (revision 2962)
+++ src/ncterrain2/nchunklodmesh_main.cc (working copy)
@@ -26,7 +26,7 @@
// do NOT create the mesh object inside LoadResource(),
// because NewMesh() may not be multithreading safe
this->refMesh = nGfxServer2::Instance()->NewMesh(0);
- this->refMesh->SetRefillBuffersMode(nMesh2::DisabledOnce);
+// this->refMesh->SetRefillBuffersMode(nMesh2::DisabledOnce);
}
//------------------------------------------------------------------------------
@@ -150,7 +150,7 @@
this->matDiffuse.z = 0.5f + n_rand() * 0.5f;
this->matDiffuse.w = 1.0f;
- this->SetValid(true);
+ this->SetState(nResource::Valid);
return true;
}
@@ -169,5 +169,5 @@
// n_printf("nChunkLodMesh %s: unloading\n");
- this->SetValid(false);
+ this->SetState(nResource::Valid);
}
Index: src/ncterrain2/nchunklodtree_main.cc
===================================================================
--- src/ncterrain2/nchunklodtree_main.cc (revision 2962)
+++ src/ncterrain2/nchunklodtree_main.cc (working copy)
@@ -217,7 +217,7 @@
// update the root bounding box
this->UpdateBoundingBox();
- this->SetValid(true);
+ this->SetState(nResource::Valid);
return true;
}
@@ -259,7 +259,7 @@
this->texQuadTree = 0;
}
- this->SetValid(false);
+ this->SetState(nResource::Valid);
}
//------------------------------------------------------------------------------
Index: src/ncterrain2/nterraingrassnode_main.cc
===================================================================
--- src/ncterrain2/nterraingrassnode_main.cc (revision 2962)
+++ src/ncterrain2/nterraingrassnode_main.cc (working copy)
@@ -86,9 +86,9 @@
}
// render the mesh
- gfxServer->SetMesh(attrs->mesh);
+ gfxServer->SetMesh(attrs->mesh, attrs->mesh);
gfxServer->SetVertexRange(0, attrs->mesh->GetNumVertices());
gfxServer->DrawNS(nGfxServer2::PointList);
- gfxServer->SetMesh(0);
+ gfxServer->SetMesh(0, 0);
return true;
}
是怎么回事啊