POP/POP_CircleForce.h

/*
 * Copyright (c) 2009
 *      Side Effects Software Inc.  All rights reserved.
 *
 * Redistribution and use of Houdini Development Kit samples in source and
 * binary forms, with or without modification, are permitted provided that the
 * following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. The name of Side Effects Software may not be used to endorse or
 *    promote products derived from this software without specific prior
 *    written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `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 SIDE EFFECTS SOFTWARE 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.
 *
 *----------------------------------------------------------------------------
 */

#ifndef __POP_CircleForce_h__
#define __POP_CircleForce_h__

#include <UT/UT_PtrArray.h>
#include <GEO/GEO_PointTree.h>
#include <GEO/GEO_AttributeHandle.h>

// If the POP is allowed to access the local variables defined for
// particles, need to use the POP_LocalVar class.
#include <POP/POP_LocalVar.h>

namespace HDK_Sample {

enum POP_CircleForceIndex
{
    ILF_ACTIVATE,
    ILF_SOURCE,
    ILF_USECONTEXTGEO,
    ILF_IGNOREXFORM,
    ILF_SPEED,
    ILF_FALLOFF,
};

class POP_CircleForce : public POP_LocalVar
{
public:

    static OP_Node*     myConstructor   (OP_Network* net, const char* name, 
                                         OP_Operator* entry);

    static PRM_Template         myTemplateList[];
    static OP_TemplatePair      myTemplatePair;
    static OP_VariablePair      myVariablePair;

protected:
             POP_CircleForce (OP_Network* net, const char* name, 
                             OP_Operator* entry);
    virtual ~POP_CircleForce (void);

    virtual unsigned    disableParms    (void);
    virtual OP_ERROR    cookPop         (OP_Context &context);

private:

    fpreal  ACTIVATE(fpreal t)
                { FLOAT_PARM("activate", ILF_ACTIVATE, 0, t) };
    void    SOURCE(UT_String &s)
                { STR_PARM("source", ILF_SOURCE, 0, 0) };
    int     USECONTEXTGEO()
                { INT_PARM("usecontextgeo", ILF_USECONTEXTGEO, 0, 0) };
    int     IGNOREXFORM()
                { INT_PARM("ignorexform", ILF_IGNOREXFORM, 0, 0) };
    fpreal  SPEED(fpreal t)
                { FLOAT_PARM("speed", ILF_SPEED, 0, t) };
    fpreal  FALLOFF(fpreal t)
                { FLOAT_PARM("falloff", ILF_FALLOFF, 0, t) };

    // Variables that are evaluated per particle need to have these
    // definitions.
    POP_FPARM(mySpeed, getSpeed);
    POP_FPARM(myFallOff, getFallOff);

    static int* myIndirect;

    void        changePoint (GEO_Point* ppt, POP_ContextData* data, fpreal t,
                            GU_Detail *source,
                            GEO_AttributeHandle &sourcevel_gah,
                            UT_PtrArray<UT_PtrArray<GEO_Point *> *> &ring,
                            GEO_PointTree &pttree,
                             POP_FParam speed,
                             POP_FParam falloff);
};

}       // End HDK_Sample namespace

#endif

Generated on Thu Jan 31 00:24:12 2013 for HDK by  doxygen 1.5.9