📄 genesis.h
字号:
/****************************************************************************************/
/* Genesis.h */
/* */
/* Description: The master header for Genesis */
/* */
/* The contents of this file are subject to the Genesis3D Public License */
/* Version 1.01 (the "License"); you may not use this file except in */
/* compliance with the License. You may obtain a copy of the License at */
/* http://www.genesis3d.com */
/* */
/* Software distributed under the License is distributed on an "AS IS" */
/* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */
/* the License for the specific language governing rights and limitations */
/* under the License. */
/* */
/* The Original Code is Genesis3D, released March 25, 1999. */
/* Genesis3D Version 1.1 released November 15, 1999 */
/* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */
/* */
/****************************************************************************************/
#ifndef GENESIS_H
#define GENESIS_H
#include "BaseType.h"
#include "Vec3d.h"
#include "XForm3d.h"
#include "GETypes.h"
#include "ExtBox.h"
#include "vfile.h"
#include "Bitmap.h"
#ifdef __cplusplus
extern "C" {
#endif
//================================================================================
// Constants / Defines / TypDefs
//================================================================================
typedef struct geEngine geEngine;
typedef struct geDriver_System geDriver_System;
typedef struct geDriver geDriver;
typedef struct geDriver_Mode geDriver_Mode;
typedef struct geSound_System geSound_System;
typedef struct geSound_Cfg geSound_Cfg;
typedef struct geSound_Def geSound_Def;
typedef struct geSound geSound;
typedef struct geActor geActor;
typedef struct geActor_Def geActor_Def; // the definition of an actor's geometry/bone structure
typedef struct geWorld geWorld;
typedef struct geWorld_Model geWorld_Model;
typedef struct geEntity geEntity;
typedef struct geEntity_EntitySet geEntity_EntitySet;
typedef struct geCamera geCamera;
typedef struct geCSNetMgr geCSNetMgr;
typedef struct gePoly gePoly;
typedef struct geLight geLight;
typedef struct geFog geFog;
typedef struct geMesh_Def geMesh_Def; // Mesh def
typedef struct geMesh geMesh;
#define GE_VERSION_MAJOR (1UL)
#define GE_VERSION_MINOR (3UL)
#define GE_VERSION_MINOR_MIN (3UL)
#define GE_VERSION_MAJOR_SHIFT (16)
#define GE_VERSION_MAJOR_MASK ((uint32)0xFFFF0000)
#define GE_VERSION ( (GE_VERSION_MAJOR << GE_VERSION_MAJOR_SHIFT) + GE_VERSION_MINOR )
// From here down, still needs to be fixed up for July4
typedef struct GE_ModelMotion GE_ModelMotion;
typedef float GE_TimeType;
// Polys
typedef enum
{
GE_TEXTURED_POLY,
GE_GOURAUD_POLY,
GE_TEXTURED_POINT
} gePoly_Type;
// Poly Fx flags
#define GE_RENDER_DO_NOT_OCCLUDE_OTHERS (1<<0) // Poly will not occlude others
#define GE_RENDER_DO_NOT_OCCLUDE_SELF (1<<1) // Renders under any condition. Useful for halos, etc...
#define GE_RENDER_BACKFACED (1<<2) // Poly should be backfaced from the Camera's Pov
#define GE_RENDER_DEPTH_SORT_BF (1<<3) // Sorts relative to camera position, from back to front
#define GE_RENDER_CLAMP_UV (1<<4) // Clamp UV's in both directions
// World Add flags
#define GE_WORLD_RENDER (1<<0)
#define GE_WORLD_COLLIDE (1<<1)
#ifndef GE_CONTENTS_TYPES
#define GE_CONTENTS_TYPES
//
// Content types in GE_Contents structure (multiple contents can be mixed...)
//
//*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
// IF THESE FLAGS CHANGE, THEY MUST CHANGE IN GBSPFILE.H in Genesis AND GBSPLIB, and Genesis.H!!!!!
//*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
#define GE_CONTENTS_SOLID (1<<0) // Solid (Visible)
#define GE_CONTENTS_WINDOW (1<<1) // Window (Visible)
#define GE_CONTENTS_EMPTY (1<<2) // Empty but Visible (water, lava, etc...)
#define GE_CONTENTS_TRANSLUCENT (1<<3) // Vis will see through it
#define GE_CONTENTS_WAVY (1<<4) // Wavy (Visible)
#define GE_CONTENTS_DETAIL (1<<5) // Won't be included in vis oclusion
#define GE_CONTENTS_CLIP (1<<6) // Structural but not visible
#define GE_CONTENTS_HINT (1<<7) // Primary splitter (Non-Visible)
#define GE_CONTENTS_AREA (1<<8) // Area seperator leaf (Non-Visible)
#define GE_CONTENTS_FLOCKING (1<<9)
#define GE_CONTENTS_SHEET (1<<10)
#define GE_CONTENTS_AIR (1<<11) // No brush lives in this leaf
#define GE_RESERVED4 (1<<12)
#define GE_RESERVED5 (1<<13)
#define GE_RESERVED6 (1<<14)
#define GE_RESERVED7 (1<<15)
// 16-31 reserved for user contents
#define GE_CONTENTS_USER1 (1<<16)
#define GE_CONTENTS_USER2 (1<<17)
#define GE_CONTENTS_USER3 (1<<18)
#define GE_CONTENTS_USER4 (1<<19)
#define GE_CONTENTS_USER5 (1<<20)
#define GE_CONTENTS_USER6 (1<<21)
#define GE_CONTENTS_USER7 (1<<22)
#define GE_CONTENTS_USER8 (1<<23)
#define GE_CONTENTS_USER9 (1<<24)
#define GE_CONTENTS_USER10 (1<<25)
#define GE_CONTENTS_USER11 (1<<26)
#define GE_CONTENTS_USER12 (1<<27)
#define GE_CONTENTS_USER13 (1<<28)
#define GE_CONTENTS_USER14 (1<<29)
#define GE_CONTENTS_USER15 (1<<30)
#define GE_CONTENTS_USER16 (1<<31)
// 16-31 reserved for user contents
// These contents are all solid types
#define GE_CONTENTS_SOLID_CLIP (GE_CONTENTS_SOLID | GE_CONTENTS_WINDOW | GE_CONTENTS_CLIP)
#define GE_CONTENTS_CANNOT_OCCUPY GE_CONTENTS_SOLID_CLIP
// These contents are all visible types
#define GE_VISIBLE_CONTENTS ( GE_CONTENTS_SOLID | \
GE_CONTENTS_EMPTY | \
GE_CONTENTS_WINDOW | \
GE_CONTENTS_WAVY)
#endif
//*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
// NOTES - Fills in first Model/Mesh hit
// Exceptions:
// Returns the last solid model hit...
typedef struct
{
geMesh *Mesh;
geWorld_Model *Model;
geActor *Actor;
int32 Contents;
} GE_Contents;
typedef geBoolean GE_CollisionCB(geWorld_Model *Model, geActor *Actor, void *Context);
// Collision
typedef struct
{
geVec3d Normal; // Orientation of plane
float Dist; // Distance from origin
} GE_Plane;
typedef struct
{
geWorld_Model *Model; // Pointer to what model was hit (if any)
geMesh *Mesh; // Pointer to what mesh was hit (if any)
geActor *Actor; // Pointer to what actor was hit (if any)
geVec3d Impact; // Impact Point
float Ratio; // Percent from 0 to 1.0, how far along the line for the impact point
GE_Plane Plane; // Impact Plane
} GE_Collision;
// If these render states change, they must change in DCommon.h too!!!
// These are still under construction, and are for debug purposes only.
// They are merely means of overriding ways the engine normally renders primitives, etc...
//
// RenderState States
//
#define GE_RENDERSTATE_ZWRITE 0 // Z Writes
#define GE_RENDERSTATE_ZCMP 1 // Z Compares
#define GE_RENDERSTATE_BILINEAR 2 // Bilinear filtering
#define GE_RENDERSTATE_ANTI_ALIAS 3 // Anti-Aliasing
#define GE_RENDERSTATE_POLYMODE 4 // Normal, Gouraud only, Lines only, etc
//
// RenderState Flags
//
#define GE_RENDERFLAG_OFF 0
#define GE_RENDERFLAG_ON 1
//
// PolyMode flags (A method to override how polys are drawn for debugging purposes...)
//
#define GE_POLYMODE_NORMAL 1 // Draw as is
#define GE_POLYMODE_GOURAUD 2 // Gouraud only
#define GE_POLYMODE_LINES 3 // Outlines only
//================================================================================
// Engine Management functions
//================================================================================
#ifdef _INC_WINDOWS
// Windows.h must be included before genesis.h for this api to be exposed.
GENESISAPI geEngine *geEngine_CreateWithVersion(HWND hWnd, const char *AppName, const char *DriverDirectory, uint32 Version);
// use geEngine_Create, rather than calling this directly.
#define geEngine_Create( hWnd, AppName, DriverDirectory) geEngine_CreateWithVersion(hWnd,AppName,DriverDirectory,GE_VERSION)
#endif
GENESISAPI void geEngine_Free(geEngine *Engine);
GENESISAPI geBoolean geEngine_AddWorld(geEngine *Engine, geWorld *World);
GENESISAPI geBoolean geEngine_RemoveWorld(geEngine *Engine, geWorld *World);
GENESISAPI geBoolean geEngine_AddBitmap(geEngine *Engine, geBitmap *Bitmap);
GENESISAPI geBoolean geEngine_RemoveBitmap(geEngine *Engine, geBitmap *Bitmap);
GENESISAPI geDriver_System *geEngine_GetDriverSystem(geEngine *Engine);
GENESISAPI geBoolean geEngine_SetDriverAndMode( geEngine *Engine,
geDriver *Driver,
geDriver_Mode *DriverMode);
GENESISAPI geBoolean geEngine_ShutdownDriver(geEngine *Engine);
GENESISAPI geBoolean geEngine_BeginFrame(geEngine *Engine, geCamera *Camera, geBoolean ClearScreen);
GENESISAPI geBoolean geEngine_EndFrame(geEngine *Engine);
GENESISAPI geBoolean geEngine_RenderWorld(geEngine *Engine, geWorld *World, geCamera *Camera, geFloat Time);
GENESISAPI geBoolean geEngine_Printf(geEngine *Engine, int32 x, int32 y, const char *String, ...);
GENESISAPI void GENESISCC geEngine_RenderPoly(const geEngine *Engine, const GE_TLVertex *Points, int NumPoints, const geBitmap *Texture, uint32 Flags);
//RenderPoly : if Texture is null, we Gouraud shade
GENESISAPI void GENESISCC geEngine_RenderPolyArray(const geEngine *Engine, const GE_TLVertex ** pPoints, int * pNumPoints, int NumPolys,
const geBitmap *Texture, uint32 Flags);
GENESISAPI geBoolean GENESISCC geEngine_DrawBitmap(const geEngine *Engine,const geBitmap *Bitmap,
const geRect * Source, uint32 x, uint32 y);
//DrawBitmap & RenderPoly : must Engine_AddBitmap first!
GENESISAPI void geEngine_FillRect(geEngine *Engine, const GE_Rect *Rect, const GE_RGBA *Color);
GENESISAPI geBoolean geEngine_SetGamma(geEngine *Engine, float Gamma);
GENESISAPI geBoolean geEngine_GetGamma(geEngine *Engine, float *Gamma);
GENESISAPI geBoolean geEngine_ScreenShot(geEngine *Engine, const char *FileName);
GENESISAPI void geEngine_EnableFrameRateCounter(geEngine *Engine, geBoolean Enabled);
GENESISAPI geBoolean geEngine_Activate(geEngine *Engine, geBoolean bActive);
#ifdef _INC_WINDOWS
// Windows.h must be included before genesis.h for this api to be exposed.
GENESISAPI geBoolean geEngine_UpdateWindow(geEngine *Engine);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -