当前位置: 首页>>代码示例>>C++>>正文


C++ IParamBlock::GetInt方法代码示例

本文整理汇总了C++中IParamBlock::GetInt方法的典型用法代码示例。如果您正苦于以下问题:C++ IParamBlock::GetInt方法的具体用法?C++ IParamBlock::GetInt怎么用?C++ IParamBlock::GetInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IParamBlock的用法示例。


在下文中一共展示了IParamBlock::GetInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: exportLight


//.........这里部分代码省略.........
			break;
		}

		// Retrieve the parameter block
		IParamBlock* parameters = 0;
		IParamBlock2* parametersSky = 0;

		if (isSky)
			parametersSky = (IParamBlock2*) lightObject->GetReference(MaxLight::PBLOCK_REF_SKY);
		else
			parameters = (IParamBlock*) lightObject->GetReference(MaxLight::PBLOCK_REF);

		if (!parameters && !parametersSky)
		{
			delete colladaLight;
			return;
		}


		if (parameters)
		{
			bool hasAnimatedColor = mAnimationExporter->addAnimatedParameter(parameters, MaxLight::PB_COLOR, lightId, colladaLight->getColorDefaultSid(), 0 );
			colladaLight->setColor(EffectExporter::maxColor2Color(parameters->GetColor(MaxLight::PB_COLOR)), hasAnimatedColor);
		}
		else if (parametersSky )
		{
			bool hasAnimatedColor = mAnimationExporter->addAnimatedParameter(parametersSky, MaxLight::PB_SKY_COLOR, lightId, colladaLight->getColorDefaultSid(), 0 );
			colladaLight->setColor(EffectExporter::maxColor2Color(parametersSky->GetColor(MaxLight::PB_SKY_COLOR)), hasAnimatedColor);
		}


		if (isSpot || isPoint)
		{
			int decayFunction = parameters->GetInt(isPoint ? MaxLight::PB_DECAY : MaxLight::PB_OMNIDECAY, mDocumentExporter->getOptions().getAnimationStart());
			switch (decayFunction)
			{
			case 1:
				colladaLight->setConstantAttenuation(0.0f);
				colladaLight->setLinearAttenuation(1.0f);
				break;
			case 2:
				colladaLight->setConstantAttenuation(0.0f);
				colladaLight->setQuadraticAttenuation(1.0f);
				break;
			case 0:
			default:
				colladaLight->setConstantAttenuation(1.0f);
				break;
			}
		}
		else if (isSky)
		{
			colladaLight->setConstantAttenuation(1.0f);
		}

		setExtraTechnique(colladaLight);


		if ( parameters )
			addParamBlockAnimatedExtraParameters(LIGHT_ELEMENT, LIGHT_PARAMETERS, LIGHT_PARAMETER_COUNT, parameters, lightId);
		else
			addParamBlockAnimatedExtraParameters(SKYLIGHT_ELEMENT, SKYLIGHT_PARAMETERS, SKYLIGHT_PARAMETER_COUNT, parametersSky, lightId);

		// add all the information to extra tag, that are not contained in IParamBlock
		if (isSpot || isDirectional || isPoint)
		{
开发者ID:StephanieSpanjian,项目名称:OpenCOLLADA,代码行数:67,代码来源:COLLADAMaxLightExporter.cpp

示例2: 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);
//.........这里部分代码省略.........
开发者ID:quinsmpang,项目名称:Tools,代码行数:101,代码来源:maxawdexporter_helper.cpp


注:本文中的IParamBlock::GetInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。