   pass by refrence on DWORD and D3DXVECTOR types?
  So I've created structure with D3DXVECTOR3 array float values for Position, Normal, and Texture coordinates.  Also a DWORD array for the indices or faces.I am currently writing the Loader part of my program and i had it working by manually entering values for those arrays.  Now i need to make a call to a function to load the model data into my array's and assume that pass by refrence is the best as I'm changing their values constantly for each model and don't want to copy the data etc.Main question can i pass by refrence for 2 array values, one being DWORD type and the other are all float values in a custom structure of the D3DXVECTOR3 type.Here is some sample snippits.Header for the structure type definition:#ifndef VERTEXFORMATS_H#define VERTEXFORMATS_H// Triangle Varsstruct VertexPosNormalTexStruct{    D3DXVECTOR3 Vertice;D3DXVECTOR3 Normal;D3DXVECTOR3 Texture;};#endiflast part of the function to create modelobject:   // create the vertices array large enough to hold all those neededVertexPosNormalTexStruct vertices[256];// Create the indices arrayDWORD indices[110];// Fill the vertices array with the terrain valuesimportModelData(//need pass by values here// );// Calculate the number of vertices in the arrayUINT numVertices = sizeof(vertices) / sizeof(VertexPosNormalTexStruct);// determine the number of indicesUINT numIndices = sizeof(indices) / sizeof(DWORD);// create the mesh objectD3DX10CreateMesh(pD3DDevice, layout, numElements, "POSITION", numVertices, (numIndices/3), D3DX10_MESH_32_BIT, &mesh);// set the vertex buffer datamesh->SetVertexData(0, vertices);// set the index buffer datamesh->SetIndexData(indices, numIndices);// save the changes to the mesh objectmesh->CommitToDevice();return true;Very rough draft of the Loader function:void importModelData(){using namespace std;FILE *pFile;char *mode = "r";char objFile[] = "C:\\Users\\Smigss\\Documents\\Visual Studio 2008\\Projects\\OBJLoader\\OBJLoader\\Box.obj";pFile = fopen(objFile, mode);ifstream fs( pFile );int numVertx = 0;int numNormal = 0;int numTexture = 0;unsigned lineAt = 0;while ( fs ){++lineAt;string line;getline(fs, line);  //get line of textstringstream ss;ss << line;  //tokenize the linestring type;ss >> type;  //firt token identifies type of dataif ( type == "v" ) //vertex coordinates, next 3 values should be floats{ss >> vertices[numVertex].Vertice.x >> vertices[numVertex].Vertice.y >> Vertices[numVertex].vertice.z;++numVertex}else if ( type == "vn" ){ss >> vertices[numNormal].Normal.x >> vertices[numNormal].Normal.y >> vertices[numNormal].Normal.z;++numNormal;}if (type == "f" ){ss >> indices[numIndice] >> indices[numIndice + 1] >> indices[numIndice + 2];numIndice += 3;}}}
  You can't not pass an array by reference in C++:importModelData(vertices);void importModelData(VertexPosNormalTexStruct* vertices){   vertices[0].Vertice.x = 1.2345f;   // etc}That should do what you want.   ;  Thx i did the exact same thing really late last night lol =pSo if it's not passing by refrence then it's using an address i take it since i'm using a pointer?Here was the updated individual parts of just that function that i used://deceleration in header filebool importModelData(struct VertexPosNormalTexStruct *pVertices);//call to fileimportModelData(vertices);//function definitionbool importModelData(VertexPosNormalTexStruct *pVertices){//return false if unable to open file or get vertex data from line}I'm guessing doing this is pointing me in the right direction, i'll just have to make sure the index array is filled and it's all bound to the mesh object?   ;Quote:Original post by SmigssThx i did the exact same thing really late last night lol =pSo if it's not passing by refrence then it's using an address i take it since i'm using a pointer?Yes, they're essentially the same thing (The generated assembly should be exactly the same)Quote:Original post by SmigssI'm guessing doing this is pointing me in the right direction, i'll just have to make sure the index array is filled and it's all bound to the mesh object?Correct - although you can just pass the indices array as a parameter too.   ;  Thx a ton i've got it close to working, problem is that using stream operator >> for the "f" type in my importModelData function is not getting the correct data.Basically i need to omitt or account for the "/" in faces, as it stands it just grabs the first integer and then moves onto the next line.You can view my other post here:http://www.gamedev.net/community/forums/topic.asp?topic_id=570532   