trackgen: fix SSG: OpenGL will not accept a downsized version
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8387 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 7150081e24ca17399d14f22f5c8b8fa5207ad940 Former-commit-id: 68625a9c6d1a31fb3fca158473f7c53e38c0a851
This commit is contained in:
parent
35e55f88eb
commit
e7a25fd00e
6 changed files with 25 additions and 13 deletions
|
@ -2256,7 +2256,7 @@ GenerateTerrain(tTrack *track, void *TrackHandle, const std::string &outfile, FI
|
|||
FileName = GfParmGetStr(TrackHandle, TRK_SECT_TERRAIN, TRK_ATT_RELIEF, nullptr);
|
||||
if (FileName) {
|
||||
sprintf(buf, "tracks/%s/%s/%s", track->category, track->internalname, FileName);
|
||||
LoadRelief(TrackHandle, buf);
|
||||
LoadRelief(track, TrackHandle, buf);
|
||||
}
|
||||
if (noElevation == -1) {
|
||||
FileName = GfParmGetStr(TrackHandle, TRK_SECT_TERRAIN, TRK_ATT_ELEVATION, nullptr);
|
||||
|
|
|
@ -152,9 +152,9 @@ void SaveElevation(tTrack *track, void *TrackHandle, const std::string &imgFile,
|
|||
}
|
||||
|
||||
ssgSetCurrentOptions(&options);
|
||||
sprintf(buf, "tracks/%s/%s;data/textures;data/img;.", track->category, track->internalname);
|
||||
sprintf(buf, "%stracks/%s/%s;%sdata/textures;%sdata/img;.", GfDataDir(), track->category, track->internalname, GfDataDir(), GfDataDir());
|
||||
ssgTexturePath(buf);
|
||||
sprintf(buf, ".;tracks/%s/%s", track->category, track->internalname);
|
||||
sprintf(buf, ".;%stracks/%s/%s", GfDataDir(), track->category, track->internalname);
|
||||
ssgModelPath(buf);
|
||||
root = (ssgRoot*)ssgLoadAC(meshFile.c_str());
|
||||
|
||||
|
|
|
@ -232,6 +232,10 @@ bool Application::parseOptions()
|
|||
|
||||
int Application::generate()
|
||||
{
|
||||
ssgAddTextureFormat(".png", ssgLoadPNG);
|
||||
ssgAddTextureFormat(".rgb", ssgLoadSGI);
|
||||
ssgAddTextureFormat(".rgba", ssgLoadSGI);
|
||||
|
||||
// Get the trackgen paramaters.
|
||||
void *CfgHandle = GfParmReadFile(CFG_FILE, GFPARM_RMODE_STD | GFPARM_RMODE_CREAT);
|
||||
|
||||
|
|
|
@ -118,10 +118,10 @@ InitObjects(tTrack *track, void *TrackHandle)
|
|||
|
||||
GF_TAILQ_INIT(&objhead);
|
||||
|
||||
sprintf(buf, "tracks/%s/%s;data/objects", track->category, track->internalname);
|
||||
sprintf(buf, "%stracks/%s/%s;%sdata/objects", GfDataDir(), track->category, track->internalname, GfDataDir());
|
||||
search = strdup(buf);
|
||||
|
||||
sprintf(path, "tracks/%s/%s;data/objects;data/textures;.", track->category, track->internalname);
|
||||
sprintf(path, "%stracks/%s/%s;%sdata/objects;%sdata/textures;.", GfDataDir(), track->category, track->internalname, GfDataDir(), GfDataDir());
|
||||
ssgTexturePath(path);
|
||||
ssgModelPath(path);
|
||||
|
||||
|
@ -517,9 +517,9 @@ GenerateObjects(tTrack *track, void *TrackHandle, void *CfgHandle, FILE *save_fd
|
|||
int index;
|
||||
|
||||
ssgSetCurrentOptions(&options);
|
||||
sprintf(buf, "tracks/%s/%s;data/textures;data/img;.", track->category, track->internalname);
|
||||
sprintf(buf, "%stracks/%s/%s;%sdata/textures;%sdata/img;.", GfDataDir(), track->category, track->internalname, GfDataDir(), GfDataDir());
|
||||
ssgTexturePath(buf);
|
||||
sprintf(buf, ".;tracks/%s/%s", track->category, track->internalname);
|
||||
sprintf(buf, ".;%stracks/%s/%s;%sdata/objects", GfDataDir(), track->category, track->internalname, GfDataDir());
|
||||
ssgModelPath(buf);
|
||||
TrackRoot = (ssgRoot*)ssgLoadAC(meshFile.c_str());
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <track.h>
|
||||
#include "trackgen.h"
|
||||
#include "easymesh.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "relief.h"
|
||||
|
||||
|
@ -82,20 +83,27 @@ hookNode(char *s)
|
|||
Load a simple database
|
||||
*/
|
||||
void
|
||||
LoadRelief(void *TrackHandle, const char *reliefFile)
|
||||
LoadRelief(tTrack *track, void *TrackHandle, const char *reliefFile)
|
||||
{
|
||||
GF_TAILQ_INIT(&InteriorList);
|
||||
GF_TAILQ_INIT(&ExteriorList);
|
||||
|
||||
GridStep = GfParmGetNum(TrackHandle, TRK_SECT_TERRAIN, TRK_ATT_BSTEP, nullptr, GridStep);
|
||||
|
||||
ssgLoaderOptions *loaderopt = new ssgLoaderOptions();
|
||||
ssgLoaderOptionsEx options;
|
||||
|
||||
loaderopt->setCreateBranchCallback(hookNode);
|
||||
ssgSetCurrentOptions(&options);
|
||||
|
||||
options.setCreateBranchCallback(hookNode);
|
||||
|
||||
char path[1024];
|
||||
sprintf(path, "tracks/%s/%s;data/objects;data/textures;.", track->category, track->internalname);
|
||||
ssgTexturePath(path);
|
||||
ssgModelPath(path);
|
||||
|
||||
printf("\nLoading relief file %s\n", reliefFile);
|
||||
|
||||
Root = ssgLoadAC(reliefFile, loaderopt);
|
||||
Root = ssgLoadAC(reliefFile);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#ifndef _RELIEF_H_
|
||||
#define _RELIEF_H_
|
||||
|
||||
extern void LoadRelief(void * TrackHandle, const char *reliefFile);
|
||||
extern void LoadRelief(tTrack *track, void * TrackHandle, const char *reliefFile);
|
||||
extern void CountRelief(bool interior, int *nb_vert, int *nb_seg);
|
||||
extern void GenRelief(bool interior);
|
||||
|
||||
|
|
Loading…
Reference in a new issue