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

📄 shapebase.h

📁 五行MMORPG引擎系统V1.0
💻 H
📖 第 1 页 / 共 5 页
字号:
   /// @}

   /// @name Object Transforms
   /// @{

   /// Returns the eye transform of this shape, IE the eyes of a player
   /// @param   mat   Eye transform (out)
   virtual void getEyeTransform(MatrixF* mat);

   /// The retraction transform is the muzzle transform in world space.
   ///
   /// If the gun is pushed back, for instance, if the player ran against something,
   /// the muzzle of the gun gets pushed back towards the player, towards this location.
   /// @param   imageSlot   Image slot
   /// @param   mat   Transform (out)
   virtual void getRetractionTransform(U32 imageSlot,MatrixF* mat);

   /// Mount point to world space transform
   /// @param   mountPoint   Mount point
   /// @param   mat    mount point transform (out)
   virtual void getMountTransform(U32 mountPoint,MatrixF* mat);

   /// Muzzle transform of mounted object in world space
   /// @param   imageSlot   Image slot
   /// @param   mat         Muzzle transform (out)
   virtual void getMuzzleTransform(U32 imageSlot,MatrixF* mat);

   /// Gets the transform of a mounted image in world space
   /// @param   imageSlot   Image slot
   /// @param   mat    Transform (out)
   virtual void getImageTransform(U32 imageSlot,MatrixF* mat);

   /// Gets the transform of a node on a mounted image in world space
   /// @param   imageSlot   Image Slot
   /// @param   node    node on image
   /// @param   mat   Transform (out)
   virtual void getImageTransform(U32 imageSlot,S32 node, MatrixF* mat);

   /// Gets the transform of a node on a mounted image in world space
   /// @param   imageSlot   Image Slot
   /// @param   nodeName    Name of node on image
   /// @param   mat         Transform (out)
   virtual void getImageTransform(U32 imageSlot, StringTableEntry nodeName, MatrixF* mat);

   ///@}

   /// @name Render transforms
   /// Render transforms are different from object transforms in that the render transform of an object
   /// is where, in world space, the object is actually rendered. The object transform is the
   /// absolute position of the object, as in where it should be.
   ///
   /// The render transforms typically vary from object transforms due to client side prediction.
   ///
   /// Other than that, these functions are identical to their object-transform counterparts
   ///
   /// @note These are meaningless on the server.
   /// @{
   virtual void getRenderRetractionTransform(U32 index,MatrixF* mat);
   virtual void getRenderMountTransform(U32 index,MatrixF* mat);
   virtual void getRenderMuzzleTransform(U32 index,MatrixF* mat);
   virtual void getRenderImageTransform(U32 imageSlot,MatrixF* mat);
   virtual void getRenderImageTransform(U32 index,S32 node, MatrixF* mat);
   virtual void getRenderImageTransform(U32 index, StringTableEntry nodeName, MatrixF* mat);
   virtual void getRenderMuzzleVector(U32 imageSlot,VectorF* vec);
   virtual void getRenderMuzzlePoint(U32 imageSlot,Point3F* pos);
   virtual void getRenderEyeTransform(MatrixF* mat);
   /// @}



   /// @name Screen Flashing
   /// @{

   /// Returns the level of screenflash that should be used
   virtual F32  getDamageFlash() const;

   /// Sets the flash level
   /// @param   amt   Level of flash
   virtual void setDamageFlash(const F32 amt);

   /// White out is the flash-grenade blindness effect
   /// This returns the level of flash to create
   virtual F32  getWhiteOut() const;

   /// Set the level of flash blindness
   virtual void setWhiteOut(const F32);
   /// @}

   /// @name Invincibility effect
   /// This is the screen effect when invincible in the HUD
   /// @see GameRenderFilters()
   /// @{

   /// Returns the level of invincibility effect
   virtual F32 getInvincibleEffect() const;

   /// Initializes invincibility effect and interpolation parameters
   ///
   /// @param   time   Time it takes to become invincible
   /// @param   speed  Speed at which invincibility effects progress
   virtual void setupInvincibleEffect(F32 time, F32 speed);

   /// Advance invincibility effect animation
   /// @param   dt   Time since last call of this function
   virtual void updateInvincibleEffect(F32 dt);

   /// @}

   /// @name Movement & velocity
   /// @{

   /// Sets the velocity of this object
   /// @param   vel   Velocity vector
   virtual void setVelocity(const VectorF& vel);

   /// Applies an impulse force to this object
   /// @param   pos   Position where impulse came from in world space
   /// @param   vec   Velocity vector (Impulse force F = m * v)
   virtual void applyImpulse(const Point3F& pos,const VectorF& vec);

   /// @}

   /// @name Cameras and Control
   /// @{

#ifdef TGE_RPG	/// TGE_Move
   /// 配合人物点击行走,可在aIPlayer中重写此函数,当主角人物需要
	/// 走到目标坐标时,getNextMove将以Tick为单位生成一系列的Move
	/// 处理成功时,需要返回true;否则,将继续调用MoveManager::getNextMove
	/// 本函数由GameNection::colloectMove调用
   /// @param   curMove   待搜集的Move数据容器
	virtual bool getNextMove(Move &curMove)	{return false;}
	
#endif

   /// Assigns this object a controling client
   /// @param   client   New controling client
   //virtual void setControllingClient(GameConnection* client);

   /// Returns the client controling this object
   //GameConnection* getControllingClient() { return mControllingClient; }

   /// Returns the object controling this object
   ShapeBase* getControllingObject()   { return mControllingObject; }

   /// Sets the controling object
   /// @param   obj   New controling object
   virtual void setControllingObject(ShapeBase* obj);

   /// Returns the object this is controling
   virtual ShapeBase* getControlObject();

   /// sets the object this is controling
   /// @param   obj   New controlled object
   virtual void setControlObject(ShapeBase *obj);

   /// Returns true if this object is controled by something
   bool isControlled() { return(mIsControlled); }

   /// Returns true if this object is being used as a camera in first person
   bool isFirstPerson();

   /// Returns true if the camera uses this objects eye point (defined by modeler)
   bool useObjsEyePoint() const;

   /// Returns true if this object can only be used as a first person camera
   bool onlyFirstPerson() const;

   /// Returns the Field of Vision for this object if used as a camera
   virtual F32 getCameraFov();

   /// Returns the default FOV if this object is used as a camera
   virtual F32 getDefaultCameraFov();

   /// Sets the FOV for this object if used as a camera
   virtual void setCameraFov(F32 fov);

   /// Returns true if the FOV supplied is within allowable parameters
   /// @param   fov   FOV to test
   virtual bool isValidCameraFov(F32 fov);
   /// @}


   void processTick(const Move *move);
   void advanceTime(F32 dt);

   /// @name Rendering
   /// @{

   /// Returns the renderable shape of this object
   TSShape const* getShape();

   bool prepRenderImage(SceneState* state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState);
   void renderObject(SceneState *state, SceneRenderImage *image);

   /// Renders a mounted object
   /// @param   state   State of scene
   /// @param   image   ShapeImage to render
   virtual void renderMountedImage(SceneState* state, ShapeImageRenderImage* image);

   virtual void renderImage(SceneState* state, SceneRenderImage *image);

   /// Renders the shadow for this object
   /// @param   dist   Distance away from object shadow is rendering on
   /// @param   fogAmount  Amount of fog present
   void renderShadow(F32 dist, F32 fogAmount);

   /// Draws a wire cube at any point in space with specified parameters
   /// @param   size   Length, width, depth
   /// @param   pos    xyz position in world space
   static void wireCube(const Point3F& size, const Point3F& pos);

   /// Preprender logic
   virtual void calcClassRenderData();
   /// @}

   /// Control object scoping
   void onCameraScopeQuery(NetConnection *cr, CameraScopeQuery *camInfo);

   /// @name Collision
   /// @{

   /// Casts a ray from start to end, stores gathered information in 'info' returns true if successful
   /// @param   start   Start point for ray
   /// @param   end     End point for ray
   /// @param   info    Information from raycast (out)
   bool castRay(const Point3F &start, const Point3F &end, RayInfo* info);

   /// Builds a polylist of the polygons in this object returns true if successful
   /// @param   polyList   Returned polylist (out)
   /// @param   box        Not used
   /// @param   sphere     Not used
   bool buildPolyList(AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere);

   /// Builds a convex hull for this object @see Convex
   /// @param   box   Bounding box
   /// @param   convex  New convex hull (out)
   void buildConvex(const Box3F& box, Convex* convex);

   /// @}

   /// @name Rendering
   /// @{

   /// Increments the last rendered frame number
   static void incRenderFrame()    { sLastRenderFrame++; }

   /// Returns true if the last frame calculated rendered
   bool didRenderLastRender() { return mLastRenderFrame == sLastRenderFrame; }

   /// Sets the state of this object as hidden or not. If an object is hidden
   /// it is removed entirely from collisions, it is not ghosted and is
   /// essentially "non existant" as far as simulation is concerned.
   /// @param   hidden   True if object is to be hidden
   virtual void setHidden(bool hidden);

   /// Returns true if this object is hidden
   /// @see setHidden
   bool isHidden()   { return mHidden; }

   /// Returns true if this object can be damaged
   bool isInvincible();

   /// Start fade of object in/out
   /// @param   fadeTime Time fade should take
   /// @param   fadeDelay Delay before starting fade
   /// @param   fadeOut   True if object is fading out, false if fading in.
   void startFade( F32 fadeTime, F32 fadeDelay = 0.0, bool fadeOut = true );

   /// Traverses mounted objects and registers light sources with the light manager
   /// @param   lightManager   Light manager to register with
   /// @param   lightingScene  Set to true if the scene is being lit, in which case these lights will not be used
   void registerLights(LightManager * lightManager, bool lightingScene);
   /// @}

   /// Returns true if the point specified is in the water
   /// @param   point    Point to test in world space
   bool pointInWater( Point3F &point );

   /// Returns the percentage of this object covered by water
   F32 getWaterCoverage()  { return mWaterCoverage; }

   /// Returns the height of the liquid on this object
   F32 getLiquidHeight()  { return mLiquidHeight; }

   /// @name Network
   /// @{

   F32 getUpdatePriority(CameraScopeQuery *focusObject, U32 updateMask, S32 updateSkips);
   U32  packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
   void unpackUpdate(NetConnection *conn, BitStream *stream);
   void writePacketData(GameConnection *conn, BitStream *stream);
   void readPacketData(GameConnection *conn, BitStream *stream);
   virtual U32 getPacketDataChecksum(GameConnection *conn);

   /// @}

   DECLARE_CONOBJECT(ShapeBase);
};


//------------------------------------------------------------------------------
// inlines
//------------------------------------------------------------------------------

inline bool ShapeBase::getCloakedState()
{
   return(mCloaked);
}

inline F32 ShapeBase::getCloakLevel()
{
   return(mCloakLevel);
}

inline const char* ShapeBase::getShapeName()
{
   return mShapeNameHandle.getString();
}

inline const char* ShapeBase::getSkinName()
{
   return mSkinNameHandle.getString();
}

/// @name Shadow Detail Constants
///
/// The generic shadow level is the shadow detail at which
/// a generic shadow is drawn (a disk) rather than a generated
/// shadow. The no shadow level is the shadow level at which
/// no shadow is drawn. (Shadow level goes from 0 to 1,
/// higher numbers result in more detailed shadows).
///
/// @{

#define Player_GenericShadowLevel 0.4f
#define Player_NoShadowLevel 0.01f
#define Vehicle_GenericShadowLevel 0.7f
#define Vehicle_NoShadowLevel 0.2f
#define Item_GenericShadowLevel 0.4f
#define Item_NoShadowLevel 0.01f
#define StaticShape_GenericShadowLevel 2.0f
#define StaticShape_NoShadowLevel 2.0f

/// @}
#endif  // _H_SHAPEBASE_

⌨️ 快捷键说明

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