本文整理汇总了C++中CKBehavior::GetLocalParameterReadDataPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ CKBehavior::GetLocalParameterReadDataPtr方法的具体用法?C++ CKBehavior::GetLocalParameterReadDataPtr怎么用?C++ CKBehavior::GetLocalParameterReadDataPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKBehavior
的用法示例。
在下文中一共展示了CKBehavior::GetLocalParameterReadDataPtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TextureSinus
int TextureSinus(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
// we get the amount value
float xamp=0.1f;
beh->GetInputParameterValue(0, &xamp);
// we get the amount value
float yamp=0.1f;
beh->GetInputParameterValue(1, &yamp);
float l= 1.0f;
beh->GetInputParameterValue(2, &l);
// we get the saved uv's
VxUV* savedUV = (VxUV*) beh->GetLocalParameterReadDataPtr(0);
// we get the interpolated mesh
CKMesh *mesh = (CKMesh*) beh->GetInputParameterObject(4);
int channel = -1;
beh->GetInputParameterValue(3, &channel);
int channelcount = mesh->GetChannelCount();
if (channel < -1 || channel >= channelcount) {
beh->ActivateInput(0, FALSE);
beh->ActivateOutput(0);
return CKBR_PARAMETERERROR;
}
CKDWORD Stride;
VxUV *uvarray = (VxUV*) mesh->GetModifierUVs(&Stride,channel);
int pointsNumber = mesh->GetModifierUVCount(channel);
float time;
beh->GetLocalParameterValue(1, &time);
float t;
for( int i=0 ; i<pointsNumber ; i++, uvarray =(VxUV *)((BYTE *)uvarray + Stride)) {
t = ((float)i/pointsNumber-0.5f)*4.0f+time*l;
uvarray->u = savedUV[i].u + ( 0.5f - savedUV[i].u ) * xamp * cosf(t);
uvarray->v = savedUV[i].v + ( 0.5f - savedUV[i].v ) * yamp * sinf(t);
}
mesh->ModifierUVMove(channel);
float pi = 3.1415926535f;
time += behcontext.DeltaTime * 0.001f;
if(l*time > 2*pi)
time -= (2*pi / l);
beh->SetLocalParameterValue(1, &time);
beh->ActivateInput(0, FALSE);
beh->ActivateOutput(0);
return CKBR_OK;
}
示例2: DOUserValueModified
int DOUserValueModified(const CKBehaviorContext& behcontext)
{
CKBehavior* beh = behcontext.Behavior;
CKMessageManager* mm = behcontext.MessageManager;
CKContext* ctx = behcontext.Context;
//////////////////////////////////////////////////////////////////////////
//connection id :
int connectionID = vtTools::BehaviorTools::GetInputParameterValue<int>(beh,0);
if (beh->IsInputActive(1))
{
beh->ActivateInput(1,FALSE);
beh->ActivateOutput(1);
return 0;
}
//////////////////////////////////////////////////////////////////////////
//the object :
CK3dEntity *obj= (CK3dEntity*)beh->GetInputParameterObject(1);
if (!obj)
{
beh->ActivateOutput(3);
return CKBR_ACTIVATENEXTFRAME;
}
//////////////////////////////////////////////////////////////////////////
//network ok ?
xNetInterface *cin = GetNM()->GetClientNetInterface();
if (!cin)
{
CKParameterOut *pout = beh->GetOutputParameter(2);
XString errorMesg("distributed object creation failed,no network connection !");
pout->SetStringValue(errorMesg.Str());
beh->ActivateOutput(3);
return CKBR_ACTIVATENEXTFRAME;
}
//use objects name, if not specified :
CKSTRING name= obj->GetName();
IDistributedObjects*doInterface = cin->getDistObjectInterface();
IDistributedClasses*cInterface = cin->getDistributedClassInterface();
XString className((CKSTRING) beh->GetLocalParameterReadDataPtr(0));
XString parameterName((CKSTRING) beh->GetLocalParameterReadDataPtr(1));
xDistributedClass *_class = cInterface->get(className.CStr());
//////////////////////////////////////////////////////////////////////////
//dist class ok ?
if (_class==NULL)
{
beh->ActivateOutput(3);
ctx->OutputToConsoleEx("Distributed Class doesn't exists : %s",className.CStr());
return CKBR_ACTIVATENEXTFRAME;
}
const char * cNAme = _class->getClassName().getString();
int classType = _class->getEnitityType();
int bcount = beh->GetInputParameterCount();
//////////////////////////////////////////////////////////////////////////
//we come in by input 0 :
xDistributedObject *dobjDummy = NULL;
xDistributedObject *dobj = doInterface->getByEntityID(obj->GetID());
if (!dobj)
{
beh->ActivateOutput(3);
return CKBR_ACTIVATENEXTFRAME;
}
if (dobj)
{
xDistributedProperty * prop = dobj->getUserProperty(parameterName.CStr());
if (prop)
{
if ( dobj->getGhostUpdateBits().testStrict(1 << prop->getBlockIndex()))
{
CKParameterManager *pam = static_cast<CKParameterManager *>(ctx->GetParameterManager());
CKParameterOut *ciIn = beh->GetOutputParameter(1);
CKParameterType pType = ciIn->GetType();
int sType = vtTools::ParameterTools::GetVirtoolsSuperType(ctx,pam->ParameterTypeToGuid(pType));
int userType = xDistTools::ValueTypeToSuperType(prop->getPropertyInfo()->mValueType);
if ( userType ==sType )
{
beh->ActivateOutput(2);
dobj->getGhostUpdateBits().set(1 << prop->getBlockIndex(),false);
switch(xDistTools::ValueTypeToSuperType(prop->getPropertyInfo()->mValueType))
//.........这里部分代码省略.........