HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
COP2/COP2_SampleGenerator.h
/*
* Copyright (c) 2024
* 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.
*
*----------------------------------------------------------------------------
* Constant SampleGenerator COP
*/
#ifndef __COP2_SAMPLEGENERATOR_H__
#define __COP2_SAMPLEGENERATOR_H__
#include <
UT/UT_Vector3.h
>
#include <
UT/UT_Vector4.h
>
#include <
COP2/COP2_Generator.h
>
namespace
HDK_Sample {
/// @brief Simple COP generator example for the HDK
/// This HDK example demonstrates how to generate image data in COPs. It
/// generates random white noise.
///
class
COP2_SampleGenerator :
public
COP2_Generator
{
public
:
static
OP_Node
*
myConstructor
(
OP_Network
*,
const
char
*,
OP_Operator
*);
/// *{
/// Static lists to define parameters and local variables
static
OP_TemplatePair
myTemplatePair
;
static
OP_VariablePair
myVariablePair
;
static
PRM_Template
myTemplateList
[];
static
CH_LocalVariable
myVariableList
[];
/// *}
/// Determine frame range, image composition and other sequence info
TIL_Sequence
*
cookSequenceInfo
(
OP_ERROR
&
error
)
override
;
protected
:
/// Evaluate parms and stash data for cooking in a COP2_ContextData object
COP2_ContextData
*
newContextData
(
const
TIL_Plane
*,
int
,
float
t
,
int
xres,
int
yres,
int
thread
,
int
max_threads)
override
;
/// Create the image data for a single tile list - multithreaded call
OP_ERROR
generateTile
(
COP2_Context
&context,
TIL_TileList
*tilelist)
override
;
~COP2_SampleGenerator
()
override
;
private
:
COP2_SampleGenerator(
OP_Network
*parent,
const
char
*
name
,
OP_Operator
*entry);
/// *{
/// Parameter evaluation methods
int
SEED(
fpreal
t)
{
return
evalInt
(
"seed"
,0,t); }
void
AMP(
UT_Vector4
&,
fpreal
t)
{ amp.
x
() =
evalFloat
(
"ampl"
,0,t);
amp.
y
() =
evalFloat
(
"ampl"
,1,t);
amp.
z
() =
evalFloat
(
"ampl"
,2,t);
amp.
w
() =
evalFloat
(
"ampl"
,3,t); }
/// *}
};
/// @brief Data class to hold parm values and data for COP2_SampleGenerator
/// This class is used to hold the evaluated parms and data needed for the
/// cook. Because the cook method generateTiles() is threaded and called
/// multiple times, this class caches any data needed once and is used by many
/// tiles and threads, to reduce redundancy.
class
cop2_SampleGeneratorData :
public
COP2_ContextData
{
public
:
cop2_SampleGeneratorData
() :
myAmp
(0.0
f
,0.0
f
,0.0
f
),
mySeed
(0) { }
~cop2_SampleGeneratorData
()
override
{ ; }
UT_Vector4
myAmp
;
int
mySeed
;
};
}
// End HDK_Sample namespace
#endif
Generated on Tue Dec 17 2024 03:39:30 for HDK by
1.8.6