📄 trpage_geom.h
字号:
// Specular color used in lighting void SetSpecular(const trpgColor &); // Emissive color used in lighting void SetEmission(const trpgColor &); // Shininess used in lighting void SetShininess(float64); enum {Smooth,Flat}; // Shading model void SetShadeModel(int); // Point size void SetPointSize(float64); // Line width void SetLineWidth(float64); enum {Front,Back,FrontAndBack}; // Cull mode. See GetCullMode void SetCullMode(int);#ifdef Always // None and Always appear to be defined on the SGI // in such a way as to interfere with a local enum // declaration within a class enum {trNone,trAlways,Equal,GreaterThanOrEqual,GreaterThan, LessThanOrEqual,LessThan,Never,NotEqual};#else enum {None,Always,Equal,GreaterThanOrEqual,GreaterThan, LessThanOrEqual,LessThan,Never,NotEqual};#endif // Alpha Function. See GetAlphaFunc void SetAlphaFunc(int); // Alpha Ref value. See GetAlphaRef void SetAlphaRef(float64); // Alpha value for any polygon using this material void SetAlpha(float64); // Generate normals automatically from geometry void SetAutoNormal(bool); /* Set the total number of textures used by this trpgMaterial. This works with SetTexture. We recommend that you used AddTexture instead of these two methods. */ void SetNumTexture(int); /* Works with SetNumTexture. This method sets the texture ID and texture environment for the given texture instance in this material. Use AddTexture instead, if you can. */ void SetTexture(int no,int id,const trpgTextureEnv &); /* This method takes a texture ID that refers to a trpgTexTable and a trpgTextureEnv which specifies the application information relating to this texture instance. It returns the reference number (i.e. the 3rd texture in this material, etc...) */ int AddTexture(int,const trpgTextureEnv &); // Number of tiles this material is used in void SetNumTiles(int); // Adds a count to the number of tiles this material is used in and returns that number int AddTile(void); // Sets bump map status (color etc... isn't important) void SetIsBumpMap(bool); // Set an attribute (e.g. fid/smc) enum {TR_FID,TR_SMC,TR_STP,TR_SWC}; void SetAttr(int attrCode,int val); // Return the current color bool GetColor(trpgColor &) const; // Returns the ambient color bool GetAmbient(trpgColor &) const; // Returns the diffuse color (the most commonly used color) bool GetDiffuse(trpgColor &) const; // Specular color used for lighting bool GetSpecular(trpgColor &) const; // Emissive color used for lighting bool GetEmission(trpgColor &) const; // Shininess used for lighting bool GetShininess(float64 &) const; // The shading model can be either Smooth or Flat bool GetShadeModel(int &) const; // Point size bool GetPointSize(float64 &) const; // Line width bool GetLineWidth(float64 &) const; /* Cull mode determines whether geometry will be rejected if it's Front facing, Back facing, or neither (FrontAndBack) */ bool GetCullMode(int &) const; /* This controls what alpha values in a texture mean. It can take the values: None,Always,Equal,GreaterThanOrEqual,GreaterThan, LessThanOrEqual,LessThan,Never,NotEqual */ bool GetAlphaFunc(int &) const; /* The Alpha Ref is a value used in some of the Alpha Functions */ bool GetAlphaRef(float64 &) const; // Whether or not to generate normals from geometry bool GetAutoNormal(bool &) const; // A single Alpha value that applies to any polygons using this material bool GetAlpha(float64 &) const; /* One of the useful things about TerraPage is that it contains enough information to page textures & materials as well as terrain. This is part of that. It returns the number of tiles this material is used in. The trpgTexture has its own which is used for paging textures. You only want to pay attention to this if you have some costly material definition in your hardware and so have to swap them in and out. */ bool GetNumTile(int &) const; /* There can be multiple textures per material. This returns the number. The first is the base texture, so just use that if you can only do 1 texture per poly. */ bool GetNumTexture(int &) const; /* TerraPage supports multiple textures per polygon. Some hardware can do this, some can't. If you can support it, here's how this works. This method returns the texture definition for the Nth texture used in this material. That consists of a texture ID which points into a trpgTexTable and a trpgTextureEnv which contains the texture application information. Multiple materials can also appear per trpgGeometry, so be aware that there are two ways to have multiple textures per polygon. */ bool GetTexture(int no,int &id,trpgTextureEnv &) const; // Return whether or not this material is a bump map bool GetIsBumpMap(bool &) const; // Get an attribute (e.g. fid/smc) bool GetAttr(int attrCode,int &val) const; // Validity check bool isValid(void) const; // Resets the contents back to empty void Reset(void); // Writes this class to a write buffer bool Write(trpgWriteBuffer &); // Reads this class from a read buffer bool Read(trpgReadBuffer &); // Prints this class to a print buffer bool Print(trpgPrintBuffer &) const; // Note: Need to do equality operator protected: bool isBump; trpgColor color; trpgColor ambient; trpgColor diffuse; trpgColor specular; trpgColor emission; float64 shininess; int shadeModel; float64 pointSize; float64 lineWidth; int cullMode; int alphaFunc; float64 alpha; float64 alphaRef; bool autoNormal; int numTex; int32 numTile; struct _attrSet { int fid; int smc; int stp; int swc; } attrSet; std::vector<int> texids; std::vector<trpgTextureEnv> texEnvs;};/* Light attributes are used by the trpgLight objects. They control all aspects of how lights are constructed and displayed. Lights are very complicated and often system specific. It's best to consult the Get methods to figure out what options are available.*/TX_EXDECL class TX_CLDECL trpgLightAttr : public trpgReadWriteable{ public: // Default constructor trpgLightAttr(void); // Copy constructor trpgLightAttr(const trpgLightAttr &); // Destructor ~trpgLightAttr(void); // Light Flags enum { // Light flags trpg_Day = 0x0001, trpg_Dusk = 0x0002, trpg_Night = 0x0004, trpg_Directional = 0x0008, trpg_BackColor = 0x0010, trpg_Reflective = 0x0020, // Animation flags trpg_Flashing = 0x0100, trpg_Rotating = 0x0200, trpg_ClockWise = 0x0400, trpg_AnimationMask = 0x0f00, // Performer light flags trpg_Perspective = 0x1000, trpg_Fade = 0x2000, trpg_ZBuffer = 0x4000, trpg_FogPunch = 0x8000, trpg_PerformerMask = 0xf000 } LightFlags; // Light Type typedef enum { trpg_Raster, trpg_Calligraphic, trpg_RASCAL } LightType; // Light Directionality typedef enum { trpg_Omnidirectional, trpg_Bidirectional, trpg_Unidirectional } LightDirectionality; // Light Quality typedef enum { trpg_Off, trpg_Low, trpg_Medium, trpg_High, trpg_Undefined } LightQuality; // Struct for Performer Lights typedef struct PerformerAttr { PerformerAttr() : flags(0),minPixelSize(0),maxPixelSize(0),actualSize(0), transparentPixelSize(0),transparentFallofExp(0),transparentScale(0), transparentClamp(0),fogScale(0) {}; int32 flags; float64 minPixelSize; float64 maxPixelSize; float64 actualSize; float64 transparentPixelSize; float64 transparentFallofExp; float64 transparentScale; float64 transparentClamp; float64 fogScale; }; // Struct for Animated Lights typedef struct AnimationAttr { AnimationAttr() : period(0),phaseDelay(0),timeOn(0),vector(trpg3dPoint(0,0,0)),flags(0) {}; float64 period; float64 phaseDelay; float64 timeOn; trpg3dPoint vector; int32 flags; }; // Struct for Calligraphic Lights typedef struct CalligraphicAttr { CalligraphicAttr() : drawOrder(0),minDefocus(0),maxDefocus(0) {} ; int32 drawOrder; float64 minDefocus; float64 maxDefocus; }; // Setters // Set Type void SetType( trpgLightAttr::LightType ); // Set Directionality void SetDirectionality( trpgLightAttr::LightDirectionality ); // Set Front Color void SetFrontColor( trpgColor ); // Set Front Intensity void SetFrontIntensity( float64 ); // Set Back Color void SetBackColor( trpgColor ); // Set Back Intensity void SetBackIntensity( float64 ); // Set Normal void SetNormal( trpg3dPoint ); // Set SMC void SetSMC( int32 ); // Set FID void SetFID( int32 ); // Set Flags void SetFlags( int32 ); // Set Horizontal Lobe Angle void SetHLobeAngle( float64 ); // Set Vertical Lobe Angle void SetVLobeAngle( float64 ); // Set Lobe Roll Angle void SetLobeRollAngle( float64 ); // Set Lobe Falloff void SetLobeFalloff( float64 ); // Set Ambient Intensity void SetAmbient( float64 ); // Set Quality void SetQuality( trpgLightAttr::LightQuality ); // Set RASCAL Significance void SetRascalSignificance( float64 ); // Set Random Intensity void SetRandomIntensity( trpgLightAttr::LightQuality ); // Set the attributes for Calligraphics Lights void SetCalligraphicAttr( trpgLightAttr::CalligraphicAttr& ); // Set Calligraphic Draw Order void SetCalligraphicDrawOrder( int32 ); // Set Calligraphic Minimum Defocus void SetCalligraphicMinDefocus( float64 ); // Set Calligraphic Maximum Defocus void SetCalligraphicMaxDefocus( float64 ); // Set the attributes for Performer Lights void SetPerformerAttr( trpgLightAttr::PerformerAttr& ); // Set the flags for Perfromer Lights void SetPerformerFlags( int32 ); // Set the minimum pixel size for Performer Lights void SetPerformerMinPixelSize( float64 ); // Set the maximum pixel size for Performer Lights void SetPerformerMaxPixelSize( float64 ); // Set the actual size for Performer Lights void SetPerformerActualSize( float64 ); // Set the transparent pixel size for Performer Lights
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -