#### Archived

This topic is now archived and is closed to further replies.

# Frustum creation again

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

## Recommended Posts

quite frankly i wasnt sure aobut the other algorithms and i dont use things i cant comprehend.. so i came up with this piece of code:

// This is the best lineup for culling, not the logical lineup(so im not completely crazy just yet

#define FU_FAR 0

#define FU_UP 1

#define FU_LEFT 2

#define FU_RIGHT 3

#define FU_DOWN 4

#define FU_NEAR 5

plane::cPlane(point3 Normal, point3 PointOnPlane);

typedef class cFustrum
{
plane sides[6];

void Create(point3 pos, point3 dir, float hzfov, float zNear, float zFar, float aspect) //dir has to be normalized,fov is horizontal fov, aspect is horiz/vert

{
float vefov=hzfov/aspect;
float hfpi=PI/2; //90 degrees - useful for gettign normal straight away

point3 convert=cPoint3(0,0,1)-dir;

sides[FU_LEFT]=cPlane(cPoint3(sin(-(hzfov-hfpi)), 0, cos(-(hzfov-hfpi)))-convert,pos);
sides[FU_RIGHT]=cPlane(cPoint3(-sin(-(hzfov-hfpi)), 0, cos(-(hzfov-hfpi)))-convert,pos);
sides[FU_UP]=cPlane(cPoint3(0, sin(-(hzfov-hfpi)), cos(-(hzfov-hfpi)))-convert,pos);
sides[FU_DOWN]=cPlane(cPoint3(0, -sin(-(hzfov-hfpi)), cos(-(hzfov-hfpi)))-convert,pos);

sides[FU_FAR]=cPlane(dir,zFar);
sides[FU_NEAR]=cPlane(dir,zNear);

return;
}

} Frustum;

one question - Will it work? [edited by - Velochy on July 23, 2002 8:09:12 AM] [edited by - Velochy on July 24, 2002 10:28:51 AM]

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5
khawk
11

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633677
• Total Posts
3013281
×