⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vectors.h

📁 一个96K的3D游戏源码
💻 H
字号:
/*    Vectors.H
 *
 *  provides Vector-Operations
 *
 * Copyright 2003 by PaP / JTMK
*/

#ifndef Vectors_H
#define Vectors_H

#include <windows.h>

extern HWND MainWindow;

#define		Pi				3.141592653589793238
#define		PiMal2			2*Pi
#define		PiHalb			Pi/2


char *ToString(const char *string, ...);

typedef struct
{
	float X,Y;
} tP2D;

typedef struct
{
	float X,Y,Z;
} tP3D;

typedef struct
{
	float X,Y,Z,A;
} tP4D;


typedef struct  // Orientierungsmatrix , Koordinatensystem
{
	tP3D Up,Left,Forward;
} tOMatrix;

extern long ErrorVar;
extern tOMatrix ErrorMatrix;

int			Random(long Len);
tP3D		CalcRealPosition(tP3D NPos,tOMatrix *NMatrix);
tP3D		CalcRelPosition(tP3D NPos,tOMatrix *NMatrix);
tOMatrix	CalcNewMatrix(tP3D P1,tP3D P2,tOMatrix *Matrix,float Roll);
tOMatrix	KartMatrix();
float		AbstandP(tP3D *CPart,tP3D *FPart);
float		vLength2(tP3D P);
void		vRotate(tP3D *P,float X,float Y,float Z);
tP3D		vCross(tP3D V1,tP3D V2);
tP3D		vSet(float X,float Y,float Z);
float		vMul(tP3D V1,tP3D V2);
void		Norm(tP3D *P);
tP3D		vSub(tP3D P1,tP3D P2);
tP3D		vAdd(tP3D P1,tP3D P2);
tP3D		vMulK(tP3D P1,float t);
tP3D		GetNormalVek(tP3D P1,tP3D P2,tP3D P3);
float		AbstandPG(tP3D *Line1,tP3D *Line2,tP3D *P);
float		Determinante3P(tP3D P1,tP3D P2,tP3D P3);
float		AbstandQuadrat(tP3D CPart,tP3D FPart);
tP3D		vLinMul(tP3D P1,tP3D P2);
tP3D		vLinDiv(tP3D P1,tP3D P2);
tP3D		Rotate(tP3D Temp,tP3D Rot);
float		vAddLen(tP3D Temp);
tP4D		v4Set(float X,float Y,float Z,float A);
tP2D		v2Set(float X,float Y);
tP3D		vAdd2(tP3D *P1,tP3D *P2);
void		vAdd3(tP3D *P1,tP3D *P2);
void		vAdd4(tP3D *P1,tP3D P2);
tP3D		vAdd5(tP3D *P1,tP3D P2);
void		vAdd3v(tP3D *Z,tP3D *P1,tP3D *P2);
tP3D		vMulK2(tP3D *P1,float t);
void		vMulK3(tP3D *P1,float t);

tP3D		vSub2(tP3D *P1,tP3D *P2);
void		vSub3(tP3D *P1,tP3D *P2);
float		vLengthSub(tP3D *P1,tP3D *P2);

void		lRange(long *L,long Min,long Max);
void		fRange(float *F);
//bool		vInRange(tP3D Pos,tP3D Min,tP3D Max);
/*
tP3D		MaxClip(tP3D ToClip,tP3D Border);
tP3D		MinClip(tP3D ToClip,tP3D Border);
*/
void Norm3(tP3D *Z,tP3D P);
void vScale3(tP3D *Z,tP3D P,float F);

bool	Flag(long Src,long Comp);
long	SetFlag(long Src,long Bit);
unsigned char	UnSetFlag(unsigned char Src,unsigned char Bit);
unsigned char	FlipFlag(unsigned char Src,unsigned char Bit);

bool vEqual(tP3D P1,tP3D P2);
tP2D v2Add(tP2D P1,tP2D P2);
bool v2Equal(tP2D P1,tP2D P2);

extern tP3D vNull,v100,v010,v001,v111,v110,v101,v011;
extern tP3D vn00,v0n0,v00n;
extern tOMatrix Kart_Matrix;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -