本文整理汇总了C++中IParamBlock::GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C++ IParamBlock::GetFloat方法的具体用法?C++ IParamBlock::GetFloat怎么用?C++ IParamBlock::GetFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IParamBlock
的用法示例。
在下文中一共展示了IParamBlock::GetFloat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exportCamera
//---------------------------------------------------------------
void CameraExporter::exportCamera( ExportNode* exportNode )
{
if ( !exportNode->getIsInVisualScene() )
return;
String cameraId = getCameraId(*exportNode);
INode* iNode = exportNode->getINode();
CameraObject* camera = (CameraObject*)iNode->GetObjectRef();
INode* targetNode = ( camera->ClassID().PartA() == LOOKAT_CAM_CLASS_ID) ? iNode->GetTarget() : 0;
if ( camera )
{
if ( mDocumentExporter->isExportedObject(ObjectIdentifier(camera)) )
return;
mDocumentExporter->insertExportedObject(ObjectIdentifier(camera), exportNode);
// Retrieve the camera parameters block
IParamBlock* parameters = (IParamBlock*) camera->GetReference(MaxCamera::PBLOCK_REF);
COLLADASW::BaseOptic * optics = 0;
if ( camera->IsOrtho() )
{
optics = new COLLADASW::OrthographicOptic(COLLADASW::LibraryCameras::mSW);
// Calculate the target distance for FOV calculations
float targetDistance;
if ( targetNode )
{
Point3 targetTrans = targetNode->GetNodeTM(mDocumentExporter->getOptions().getAnimationStart()).GetTrans();
Point3 cameraTrans = iNode->GetNodeTM(mDocumentExporter->getOptions().getAnimationStart()).GetTrans();
targetDistance = (targetTrans - cameraTrans).Length();
}
else
{
targetDistance = camera->GetTDist(mDocumentExporter->getOptions().getAnimationStart());
}
ConversionInverseOrthoFOVFunctor conversionInverseOrthoFOVFunctor(targetDistance);
if ( AnimationExporter::isAnimated(parameters, MaxCamera::FOV) )
{
optics->setXMag(conversionInverseOrthoFOVFunctor(parameters->GetFloat(MaxCamera::FOV)), XMAG_SID);
mAnimationExporter->addAnimatedParameter(parameters, MaxCamera::FOV, cameraId, XMAG_SID, 0, true, &conversionInverseOrthoFOVFunctor);
}
else
{
optics->setXMag(conversionInverseOrthoFOVFunctor(parameters->GetFloat(MaxCamera::FOV)));
}
}
else
{
optics = new COLLADASW::PerspectiveOptic(COLLADASW::LibraryCameras::mSW);
if ( AnimationExporter::isAnimated(parameters, MaxCamera::FOV) )
{
optics->setXFov(COLLADASW::MathUtils::radToDegF(parameters->GetFloat(MaxCamera::FOV)), XFOV_SID);
mAnimationExporter->addAnimatedParameter(parameters, MaxCamera::FOV, cameraId, XFOV_SID, 0, true, &ConversionFunctors::radToDeg);
}
else
{
optics->setXFov(COLLADASW::MathUtils::radToDegF(parameters->GetFloat(MaxCamera::FOV)));
}
}
bool hasAnimatedZNear = mAnimationExporter->addAnimatedParameter(parameters, MaxCamera::NEAR_CLIP, cameraId, optics->getZNearDefaultSid(), 0);
optics->setZNear(parameters->GetFloat(MaxCamera::NEAR_CLIP), hasAnimatedZNear);
bool hasAnimatedZFar = mAnimationExporter->addAnimatedParameter(parameters, MaxCamera::FAR_CLIP, cameraId, optics->getZFarDefaultSid(), 0);
optics->setZFar(parameters->GetFloat(MaxCamera::FAR_CLIP), hasAnimatedZFar);
#ifdef UNICODE
String exportNodeName = COLLADABU::StringUtils::wideString2utf8String(exportNode->getINode()->GetName());
COLLADASW::Camera colladaCamera(COLLADASW::LibraryCameras::mSW, optics, cameraId, COLLADASW::Utils::checkNCName(exportNodeName));
#else
COLLADASW::Camera colladaCamera(COLLADASW::LibraryCameras::mSW, optics, cameraId, COLLADASW::Utils::checkNCName(exportNode->getINode()->GetName()));
#endif
setExtraTechnique(&colladaCamera);
// Retrieve the camera target
if ( targetNode )
{
ExportNode* targetExportNode = mExportSceneGraph->getExportNode(targetNode);
addExtraParameter(EXTRA_PARAMETER_TARGET, "#" + targetExportNode->getId());
}
if (camera->GetMultiPassEffectEnabled(0, FOREVER))
{
IMultiPassCameraEffect *multiPassCameraEffect = camera->GetIMultiPassCameraEffect();
if (multiPassCameraEffect)
{
Class_ID id = multiPassCameraEffect->ClassID();
// the camera could have both effects, but not in Max
if (id == FMULTI_PASS_MOTION_BLUR_CLASS_ID)
//.........这里部分代码省略.........
示例2: GetDiffuseLevel
float GetDiffuseLevel(TimeValue t){ return pblock->GetFloat(PB_DIFFUSE_LEV,t); }
示例3: GetGlossinessY
float GetGlossinessY( TimeValue t){return pblock->GetFloat(PB_GLOSSINESS_Y,t); }
示例4: GetSpecularLevel
float GetSpecularLevel(TimeValue t){ return pblock->GetFloat(PB_SPECULAR_LEV,t); }
示例5: GetParamBlockByIndex
AWDPrimitive * MaxAWDExporter::ExportPrimitiveGeom(Object * obj, char * name){
Class_ID classId = obj->ClassID();
if (classId.PartA() == EDITTRIOBJ_CLASS_ID || classId.PartA() == TRIOBJ_CLASS_ID ){
return NULL;
}
AWD_primitive_type isPrimitve=AWD_PRIMITIVE_UNDEFINED;
if (classId == Class_ID( BOXOBJ_CLASS_ID, 0 ))
isPrimitve=AWD_PRIMITIVE_CUBE;
if (classId == Class_ID( SPHERE_CLASS_ID, 0 ))
isPrimitve=AWD_PRIMITIVE_SPHERE;
if (classId == Class_ID( CYLINDER_CLASS_ID, 0 ))
isPrimitve=AWD_PRIMITIVE_CYLINDER;
if (classId == PLANE_CLASS_ID)
isPrimitve=AWD_PRIMITIVE_PLANE;
if (classId == Class_ID( CONE_CLASS_ID, 0 ))
isPrimitve=AWD_PRIMITIVE_CONE;
if (classId == Class_ID( TORUS_CLASS_ID, 0 ))
isPrimitve=AWD_PRIMITIVE_TORUS;
if (classId ==PYRAMID_CLASS_ID){}
if (classId == GSPHERE_CLASS_ID){}
if (classId == Class_ID( TUBE_CLASS_ID, 0 )){}
if (classId == Class_ID( HEDRA_CLASS_ID, 0 )){}
// KBEN:
//if (classId == Class_ID( BOOLOBJ_CLASS_ID, 0 )){}
if (isPrimitve!=AWD_PRIMITIVE_UNDEFINED){
AWDPrimitive *awdGeom = (AWDPrimitive *)primGeocache->Get(obj);
if (awdGeom == NULL) {
IParamBlock* pblk = GetParamBlockByIndex((ReferenceMaker* )obj, 0);
if (pblk){
if (isPrimitve==AWD_PRIMITIVE_CUBE){
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_CUBE);
awdGeom->set_Yoffset(pblk->GetFloat(BOXOBJ_HEIGHT) /2);
awdGeom->add_number_property(PROP_PRIM_NUMBER1, pblk->GetFloat(BOXOBJ_WIDTH) * opts->Scale(), 100);
awdGeom->add_number_property(PROP_PRIM_NUMBER2, pblk->GetFloat(BOXOBJ_HEIGHT) * opts->Scale(), 100);
awdGeom->add_number_property(PROP_PRIM_NUMBER3, pblk->GetFloat(BOXOBJ_LENGTH) * opts->Scale(), 100);
awdGeom->add_bool_property(PROP_PRIM_BOOL1, false, true);
int cubeSegX=pblk->GetInt(BOXOBJ_WSEGS);
if(cubeSegX>100) cubeSegX=100;
int cubeSegY=pblk->GetInt(BOXOBJ_HSEGS);
if(cubeSegY>100) cubeSegY=100;
int cubeSegZ=pblk->GetInt(BOXOBJ_LSEGS);
if(cubeSegZ>100) cubeSegZ=100;
awdGeom->add_int_property(PROP_PRIM_INT1, cubeSegX, 1);
awdGeom->add_int_property(PROP_PRIM_INT2, cubeSegY, 1);
awdGeom->add_int_property(PROP_PRIM_INT3, cubeSegZ, 1);
}
if (isPrimitve==AWD_PRIMITIVE_SPHERE){
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_SPHERE);
awdGeom->add_number_property(PROP_PRIM_NUMBER1, pblk->GetFloat(SPHERE_RADIUS) * opts->Scale(), 50);
awdGeom->add_int_property(PROP_PRIM_INT1, pblk->GetInt(SPHERE_SEGS), 24);
//bool sphere_smooth=pblk->GetInt(SPHERE_SMOOTH);
//float sphere_hemisphere=pblk->GetFloat(SPHERE_HEMI);
//int sphere_radius=pblk->GetInt(SPHERE_SQUASH);
//int sphere_radius=pblk->GetInt(SPHERE_RECENTER);
}
if (isPrimitve==AWD_PRIMITIVE_CYLINDER){
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_CYLINDER);
awdGeom->set_Yoffset(pblk->GetFloat(CYLINDER_HEIGHT) /2);
awdGeom->add_number_property(PROP_PRIM_NUMBER1, pblk->GetFloat(CYLINDER_RADIUS) * opts->Scale(), 50);
awdGeom->add_number_property(PROP_PRIM_NUMBER2, pblk->GetFloat(CYLINDER_RADIUS) * opts->Scale(), 50);
awdGeom->add_number_property(PROP_PRIM_NUMBER3, pblk->GetFloat(CYLINDER_HEIGHT) * opts->Scale(), 100);
awdGeom->add_int_property(PROP_PRIM_INT1, pblk->GetInt(CYLINDER_SIDES), 16);
awdGeom->add_int_property(PROP_PRIM_INT2, pblk->GetInt(CYLINDER_SEGMENTS), 1);
//int cylinder_capsegments=pblk->GetInt(CYLINDER_CAPSEGMENTS);
//bool cylinder_slice_on=pblk->GetInt(CYLINDER_SLICEON);
//int box_depth_segs=pblk->GetInt(CYLINDER_SMOOTH);
}
if (isPrimitve==AWD_PRIMITIVE_CONE){
float cone_radius2=pblk->GetFloat(CONE_RADIUS2);
if (cone_radius2==0.0){
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_CONE);
awdGeom->set_Yoffset(pblk->GetFloat(CONE_HEIGHT) /2);
awdGeom->add_number_property(PROP_PRIM_NUMBER1, pblk->GetFloat(CONE_RADIUS1) * opts->Scale(), 50);
awdGeom->add_number_property(PROP_PRIM_NUMBER2, pblk->GetFloat(CONE_HEIGHT) * opts->Scale(), 100);
awdGeom->add_int_property(PROP_PRIM_INT1, pblk->GetInt(CONE_SIDES), 16);
awdGeom->add_int_property(PROP_PRIM_INT2, pblk->GetFloat(CONE_SEGMENTS), 1);
}
else{
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_CYLINDER);
awdGeom->set_Yoffset(pblk->GetFloat(CONE_HEIGHT) /2);
awdGeom->add_number_property(PROP_PRIM_NUMBER1, pblk->GetFloat(CONE_RADIUS2) * opts->Scale(), 50);
awdGeom->add_number_property(PROP_PRIM_NUMBER2, pblk->GetFloat(CONE_RADIUS1) * opts->Scale(), 50);
awdGeom->add_number_property(PROP_PRIM_NUMBER3, pblk->GetFloat(CONE_HEIGHT) * opts->Scale(), 100);
awdGeom->add_int_property(PROP_PRIM_INT1, pblk->GetInt(CONE_SIDES), 16);
awdGeom->add_int_property(PROP_PRIM_INT2, pblk->GetInt(CONE_SEGMENTS), 1);
}
//int cone_capSegments=pblk->GetInt(CONE_CAPSEGMENTS);
//int cone_smooth=pblk->GetInt(CONE_SMOOTH);
//int cone_slice_on=pblk->GetInt(CONE_SLICEON);
}
if (isPrimitve==AWD_PRIMITIVE_CAPSULE){//not in 3dsmax supported...
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_CAPSULE);
}
if (isPrimitve==AWD_PRIMITIVE_TORUS){
awdGeom=new AWDPrimitive(name, strlen(name), AWD_PRIMITIVE_TORUS);
awdGeom->add_number_property(PROP_PRIM_NUMBER1, pblk->GetFloat(TORUS_RADIUS) * opts->Scale(), 10);
awdGeom->add_number_property(PROP_PRIM_NUMBER2, pblk->GetFloat(TORUS_RADIUS2) * opts->Scale(), 100);
awdGeom->add_int_property(PROP_PRIM_INT1, pblk->GetInt(TORUS_SEGMENTS), 16);
//float torus_rotation=pblk->GetFloat(TORUS_ROTATION);
//float torus_twist=pblk->GetFloat(TORUS_TWIST);
//.........这里部分代码省略.........