include/PxActor.h

File members: include/PxActor.h

// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//  * Neither the name of NVIDIA CORPORATION nor the names of its
//    contributors may be used to endorse or promote products derived
//    from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2024 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.

#ifndef PX_ACTOR_H
#define PX_ACTOR_H

#include "PxPhysXConfig.h"
#include "foundation/PxBounds3.h"
#include "PxClient.h"
#include "common/PxBase.h"

#if !PX_DOXYGEN
namespace physx
{
#endif

class PxRigidActor;
class PxRigidBody;
class PxRigidStatic;
class PxRigidDynamic;
class PxArticulationLink;
class PxScene;

typedef PxU8 PxDominanceGroup;      // Must be < 32, PxU8.

struct PxActorFlag
{
    enum Enum
    {
        eVISUALIZATION                  = (1<<0),

        eDISABLE_GRAVITY                = (1<<1),

        eSEND_SLEEP_NOTIFIES            = (1<<2),

        eDISABLE_SIMULATION             = (1<<3)
    };
};

typedef PxFlags<PxActorFlag::Enum,PxU8> PxActorFlags;
PX_FLAGS_OPERATORS(PxActorFlag::Enum,PxU8)

struct PxActorType
{
    enum Enum
    {
        eRIGID_STATIC,

        eRIGID_DYNAMIC,

        eARTICULATION_LINK,

        eSOFTBODY,

        eFEMCLOTH,

        ePBD_PARTICLESYSTEM,

        eHAIRSYSTEM,

        eACTOR_COUNT,

        eACTOR_FORCE_DWORD = 0x7fffffff
    };
};

class PxActor : public PxBase
{
public:
    virtual     void            release() = 0;

    virtual     PxActorType::Enum   getType()   const = 0;

    virtual     PxScene*        getScene()  const = 0;

    // Runtime modifications

    virtual     void            setName(const char* name)       = 0;

    virtual     const char*     getName()           const   = 0;

    virtual     PxBounds3       getWorldBounds(float inflation=1.01f) const = 0;

    virtual     void            setActorFlag(PxActorFlag::Enum flag, bool value) = 0;

    virtual     void            setActorFlags( PxActorFlags inFlags ) = 0;

    virtual     PxActorFlags    getActorFlags() const = 0;

    virtual     void            setDominanceGroup(PxDominanceGroup dominanceGroup)       = 0;

    virtual     PxDominanceGroup    getDominanceGroup() const = 0;

    virtual     void            setOwnerClient( PxClientID inClient ) = 0;

    virtual     PxClientID      getOwnerClient() const = 0;

    virtual     PxAggregate*    getAggregate()  const = 0;

    //public variables:
                void*           userData;

protected:
    PX_INLINE                   PxActor(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
    PX_INLINE                   PxActor(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
    virtual                     ~PxActor()  {}
    virtual     bool            isKindOf(const char* name)  const       { PX_IS_KIND_OF(name, "PxActor", PxBase); }

};

#if !PX_DOXYGEN
} // namespace physx
#endif

#endif