Sign in to follow this  
ShadowDog

Rendering a Hammer .map with XNA

Recommended Posts

ShadowDog    100
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. [url="http://luftballon.cnc-comm.com/OtherSites/XNA/DotMap/test.map"]This is the .map I'm trying to render (without textures for the moment).[/url] [url="http://luftballon.cnc-comm.com/OtherSites/XNA/DotMap/CustomMapLoader.cs.txt"]This is the function that puts the parsed geometry in an array for display.[/url] [url="http://luftballon.cnc-comm.com/OtherSites/XNA/DotMap/"]This is where you can find misc files.[/url] Thanks in advance.

Edit: Here's the main part of the function that I need help with:
[code]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;
}
}
[/code]
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this