How can I ensure my Collada model fits on an iPhone screen?
Posted
by
rakeshNS
on Game Development
See other posts from Game Development
or by rakeshNS
Published on 2012-12-22T17:32:24Z
Indexed on
2014/06/06
21:56 UTC
Read the original article
Hit count: 254
Hi I am new to game development. I see many examples and tried myself like displaying triangle, cube etc. Now I am looking to render a Collada object. So I created a Collada object using Google Sketch up and trying to render that now. But the thing I am not understanding is, in all examples the vertices are between -1.0 and +1.0 values. But when I looked into that Collada file, the vertices were ranging from -30.0 to 90.0. I know any vertices greater than 1.0 will not display on iPhone. So can you pleas tell my the secret behind converting Object coordinate to normalized vector coordinate?
My previous triangle defined as
struct Vertex{
float Position[3];
float Color[4];
};
const Vertex Vertices[] = {
{{-0.5, -0.866}, {1, 1, 0.5f, 1}},
{{0.5, -0.866}, {1, 1, 0.5, 1}},
{{0, 1}, {1, 1, 0.5, 1}},
{{-0.5, -0.866}, {0.5f, 0.5f, 0.5f}},
{{0.5, -0.866}, {0.5f, 0.5f, 0.5f}},
{{0, -0.4f}, {0.5f, 0.5f, 0.5f}},
};
And now triangle from collada is
const Vertex Vertices[] = {
{{39.4202092, 90.1263924, 0.0000000}, {1, 1, 0.5f, 1}},
{{-20.2205588, 90.1263924, 0.0000000}, {1, 1, 0.5, 1}},
{{-20.2205588, 176.3763924, 0.0000000}, {1, 1, 0.5, 1}},
{{-20.2205588, 176.3763924, 0.0000000}, {1, 1, 0.5, 1}},
{{-20.2205588, 90.1263924, 0.0000000}, {1, 1, 0.5, 1}},
{{39.4202092, 90.1263924, 0.0000000}, {1, 1, 0.5, 1}},
};
© Game Development or respective owner