POP/POP_LocalForce.h

/*
 * Copyright (c) 2013
 *      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_LocalForce_h__
#define __POP_LocalForce_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_LocalForceIndex
{
    ILF_ACTIVATE,
    ILF_SOURCE,
    ILF_ORIGIN,
    ILF_DIR,
    ILF_RADIUS,
    ILF_LENGTH,
    ILF_STRENGTH,
    ILF_IGNOREMASS,
    ILF_OVERRIDEMASS,
    ILF_MASS
};

class POP_LocalForce : 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_LocalForce (OP_Network* net, const char* name, 
                             OP_Operator* entry);
    virtual ~POP_LocalForce (void);

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

private:

    float   ACTIVATE (float t) { FLOAT_PARM("activate", ILF_ACTIVATE, 0, t) };
    void    SOURCE   (UT_String &s) { STR_PARM("source", ILF_SOURCE, 0, 0) };
    float   ORIGINX  (float t) { FLOAT_PARM("origin", ILF_ORIGIN, 0, t) };
    float   ORIGINY  (float t) { FLOAT_PARM("origin", ILF_ORIGIN, 1, t) };
    float   ORIGINZ  (float t) { FLOAT_PARM("origin", ILF_ORIGIN, 2, t) };
    float   DIRX     (float t) { FLOAT_PARM("dir", ILF_DIR, 0, t) };
    float   DIRY     (float t) { FLOAT_PARM("dir", ILF_DIR, 1, t) };
    float   DIRZ     (float t) { FLOAT_PARM("dir", ILF_DIR, 2, t) };
    float   RADIUS   (float t) { FLOAT_PARM("radius", ILF_RADIUS, 0, t) };
    float   LENGTH   (float t) { FLOAT_PARM("length", ILF_LENGTH, 0, t) };
    float   STRENGTH (float t) { FLOAT_PARM("strength", ILF_STRENGTH, 0, t) };
    int     IGNOREMASS (void) { INT_PARM("ignoremass", ILF_IGNOREMASS, 0, 0) };
    int     OVERRIDEMASS (void) 
                        { INT_PARM("overridemass", ILF_OVERRIDEMASS, 0, 0) };
    float   MASS     (float t) { FLOAT_PARM("mass", ILF_MASS, 0, t) };

    // Variables that are evaluated per particle need to have these
    // definitions.
    POP_FPARM(myStrength, getStrength);
    POP_FPARM(myMass,     getMass);

    static int* myIndirect;

    void        changePoint (GEO_Point* ppt, POP_ContextData* data, float t,
                             const UT_Vector3& origin, const UT_Vector3& dir, 
                             float radius, float length,
                             POP_FParam strength,
                             const GB_AttributeRef &massOffset,
                             POP_FParam mass);
};

}       // End HDK_Sample namespace

#endif

Generated on Mon Jan 28 00:45:44 2013 for HDK by  doxygen 1.5.9