Jump to content
  • Advertisement
Sign in to follow this  
ShadowDog

Rendering a Hammer .map with XNA

This topic is 2555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to render a .map file generated by the latest version of GoldSrc Hammer, but it only stores information for one triangle per face. I'm having a hard time getting it to draw the [s]"inverse"[/s] complementary triangle so that it's drawing the full face. I'll elaborate some more on this tomarrow, but I'm extremely tired right now. This is the .map I'm trying to render (without textures for the moment). This is the function that puts the parsed geometry in an array for display. This is where you can find misc files. Thanks in advance.

Edit: Here's the main part of the function that I need help with:
foreach (BrushDef b2 in b.brushes)
{
int lolol = 0;
foreach (BrushSideDef b3 in b2.brush)
{
if (lolol == 0)
{
vertices[temp + 0].Position = xyz(b3.p1_2, b3.p1_1, b3.p1_3);
vertices[temp + 0].Color = Color.Green;
vertices[temp + 1].Position = xyz(b3.p2_2, b3.p2_1, b3.p2_3);
vertices[temp + 1].Color = Color.Green;
vertices[temp + 2].Position = xyz(b3.p3_2, b3.p3_1, b3.p3_3);
vertices[temp + 2].Color = Color.Green;
vertices[temp + 3].Position = xyz(b3.p1_1, b3.p3_1, b3.p3_3);
vertices[temp + 3].Color = Color.Green;
vertices[temp + 4].Position = xyz(b3.p1_1, b3.p3_2, b3.p2_3);
vertices[temp + 4].Color = Color.Green;
vertices[temp + 5].Position = xyz(b3.p1_2, b3.p1_1, b3.p1_3);
vertices[temp + 5].Color = Color.Green;
temp += 3;
}
else if (lolol == 1)
{
vertices[temp + 0].Position = xyz(b3.p1_2, b3.p1_1, b3.p1_3);
vertices[temp + 0].Color = Color.Pink;
vertices[temp + 1].Position = xyz(b3.p2_2, b3.p2_1, b3.p2_3);
vertices[temp + 1].Color = Color.Pink;
vertices[temp + 2].Position = xyz(b3.p3_2, b3.p3_1, b3.p3_3);
vertices[temp + 2].Color = Color.Pink;
vertices[temp + 3].Position = xyz(b3.p3_2, b3.p3_1, b3.p3_3);
vertices[temp + 3].Color = Color.Pink;
vertices[temp + 4].Position = xyz(b3.p2_1, b3.p2_2, b3.p2_3);
vertices[temp + 4].Color = Color.Pink;
vertices[temp + 5].Position = xyz(b3.p1_2, b3.p1_1, b3.p1_3);
vertices[temp + 5].Color = Color.Pink;
temp += 3;
}
else
{
vertices[temp + 0].Position = xyz(b3.p1_2, b3.p1_1, b3.p1_3);
vertices[temp + 0].Color = Color.Red;
vertices[temp + 1].Position = xyz(b3.p2_2, b3.p2_1, b3.p2_3);
vertices[temp + 1].Color = Color.Yellow;
vertices[temp + 2].Position = xyz(b3.p3_2, b3.p3_1, b3.p3_3);
vertices[temp + 2].Color = Color.Green;
vertices[temp + 3].Position = xyz(b3.p1_2, b3.p1_1, b3.p3_3);
vertices[temp + 3].Color = Color.Red;
vertices[temp + 4].Position = xyz(b3.p2_2, b3.p2_1, b3.p2_3);
vertices[temp + 4].Color = Color.Yellow;
vertices[temp + 5].Position = xyz(b3.p3_2, b3.p3_1, b3.p1_3);
vertices[temp + 5].Color = Color.Green;
temp += 3;
}
lolol += 1;
temp += 3;
}
}

Right now, the top and bottom (which make lolol = 0 and 1, respectively) render correctly, but the rest of the faces don't. Edited by ShadowDog

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!