Click here to Skip to main content
15,886,199 members
Articles / Desktop Programming / Win32

Half Life Game Level Viewer

Rate me:
Please Sign up or sign in to vote.
4.61/5 (23 votes)
7 Feb 2009CPOL26 min read 79.7K   2.3K   60  
DirectX based application to open and view Half Life 1 game files
//
//	MathHelper.h
//
//	Set of math helper functions
//
//	Copyright 2005 Paul Higinbotham
//

#ifndef __MATHHELPER_H_
#define __MATHHELPER_H_


#include "..\..\math\Vector2.h"
#include "..\..\math\Vector3.h"
#include "..\..\math\Plane.h"


namespace ZGraphics
{

// Typedefs
typedef struct _sectInfo
{
	Planef		fPlane;
	Vector3f	ptIntersect;
	float		fDepth;

	_sectInfo()
	{
		ptIntersect = Vector3f::cZero;
		fPlane.SetPlane(Vector3f::cZero, 0.0f);
		fDepth = 0.0f;
	}
	_sectInfo(const Vector3f & ptIntsect, const Planef & plane)
	{
		fPlane = plane;
		ptIntersect = ptIntsect;
		fDepth = 0.0f;
	}
	_sectInfo(const Vector3f& ptIntsect, float fDpth, const Planef& plane)
	{
		fPlane = plane;
		ptIntersect = ptIntsect;
		fDepth = fDpth;
	}
	_sectInfo(_sectInfo const& sectInfo)
	{
		fPlane = sectInfo.fPlane;
		ptIntersect = sectInfo.ptIntersect;
		fDepth = sectInfo.fDepth;
	}
} SectInfo;


// Helper functions
bool RayEdgeIntersect(const Vector2f vRay[2], const Vector2f ptEdge[2]);
bool EdgeEdgeIntersect(const Vector2f ptEdge1[2], const Vector2f ptEdge2[2]);


} // namespace ZGraphics


#endif /* __MATHHELPER_H_ */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
I am a senior software developer currently doing contract work for Microsoft. My educational background is in electrical engineering and I hold a masters degree from the University of Washington. I have experience in hardware and systems design but have done primarily software development for the last two decades. I have worked for various small companies as well as start-up companies, and have worked as a full time employee SDE at Microsoft Corporation.

Comments and Discussions