struct Vertex {
double x;
double y;
double z;
};
struct Face {
vectorv;
unsigned int tex_id;
};
struct Shape {
vectorf;
vectortv; //currently irrelevant
};
Shape shape;
void Func1()
{
vectortemp;
temp.push_back(-1.0);
temp.push_back(-1.0);
temp.push_back(1.0);
temp.push_back(1.0);
temp.push_back(-1.0);
temp.push_back(1.0);
temp.push_back(1.0);
temp.push_back(1.0);
temp.push_back(1.0);
temp.push_back(-1.0);
temp.push_back(1.0);
temp.push_back(1.0);
temp.push_back(0);
AddFace(temp);
}
int AddFace(vectorv)
{
//here''s the problem: i need to give values to the members of
//the vector<Vertex> items in
//vector<Face>: how do i do that?
//i need to take the values from v three at a time and
//progressively assign them to shape.f[x].v[y].x, shape.f[x].v
//[y].y and shape.f[x].v[y].z (and finally assign the last value
//to shape.f[x].tex_id)
//vector seems only to provide push_back to
//add values at the end, but i don''s see how i could use it here.
}
hope this isn''t too fuzzy...
and, talking about vectors - this place strongly suggests using deque rather than vector. is there any truth in that?
thanks,
crispy
vectors
sorry if this is a bit off-topic...
i have the following piece of code:
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
grr - i just now noticed most the < and > signs have been removed from the code example i gave ;( - forgot to use the HTML markings.
what i need to know here is: if i have a vector of Face-es (which is a struct) that has an empty vector of Vertex-es (also a struct), then how can i add a new member to the vector of Vertex-es in a member of the vector of Face-es that does not yet exist?
e g:
if
a value?
crispy
[edited by - Crispy on April 11, 2002 3:16:13 PM]
what i need to know here is: if i have a vector of Face-es (which is a struct) that has an empty vector of Vertex-es (also a struct), then how can i add a new member to the vector of Vertex-es in a member of the vector of Face-es that does not yet exist?
e g:
if
vector<Face>f;
has any given n
number of entries, then how do i give shape.f[n + 1].v[n + 1].x
a value?
crispy
[edited by - Crispy on April 11, 2002 3:16:13 PM]
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement