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


C++ IParamBlock2::GetParameterType方法代码示例

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


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

示例1: exportParameterAnimations

    // ---------------------------------
    void HwShaderExporter::exportParameterAnimations(
        const String &effectId,
        StdMat2* material
        )
    {
        IParamBlock2 * pblock = material->GetParamBlock ( 0 );
        int parameterCount = pblock->NumParams();

        for ( int i = 0; i < parameterCount; i++ )
        {
            ParamID parameterID = pblock->IndextoID( i );
            ParamType2 parameterType = pblock->GetParameterType( parameterID );

            if( parameterType != TYPE_FLOAT )
            {
                continue;
            }

            ParamDef parameterDef = pblock->GetParamDef( parameterID );

            const TCHAR* paramName = parameterDef.int_name;
#ifdef MAX_2012_OR_NEWER
			Control *controller = pblock->GetControllerByID(parameterID);
#else
			Control *controller = pblock->GetController(parameterID);
#endif

            if( controller != 0 )
            {
#ifdef UNICODE
				String paramNameString = COLLADABU::StringUtils::wideString2utf8String( paramName );
                mDocumentExporter->getAnimationExporter()->addAnimatedFloat( controller, effectId, paramNameString.c_str(), 0 );
#else
				mDocumentExporter->getAnimationExporter()->addAnimatedFloat( controller, effectId, paramName, 0 );
#endif
            }
        }
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:39,代码来源:COLLADAMaxHwShaderExporter.cpp

示例2: if

AWDBlock * MaxAWDExporter::ExportCameraAndTextureExporter(INode * node, double * mtxData, AWDSceneBlock * parent, BlockSettings * blockSettings)
{
    awd_float64 * transform_mtx_camera = (double *)malloc(12*sizeof(awd_float64));
    awd_float64 store1 = mtxData[3];
    awd_float64 store2 = mtxData[4];
    awd_float64 store3 = mtxData[5];
    transform_mtx_camera[0] = mtxData[0];
    transform_mtx_camera[1] = mtxData[1];
    transform_mtx_camera[2] = mtxData[2];
    transform_mtx_camera[3] = mtxData[6];
    transform_mtx_camera[4] = mtxData[7];
    transform_mtx_camera[5] = mtxData[8];
    transform_mtx_camera[6] = store1*-1;
    transform_mtx_camera[7] = store2*-1;
    transform_mtx_camera[8] = store3*-1;
    transform_mtx_camera[9] = mtxData[9];
    transform_mtx_camera[10] = mtxData[10];
    transform_mtx_camera[11] = mtxData[11];
    Object *obj;
    obj = node->GetObjectRef();
    SClass_ID sid=obj->SuperClassID();
    getBaseObjectAndID( obj, sid );
    CameraObject *camObject= (CameraObject *) obj;
    double fov=camObject->GetFOV(0);
    bool isOrtho=camObject->IsOrtho();
    double clipNear=camObject->GetClipDist(0,CAM_HITHER_CLIP);
    double clipFar=camObject->GetClipDist(0,CAM_YON_CLIP);
    char * camName_ptr=W2A(node->GetName());
    AWD_lens_type camType=AWD_LENS_PERSPECTIVE;
    if (isOrtho)
        camType=AWD_LENS_ORTHO;
    AWDCamera * awdCamera = new AWDCamera(camName_ptr, strlen(camName_ptr), camType, transform_mtx_camera);
    AWDTextureProjector * textureProjector= new AWDTextureProjector(camName_ptr, strlen(camName_ptr), mtxData);
    AWDBitmapTexture * projectionTexture = NULL;
    free(camName_ptr);
    if(!isOrtho){
        //double aspectRatio=maxInterface->GetRendApect();
        double aspectRatio=1/double(maxInterface->GetRendImageAspect());
        double horizontalFOV=double(fov* (double(double(180)/(double(3.14159265358979323846)))));
        double verticalFOV=horizontalFOV * double(aspectRatio);
        awdCamera->set_lens_fov(verticalFOV);
    }

    awdCamera->set_lens_near(clipNear * blockSettings->get_scale());
    awdCamera->set_lens_far(clipFar * blockSettings->get_scale());
    bool exportCamera=true;
    bool exportTextureProjector=false;

    BaseObject* node_bo = (BaseObject*)node->GetObjectRef();
    IDerivedObject* node_der = NULL;
    char * settingsNodeID_ptr=NULL;

    if((node_bo->SuperClassID() == GEN_DERIVOB_CLASS_ID) || (node_bo->SuperClassID() == WSM_DERIVOB_CLASS_ID) || (node_bo->SuperClassID() == DERIVOB_CLASS_ID ))
    {
        node_der = ( IDerivedObject* ) node->GetObjectRef();
        if (node_der!=NULL){
            int nMods = node_der->NumModifiers();
            for (int m = 0; m<nMods; m++){
                Modifier* node_mod = node_der->GetModifier(m);
                if (node_mod->IsEnabled()){
                    MSTR className;
                    node_mod->GetClassName(className);
                    char * className_ptr=W2A(className);
                    if (ATTREQ(className_ptr,"AWDCamera")){
                        IParamBlock2* pb = GetParamBlock2ByName((ReferenceMaker*)node_mod, "main");
                        if(pb!=NULL){
                            int numBlockparams=pb->NumParams();
                            int p=0;
                            for (p=0; p<numBlockparams; p++) {
                                ParamID pid = pb->IndextoID(p);
                                ParamDef def = pb->GetParamDef(pid);
                                ParamType2 paramtype = pb->GetParameterType(pid);
                                char * paramName=W2A(def.int_name);
                                if (paramtype==TYPE_STRING) {
                                    if (ATTREQ(paramName, "thisAWDID"))
                                        settingsNodeID_ptr = W2A(pb->GetStr(pid));
                                }
                                if (paramtype==TYPE_BOOL){
                                    if (ATTREQ(paramName, "exportCamera"))
                                        exportCamera = (0 != pb->GetInt(pid));
                                    if (ATTREQ(paramName, "exportTextureProjector"))
                                        exportTextureProjector = (0 != pb->GetInt(pid));
                                }
                                free(paramName);
                            }
                        }
                        if(exportCamera){
                            AWD_lens_type lens_type = AWD_LENS_PERSPECTIVE;
                            int lensType=1;
                            int projectionHeight=1;
                            int offcenterX_pos=1;
                            int offcenterX_neg=1;
                            int offcenterY_pos=1;
                            int offcenterY_neg=1;
                            IParamBlock2*  pb = GetParamBlock2ByName((ReferenceMaker*)node_mod, "camera_params");
                            if(pb!=NULL){
                                int numBlockparams=pb->NumParams();
                                int p=0;
                                for (p=0; p<numBlockparams; p++) {
                                    ParamID pid = pb->IndextoID(p);
//.........这里部分代码省略.........
开发者ID:awaytools,项目名称:AwayExtensions-3dsmax,代码行数:101,代码来源:maxawdexporter_camera.cpp

示例3: ConvertMaterial


//.........这里部分代码省略.........
		PX2::Texture2DPtr diffTex;
		bool normalEnable = false;
		PX2::Texture2DPtr normalTex;
		float normalScale = 0.0f;
		bool specEnable = false;
		PX2::Texture2DPtr specTex;
		float specPower = 0.0f;
		bool reflectEnable = false;
		PX2::TextureCubePtr reflectTex;
		float reflectPower = 0.0f;
		bool doubleSide = false;
		int blendMode = 2;

		ParamBlockDesc2 *paramDesc = 0;
		int numParam = 0;
		if (paramBlock)
		{
			paramDesc = paramBlock->GetDesc();
			numParam = paramBlock->NumParams();

			ParamType2 paramType;
			for (int i=0; i<numParam; i++)
			{
				std::string parmName;
				PX2::Float4 color4 = PX2::Float4(0.0f, 0.0f, 0.0f, 0.0f);
				PX2::Float3 color3 = PX2::Float3(0.0f, 0.0f, 0.0f);
				float floatValue = 0.0f;
				bool boolValue = false;
				float *floatTable = 0;
				int intValue = 0;
				std::string str;
				PX2::Texture2D *tex2d = 0;

				paramType = paramBlock->GetParameterType((ParamID)i);

				if (TYPE_STRING == paramType)
					ConvertStringAttrib(paramBlock, i, parmName, str);
				else if (TYPE_FLOAT == paramType)
					ConvertFloatAttrib(paramBlock, i, parmName, floatValue);
				else if (TYPE_INT == paramType)
					ConvertIntAttrib(paramBlock, i, parmName, intValue);
				else if (TYPE_RGBA == paramType)
					ConvertColorAttrib(paramBlock, i, parmName, color4, i);
				else if (TYPE_POINT3 == paramType)
					ConvertPoint3Attrib(paramBlock, i, parmName, color3);
				else if (TYPE_POINT4 == paramType)
					ConvertPoint4Attrib(paramBlock, i, parmName, color4);
				else if (TYPE_BOOL == paramType)
					ConvertBoolAttrib(paramBlock, i, parmName, boolValue);
				else if (TYPE_FLOAT_TAB == paramType)
					ConvertFloatTabAttrib(paramBlock, i, parmName, floatTable);
				else if (TYPE_BITMAP == paramType)
					ConvertBitMapAttrib(paramBlock, i, parmName, tex2d);
				else if (TYPE_FRGBA ==paramType)
					ConvertFRGBAAttrib(paramBlock, i, parmName, color4);

				// shine
				if (parmName == "gBlendMode")
				{
					blendMode = intValue;
				}
				else if (parmName == "gShineEmissive")
				{
					shineStandard->Emissive = color4;
				}
				else if (parmName == "gShineAmbient")
开发者ID:manyxu,项目名称:Phoenix3D_2.0,代码行数:67,代码来源:PX2SceneBuilderMtl.cpp

示例4: exportEffectParameters

    void HwShaderExporter::exportEffectParameters ( 
        StdMat2* material 
        )
    {
        COLLADASW::StreamWriter* streamWriter = &mDocumentExporter->getStreamWriter();

        IParamBlock2 * pblock = material->GetParamBlock ( 0 );
        int parameterCount = pblock->NumParams();
        
        for ( int i = 0; i < parameterCount; i++ )
        {
            ParamID parameterID = pblock->IndextoID( i );
            ParamType2 parameterType = pblock->GetParameterType( parameterID );
            ParamDef parameterDef = pblock->GetParamDef( parameterID );

            const TCHAR* paramName = parameterDef.int_name;

            switch ( parameterType )
            {
                case TYPE_FLOAT:
                {
                    COLLADASW::NewParam<> newParam ( streamWriter );
                    newParam.setParamType ( COLLADASW::ValueType::FLOAT );

                    int numOfValues = 1;
                    float paramValue = pblock->GetFloat( parameterID );

                    exportParam ( paramName, &newParam, &paramValue, numOfValues );

                    break;
                }

                case TYPE_INT:
                {
                    COLLADASW::NewParam<> newParam ( streamWriter );
                    newParam.setParamType ( COLLADASW::ValueType::INT );

                    int numOfValues = 1;
                    int paramValue = pblock->GetInt( parameterID );

                    exportParam ( paramName, &newParam, &paramValue, numOfValues );

                    break;
                }

                case TYPE_RGBA:
                case TYPE_FRGBA:
                {
                    COLLADASW::NewParam<> newParam ( streamWriter );
                    newParam.setParamType ( COLLADASW::ValueType::FLOAT4 );

                    int numOfValues = 4;
                    AColor paramPoint3Value = pblock->GetAColor( parameterID );
                    float* paramValue = (float*)paramPoint3Value;

                    exportParam ( paramName, &newParam, paramValue, numOfValues );

                    break;
                }

                case TYPE_POINT3:
                {
                    COLLADASW::NewParam<> newParam ( streamWriter );
                    newParam.setParamType ( COLLADASW::ValueType::FLOAT3 );

                    int numOfValues = 3;
                    Point3 paramPoint3Value = pblock->GetPoint3( parameterID );
                    float* paramValue = (float*)paramPoint3Value;

                    exportParam ( paramName, &newParam, paramValue, numOfValues );

                    break;
                }

                case TYPE_BOOL:
                {
                    COLLADASW::NewParam<> newParam ( streamWriter );
                    newParam.setParamType ( COLLADASW::ValueType::BOOL );

                    int numOfValues = 1;
                    /*bool*/ int paramValue = pblock->GetInt( parameterID );

                    exportParam ( paramName, &newParam, &paramValue, numOfValues );

                    break;
                }

                //TYPE_ANGLE   
                //TYPE_PCNT_FRAC   
                //TYPE_WORLD   

                case TYPE_STRING:
                {
                    COLLADASW::NewParam<> newParam ( streamWriter );

                    const MCHAR * paramValue = pblock->GetStr( parameterID );
                    exportParam ( paramName, &newParam, paramValue );

                    break;
                }
//.........这里部分代码省略.........
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:101,代码来源:COLLADAMaxHwShaderExporter.cpp

示例5: ExportUserAttributes

void MaxAWDExporter::ExportUserAttributes(Animatable *obj, AWDAttrElement *elem)
{
    if (!opts->ExportAttributes())
        return;

    ICustAttribContainer *attributes = obj->GetCustAttribContainer();
    if (attributes) {
        int a=0;
        int numAttribs=0;
        numAttribs = attributes->GetNumCustAttribs();
        for (a=0; a<numAttribs; a++) {
            int k=0;
            CustAttrib *attr = attributes->GetCustAttrib(a);

            for (k=0; k<attr->NumParamBlocks(); k++) {
                int p=0;
                IParamBlock2 *block = attr->GetParamBlock(k);
                if (block!=NULL){
                    char * blockName_ptr=W2A(block->GetLocalName());
                    if (ATTREQ(blockName_ptr,"AWDObjectSettingsParams") ){    }
                    // the next three should not occur yet, as we do not read Custom-properties on materials yet
                    else if (ATTREQ(blockName_ptr,"AWD_MaterialSettingsparams") ){    }
                    else if (ATTREQ(blockName_ptr,"AWD_EffectMethodsparams") ){    }
                    else if (ATTREQ(blockName_ptr,"AWDShadingParams") ){    }
                    else{
                        for (p=0; p<block->NumParams(); p++) {
                            ParamID pid = block->IndextoID(p);
                            Color col;
                            AColor acol;

                            Interval valid = FOREVER;

                            awd_uint16 len = 0;
                            AWD_field_type type = AWD_FIELD_FLOAT32;
                            AWD_field_ptr ptr;
                            ptr.v = NULL;

                            switch (block->GetParameterType(pid)) {
                                case TYPE_ANGLE:
                                case TYPE_PCNT_FRAC:
                                case TYPE_WORLD:
                                case TYPE_FLOAT:
                                    type = AWD_FIELD_FLOAT64;
                                    len = sizeof(awd_float64);
                                    ptr.v = malloc(len);
                                    *ptr.f64 = block->GetFloat(pid);
                                    break;

                                case TYPE_TIMEVALUE:
                                case TYPE_INT:
                                    type = AWD_FIELD_INT32;
                                    len = sizeof(awd_int32);
                                    ptr.v = malloc(len);
                                    *ptr.i32 = block->GetInt(pid);
                                    break;

                                case TYPE_BOOL:
                                    type = AWD_FIELD_BOOL;
                                    len = sizeof(awd_bool);
                                    ptr.v = malloc(len);
                                    *ptr.b = (0 != block->GetInt(pid));
                                    break;

                                case TYPE_FILENAME:
                                case TYPE_STRING:
                                    type = AWD_FIELD_STRING;
                                    ptr.str = (char*)block->GetStr(pid);
                                    len = strlen(ptr.str);
                                    break;

                                case TYPE_RGBA:
                                    type = AWD_FIELD_COLOR;
                                    len = sizeof(awd_color);
                                    col = block->GetColor(pid);
                                    ptr.v = malloc(len);
                                    *ptr.col = awdutil_float_color(col.r, col.g, col.b, 1.0);
                                    break;

                                case TYPE_FRGBA:
                                    type = AWD_FIELD_COLOR;
                                    len = sizeof(awd_color);
                                    acol = block->GetAColor(pid);
                                    ptr.v = malloc(len);
                                    *ptr.col = awdutil_float_color(acol.r, acol.g, acol.b, acol.a);
                                    break;
                            }

                            if (ptr.v != NULL) {
                                ParamDef def = block->GetParamDef(pid);
                                if (ns == NULL) {
                                    // Namespace has not yet been created; ns is a class
                                    // variable that will be created only once and then
                                    // reused for all user attributes.
                                    char * ns_ptr=opts->AttributeNamespace();//dont free, as this will get freed in the opts delete
                                    ns = new AWDNamespace(ns_ptr, strlen(ns_ptr));
                                    awd->add_namespace(ns);
                                }
                                char * thisName=W2A(def.int_name);
                                elem->set_attr(ns, thisName, strlen(thisName)+1, ptr, len, type);
                                free(thisName);
//.........这里部分代码省略.........
开发者ID:quinsmpang,项目名称:Tools,代码行数:101,代码来源:maxawdexporter_helper.cpp

示例6: GetCustomAWDObjectSettings

CustomAttributes_struct MaxAWDExporter::GetCustomAWDObjectSettings(IDerivedObject * node_der,Animatable *obj)
{
    CustomAttributes_struct returnData;
    returnData.export_this=true;
    returnData.export_this_children=true;
    if(node_der!=NULL){
        int nMods = node_der->NumModifiers();
        for (int m = 0; m<nMods; m++){
            Modifier* node_mod = node_der->GetModifier(m);
            if (node_mod->IsEnabled()){
                MSTR className;
                node_mod->GetClassName(className);
                char * className_ptr=W2A(className);
                if (ATTREQ(className_ptr,"AWDObjectSettings")){
                    IParamBlock2* pb = GetParamBlock2ByIndex((ReferenceMaker*)node_mod, 0);
                    if(pb!=NULL){
                        int numBlockparams=pb->NumParams();
                        int p=0;
                        for (p=0; p<numBlockparams; p++) {
                            ParamID pid = pb->IndextoID(p);
                            ParamDef def = pb->GetParamDef(pid);
                            ParamType2 paramtype = pb->GetParameterType(pid);
                            char * paramName_ptr=W2A(def.int_name);
                            if (ATTREQ(paramName_ptr, "thisAWDID")){
                                //if (paramtype==TYPE_STRING)
                                //    skeletonMod_ptr=W2A(pb->GetStr(pid));
                            }
                            if (ATTREQ(paramName_ptr, "Export")){
                                if (paramtype==TYPE_BOOL)
                                    returnData.export_this=(0 != pb->GetInt(pid));
                            }
                            if (ATTREQ(paramName_ptr, "ExportChildren")){
                                if (paramtype==TYPE_BOOL)
                                    returnData.export_this_children=(0 != pb->GetInt(pid));
                            }
                        }
                    }
                    free (className_ptr);
                    return returnData;
                }
                free (className_ptr);
            }
        }
        Object * thisOBJ=(Object *)node_der->GetObjRef();
        if(thisOBJ!=NULL){
            if((thisOBJ->SuperClassID() == GEN_DERIVOB_CLASS_ID) || (thisOBJ->SuperClassID() == WSM_DERIVOB_CLASS_ID) || (thisOBJ->SuperClassID() == DERIVOB_CLASS_ID )){
                IDerivedObject* thisDerObj=( IDerivedObject* ) thisOBJ;
                if(thisDerObj!=NULL){
                    int nMods = thisDerObj->NumModifiers();
                    for (int m = 0; m<nMods; m++){
                        Modifier* node_mod = thisDerObj->GetModifier(m);
                        if (node_mod->IsEnabled()){
                            MSTR className;
                            node_mod->GetClassName(className);
                            char * className_ptr=W2A(className);
                            if (ATTREQ(className_ptr,"AWDObjectSettings")){
                                IParamBlock2* pb = GetParamBlock2ByIndex((ReferenceMaker*)node_mod, 0);
                                if(pb!=NULL){
                                    int numBlockparams=pb->NumParams();
                                    int p=0;
                                    for (p=0; p<numBlockparams; p++) {
                                        ParamID pid = pb->IndextoID(p);
                                        ParamDef def = pb->GetParamDef(pid);
                                        ParamType2 paramtype = pb->GetParameterType(pid);
                                        char * paramName_ptr=W2A(def.int_name);
                                        if (ATTREQ(paramName_ptr, "thisAWDID")){
                                            //if (paramtype==TYPE_STRING)
                                            //    skeletonMod_ptr=W2A(pb->GetStr(pid));
                                        }
                                        if (ATTREQ(paramName_ptr, "export")){
                                            if (paramtype==TYPE_BOOL)
                                                returnData.export_this=(0 != pb->GetInt(pid));
                                        }
                                        if (ATTREQ(paramName_ptr, "exportChildren")){
                                            if (paramtype==TYPE_BOOL)
                                                returnData.export_this_children=(0 != pb->GetInt(pid));
                                        }
                                    }
                                }
                                free (className_ptr);
                                return returnData;
                            }
                            free (className_ptr);
                        }
                    }
                }
            }
        }
    }

    while(obj->SuperClassID() != BASENODE_CLASS_ID) {
        if (obj->SuperClassID() == GEN_DERIVOB_CLASS_ID) {
          IDerivedObject *dobj = (IDerivedObject *)obj;
          obj = dobj->GetObjRef();  // Get next object down mod-stack.
        }
        else {
          break;  // Failed.
        }
    }
    ICustAttribContainer *attributes = obj->GetCustAttribContainer();
//.........这里部分代码省略.........
开发者ID:quinsmpang,项目名称:Tools,代码行数:101,代码来源:maxawdexporter_helper.cpp


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