00001 /* 00002 * Copyright (c) 2012 00003 * Side Effects Software Inc. All rights reserved. 00004 * 00005 * Redistribution and use of Houdini Development Kit samples in source and 00006 * binary forms, with or without modification, are permitted provided that the 00007 * following conditions are met: 00008 * 1. Redistributions of source code must retain the above copyright notice, 00009 * this list of conditions and the following disclaimer. 00010 * 2. The name of Side Effects Software may not be used to endorse or 00011 * promote products derived from this software without specific prior 00012 * written permission. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE `AS IS' AND ANY EXPRESS 00015 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00016 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00017 * NO EVENT SHALL SIDE EFFECTS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 00018 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00019 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00020 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00021 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00022 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00023 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00024 * 00025 *---------------------------------------------------------------------------- 00026 * This SOP builds a star. 00027 */ 00028 00029 #ifndef __SOP_Star_h__ 00030 #define __SOP_Star_h__ 00031 00032 #include <SOP/SOP_Node.h> 00033 00034 namespace HDK_Sample { 00035 class SOP_Star : public SOP_Node 00036 { 00037 public: 00038 static OP_Node *myConstructor(OP_Network*, const char *, 00039 OP_Operator *); 00040 00041 /// Stores the description of the interface of the SOP in Houdini. 00042 /// Each parm template refers to a parameter. 00043 static PRM_Template myTemplateList[]; 00044 00045 /// This optional data stores the list of local variables. 00046 static CH_LocalVariable myVariables[]; 00047 00048 protected: 00049 SOP_Star(OP_Network *net, const char *name, OP_Operator *op); 00050 virtual ~SOP_Star(); 00051 00052 /// Disable parameters according to other parameters. 00053 virtual unsigned disableParms(); 00054 00055 00056 /// cookMySop does the actual work of the SOP computing, in this 00057 /// case, a star shape. 00058 virtual OP_ERROR cookMySop(OP_Context &context); 00059 00060 /// This function is used to lookup local variables that you have 00061 /// defined specific to your SOP. 00062 virtual float getVariableValue(int index, int thread); 00063 00064 private: 00065 /// The following list of accessors simplify evaluating the parameters 00066 /// of the SOP. 00067 int DIVISIONS(float t) { return evalInt ("divs", 0, t); } 00068 float XRADIUS(float t) { return evalFloat("rad", 0, t); } 00069 float YRADIUS(float t) { return evalFloat("rad", 1, t); } 00070 int NEGRADIUS() { return evalInt ("nradius", 0, 0); } 00071 float CENTERX(float t) { return evalFloat("t", 0, t); } 00072 float CENTERY(float t) { return evalFloat("t", 1, t); } 00073 float CENTERZ(float t) { return evalFloat("t", 2, t); } 00074 int ORIENT() { return evalInt ("orient", 0, 0); } 00075 00076 /// Member variables are stored in the actual SOP, not with the geometry 00077 /// In this case these are just used to transfer data to the local 00078 /// variable callback. 00079 /// Another use for local data is a cache to store expensive calculations. 00080 int myCurrPoint; 00081 int myTotalPoints; 00082 }; 00083 } // End HDK_Sample namespace 00084 00085 #endif
1.5.9