Re #691: integrated splitObjects() call to loadAndGroup() (Boris)

o general workflow now works as requested, i.e. in loadAndGroup()
textures are collapsed and then splitting is performed

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4850 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 7b0b23bbc742b6a8eee64646f3a82ab8d9a6b605
Former-commit-id: 1e5f707fabac09d201821d30490b11a7947e9b4d
This commit is contained in:
kmetykog 2012-08-13 11:46:48 +00:00
parent 7e526c8b96
commit a5a60c45f7
4 changed files with 28 additions and 3 deletions

View file

@ -56,6 +56,11 @@ void loadAndGroup(char *OutputFileName)
double dist = 0;
int notinsameorder = FALSE;
/* disable object splitting during load. We split them
* after merging the texture channels.
*/
splitObjectsDuringLoad = 0;
if (fileL0)
{
fprintf(stderr, "\nloading file %s\n", fileL0);
@ -93,6 +98,8 @@ void loadAndGroup(char *OutputFileName)
collapseTextures(ob0, ob1, ob2, ob3);
splitObjects(&ob0);
/* now make groups from ob0 */
fprintf(stderr, "making groups\n");

View file

@ -1160,7 +1160,7 @@ bool isTerrainSplit(ob_t* object)
/** Go through all given objects, check whether a normal split or a terrain
* split is necessary and execute the split.
*/
void performSplitsOnAllObjs(ob_t** object)
void splitObjects(ob_t** object)
{
if (NULL == object)
return;
@ -1264,7 +1264,8 @@ int loadAC(char * inputFilename, char * outputFilename, int saveIn)
fclose(file);
root_ob = current_ob;
performSplitsOnAllObjs(&root_ob);
if(splitObjectsDuringLoad != 0)
splitObjects(&root_ob);
if (saveIn == -1)
return (0);
@ -1355,7 +1356,8 @@ int loadACo(char * inputFilename, char * outputFilename, int saveIn)
fclose(file);
root_ob = current_ob;
performSplitsOnAllObjs(&root_ob);
if(splitObjectsDuringLoad != 0)
splitObjects(&root_ob);
printf("\nobjects loaded\nresaving in AC3D\n");
if (saveIn == 0)

View file

@ -46,6 +46,7 @@ extern int isobjectacar;
extern int normalMapping;
extern char *OrderString;
extern int collapseObject;
extern void loadAndGroup(char *OutputFileName);
extern int loadAC(char * inputFilename, char * outputFilename, int saveIn);
@ -159,9 +160,23 @@ typedef struct mat
extern int typeConvertion;
extern ob_t * root_ob;
extern int terrainSplitOb(ob_t **object);
extern int mergeSplitted(ob_t **object);
extern int distSplit;
/** Whether to split objects during loading, i.e. calls to loadAC() and loadACo().
* The default behavior is to split them during loading
* (splitObjectsDuringLoad != 0). However, in loadAndGroup()
* we want to manually trigger the object splitting, i.e. just after setting up the
* texture channels. In that case the object splitting has to be skipped in loading
* (splitObjectsDuringLoad == 0).
*/
extern int splitObjectsDuringLoad;
/** Go through all given objects, check whether a normal split or a terrain
* split is necessary and execute the split.
*/
void splitObjects(ob_t** object);
extern int freeobject(ob_t *o);
double findDistmin(ob_t * ob1, ob_t *ob2);

View file

@ -52,6 +52,7 @@ int isobjectacar = 0;
int extendedTriangles = 0;
int notexturesplit = 0;
int collapseObject = 0;
int splitObjectsDuringLoad = 1;
int typeConvertion = 0;
int far_dist = 10000;
int normalMapping = 0;