0

Hello,
I'm currently trying to figure out how I can get the information in ASE file and put it in my own arrays.
Heres an example of ASCII scene export:

*3DSMAX_ASCIIEXPORT	200
*COMMENT "AsciiExport Version  2,00 - Fri Aug 26 13:58:27 2011"
*SCENE {
	*SCENE_FILENAME ""
	*SCENE_FIRSTFRAME 0
	*SCENE_LASTFRAME 100
	*SCENE_FRAMESPEED 30
	*SCENE_TICKSPERFRAME 160
	*SCENE_BACKGROUND_STATIC 0.0000	0.0000	0.0000
	*SCENE_AMBIENT_STATIC 0.0000	0.0000	0.0000
}
*GEOMOBJECT {
	*NODE_NAME "Box01"
	*NODE_TM {
		*NODE_NAME "Box01"
		*INHERIT_POS 0 0 0
		*INHERIT_ROT 0 0 0
		*INHERIT_SCL 0 0 0
		*TM_ROW0 1.0000	0.0000	0.0000
		*TM_ROW1 0.0000	1.0000	0.0000
		*TM_ROW2 0.0000	0.0000	1.0000
		*TM_ROW3 1.6543	1.0676	0.0000
		*TM_POS 1.6543	1.0676	0.0000
		*TM_ROTAXIS 0.0000	0.0000	0.0000
		*TM_ROTANGLE 0.0000
		*TM_SCALE 1.0000	1.0000	1.0000
		*TM_SCALEAXIS 0.0000	0.0000	0.0000
		*TM_SCALEAXISANG 0.0000
	}
	*MESH {
		*TIMEVALUE 0
		*MESH_NUMVERTEX 8
		*MESH_NUMFACES 12
		*MESH_VERTEX_LIST {
			*MESH_VERTEX    0	-6.6457	-6.1364	0.0000
			*MESH_VERTEX    1	9.9542	-6.1364	0.0000
			*MESH_VERTEX    2	-6.6457	8.2717	0.0000
			*MESH_VERTEX    3	9.9542	8.2717	0.0000
			*MESH_VERTEX    4	-6.6457	-6.1364	19.1817
			*MESH_VERTEX    5	9.9542	-6.1364	19.1817
			*MESH_VERTEX    6	-6.6457	8.2717	19.1817
			*MESH_VERTEX    7	9.9542	8.2717	19.1817
		}
		*MESH_FACE_LIST {
			*MESH_FACE    0:    A:    0 B:    2 C:    3 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 2 	*MESH_MTLID 1
			*MESH_FACE    1:    A:    3 B:    1 C:    0 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 2 	*MESH_MTLID 1
			*MESH_FACE    2:    A:    4 B:    5 C:    7 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 3 	*MESH_MTLID 0
			*MESH_FACE    3:    A:    7 B:    6 C:    4 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 3 	*MESH_MTLID 0
			*MESH_FACE    4:    A:    0 B:    1 C:    5 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 4 	*MESH_MTLID 4
			*MESH_FACE    5:    A:    5 B:    4 C:    0 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 4 	*MESH_MTLID 4
			*MESH_FACE    6:    A:    1 B:    3 C:    7 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 5 	*MESH_MTLID 3
			*MESH_FACE    7:    A:    7 B:    5 C:    1 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 5 	*MESH_MTLID 3
			*MESH_FACE    8:    A:    3 B:    2 C:    6 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 6 	*MESH_MTLID 5
			*MESH_FACE    9:    A:    6 B:    7 C:    3 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 6 	*MESH_MTLID 5
			*MESH_FACE   10:    A:    2 B:    0 C:    4 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 7 	*MESH_MTLID 2
			*MESH_FACE   11:    A:    4 B:    6 C:    2 AB:    1 BC:    1 CA:    0	 *MESH_SMOOTHING 7 	*MESH_MTLID 2
		}
		*MESH_NUMTVERTEX 12
		*MESH_TVERTLIST {
			*MESH_TVERT 0	0.0000	0.0000	0.0000
			*MESH_TVERT 1	1.0000	0.0000	0.0000
			*MESH_TVERT 2	0.0000	1.0000	0.0000
			*MESH_TVERT 3	1.0000	1.0000	0.0000
			*MESH_TVERT 4	0.0000	0.0000	0.0000
			*MESH_TVERT 5	1.0000	0.0000	0.0000
			*MESH_TVERT 6	0.0000	1.0000	0.0000
			*MESH_TVERT 7	1.0000	1.0000	0.0000
			*MESH_TVERT 8	0.0000	0.0000	0.0000
			*MESH_TVERT 9	1.0000	0.0000	0.0000
			*MESH_TVERT 10	0.0000	1.0000	0.0000
			*MESH_TVERT 11	1.0000	1.0000	0.0000
		}
		*MESH_NUMTVFACES 12
		*MESH_TFACELIST {
			*MESH_TFACE 0	9	11	10
			*MESH_TFACE 1	10	8	9
			*MESH_TFACE 2	8	9	11
			*MESH_TFACE 3	11	10	8
			*MESH_TFACE 4	4	5	7
			*MESH_TFACE 5	7	6	4
			*MESH_TFACE 6	0	1	3
			*MESH_TFACE 7	3	2	0
			*MESH_TFACE 8	4	5	7
			*MESH_TFACE 9	7	6	4
			*MESH_TFACE 10	0	1	3
			*MESH_TFACE 11	3	2	0
		}
	}
	*PROP_MOTIONBLUR 0
	*PROP_CASTSHADOW 1
	*PROP_RECVSHADOW 1
}

And I want to fill:

long verteces_number;
Vertex *verteces = new Vertex[verteces_number];
struct Vertex
{
int x,y,z;
};

I can't work good with Strings and file streams(yeah sounds strange but I\m self learning student) and maybe thats why I can't do it.
I hope someone can help me.
Thanks.

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by dionisov
0

The method you use to parse this file sincerely depends on how you will use it after it is parsed.

You could just read it into a string array or you could parse it into structs or objects.

What version of C++ are you using and what do you need to do with the data after you read it from the file?

0

I'm using Visual C++ 2008.
I've studied C++ alone thats why I'm missing some things.
I want to take the values in the text file and then put it in my Vertex struct so I can then create my vertex buffer. After this is done I think I'll be able to do my index buffer alone.

0

OK. I see, though, you have a very large ASE file, but a small struct to store it.
Do you only want part of the data in the struct or all of it?

The struct contains 3 integers, but very little in the ASE file will fit that format.

What are the values from the .ASE you want to keep?

0

Ok, I'm not so good with english so for better understanding I'll sort it:
1. I want to get the number of vertices and put the value in

long verteces_number;

2. I want to move through all vertices and get their X, Y and Z coordinates. Then I want to put these coords in my array of type Vertex.

class Vertex
{
public:
long x,y,z;

//normals, colors, etc. But I'll be able to fill them after I got how to do it with coords :S
};
*MESH_NUMVERTEX 8
#
*MESH_NUMFACES 12
#
*MESH_VERTEX_LIST {
#
*MESH_VERTEX 0 -6.6457 -6.1364 0.0000
#
*MESH_VERTEX 1 9.9542 -6.1364 0.0000
#
*MESH_VERTEX 2 -6.6457 8.2717 0.0000
#
*MESH_VERTEX 3 9.9542 8.2717 0.0000
#
*MESH_VERTEX 4 -6.6457 -6.1364 19.1817
#
*MESH_VERTEX 5 9.9542 -6.1364 19.1817
#
*MESH_VERTEX 6 -6.6457 8.2717 19.1817
#
*MESH_VERTEX 7 9.9542 8.2717 19.1817
#
}

After I see how to do this (and something else if this will make my life easier) I'll be able to get everything else I need alone.

Thanks for still reading my brocker english :?

Edited by dionisov: n/a

0

I found how to do it.
If some1 else have the same problem, go & check how to read a text file line by line and stringstream reference.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.