コード例 #1
0
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//|					custom UI update for Duration Test  					 |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
INT_PTR TestSpawnOnCollisionDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) 
	{
	IParamBlock2* pblock;
	case WM_INITDIALOG:
		pblock = map->GetParamBlock();
		UpdateSpawnTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_spawnType,t),
								  pblock->GetInt(kSpawnCollision_deleteParent,t) );
		UpdateSpeedTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_speedType,t) );
		UpdateRandomSeedDlg( hWnd, pblock->GetFloat(kSpawnCollision_spawnAble,t),
								   pblock->GetFloat(kSpawnCollision_numVariation,t),
								   pblock->GetFloat(kSpawnCollision_speedVariation,t),
								   pblock->GetFloat(kSpawnCollision_speedDivergence,t),
								   pblock->GetFloat(kSpawnCollision_scaleVariation,t) );						   
		break;
	case WM_COMMAND:
		pblock = map->GetParamBlock();
		switch (LOWORD(wParam))
		{
		case IDC_NEW:
			if (pblock) pblock->NotifyDependents(FOREVER, PART_OBJ, kSpawnCollision_RefMsg_NewRand);
			return TRUE;
		case IDC_COLLISION_PICKNODE:
			if (pblock) pblock->NotifyDependents( FOREVER, 0, kSpawnCollision_RefMsg_ResetValidatorAction );
			break;
		case IDC_BYLIST:
			if (pblock) pblock->NotifyDependents( FOREVER, 0, kSpawnCollision_RefMsg_ListSelect );
			break;
		case kSpawnCollision_message_type:
			pblock = map->GetParamBlock();
			UpdateSpawnTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_spawnType,t),
									  pblock->GetInt(kSpawnCollision_deleteParent,t) );
			break;
		case kSpawnCollision_message_speed:
			pblock = map->GetParamBlock();
			UpdateSpeedTypeDlg( hWnd, pblock->GetInt(kSpawnCollision_speedType,t) );
			break;
		case kSpawnCollision_message_random:
			pblock = map->GetParamBlock();
			UpdateRandomSeedDlg( hWnd, pblock->GetFloat(kSpawnCollision_spawnAble,t),
									   pblock->GetFloat(kSpawnCollision_numVariation,t),
									   pblock->GetFloat(kSpawnCollision_speedVariation,t),
									   pblock->GetFloat(kSpawnCollision_speedDivergence,t),
									   pblock->GetFloat(kSpawnCollision_scaleVariation,t) );						   
			break;
		case kSpawnCollision_message_deflectors:
			pblock = map->GetParamBlock();
			if (pblock)
				UpdateDeflectorsDlg( hWnd, pblock->Count(kSpawnCollision_deflectors) );
			break;
		}
		break;
	}
	return FALSE;
}
コード例 #2
0
// Called at the start of each frame
void VRayCamera::frameBegin(VR::VRayRenderer *vray) {
  const VR::VRayFrameData &fdata = vray->getFrameData();

  TimeValue t = fdata.t;

  stereo_camera=pblock->GetInt(pb_camera, t);

  // angles in paramblock are automatically converted to radians, so no need to convert here
  fov_angle = pblock->GetFloat(pb_fov_angle, t);
  parallax_distance = pblock->GetFloat(pb_parallax_distance, t);
  separation = pblock->GetFloat(pb_separation, t);
  neck_offset = pblock->GetFloat(pb_neck_offset, t);
  forward_tilt = pblock->GetFloat(pb_forward_tilt, t);
  tilt_compensation = pblock->GetInt(pb_tilt_compensation, t);

  separation_map = pblock->GetBitmap(pb_separation_map, t);
  if (separation_map != NULL) {
    separation_map->Load();
    if (separation_map->bm != NULL) {
      separation_map->bm->SetFilter(BMM_FILTER_PYRAMID);
    }
  }
  head_turn_map = pblock->GetBitmap(pb_head_turn_map, t);
  if (head_turn_map != NULL) {
    head_turn_map->Load();
    if (head_turn_map->bm != NULL) {
      head_turn_map->bm->SetFilter(BMM_FILTER_PYRAMID);
    }
  }
  head_tilt_map = pblock->GetBitmap(pb_head_tilt_map, t);
  if (head_tilt_map != NULL) {
    head_tilt_map->Load();
    if (head_tilt_map->bm != NULL) {
      head_tilt_map->bm->SetFilter(BMM_FILTER_PYRAMID);
    }
  }

  vertical_mode = pblock->GetInt(pb_vertical_mode, t);
  flip_x = pblock->GetInt(pb_flip_x, t);
  flip_y = pblock->GetInt(pb_flip_y, t);
  //fov=pblock->GetFloat(pb_fov, fdata.t);
  fov = 1.0; // fov_angle/ 2.0f; // [rz] testing only. Need better approximation formula.
  targetDist = GetTDist((TimeValue) fdata.t);
  aperture = 0.0f;

  camera.SetPos(fdata.camToWorld.offs, -fdata.camToWorld.m[2], fdata.camToWorld.m[1], fdata.camToWorld.m[0]);
  camera.Init(fdata.imgWidth, fdata.imgHeight, fov, 1.0f, aperture, targetDist);

  this->vray = vray;
}
コード例 #3
0
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
//|					custom UI update for Duration Test  					 |
//+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>+
INT_PTR TestGoToRotationDlgProc::DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) 
	{
	IParamBlock2* pblock;
	case WM_INITDIALOG:
		// Send the message to notify the initialization of dialog
		map->GetParamBlock()->NotifyDependents( FOREVER, (PartID)map, kGoToRotation_RefMsg_InitDlg );
		break;
	case WM_COMMAND:
		pblock = map->GetParamBlock();
		switch (LOWORD(wParam))
		{
		case IDC_NEW:
			if (pblock)
				pblock->NotifyDependents(FOREVER, PART_OBJ, kGoToRotation_RefMsg_NewRand);
			return TRUE;
		case kGoToRotation_message_sync:
			if (pblock)
				UpdateSyncDlg( hWnd, pblock->GetInt(kGoToRotation_syncBy,t) );
			break;
		case kGoToRotation_message_variation:
			if (pblock)
				UpdateVariationDlg( hWnd, pblock->GetTimeValue(kGoToRotation_variation,t),
											pblock->GetFloat(kGoToRotation_spinVariation,t) );
			break;
		case kGoToRotation_message_match:
			if (pblock)
				UpdateMatchDlg( hWnd, pblock->GetInt(kGoToRotation_matchSpin,t) );
			break;
		}
		break;
	}
	return FALSE;
}
コード例 #4
0
// Called at the start of each frame
void VRayCamera::frameBegin(VR::VRayRenderer *vray) {
  const VR::VRayFrameData &fdata = vray->getFrameData();

  TimeValue t = fdata.t;

  stereo_camera=pblock->GetInt(pb_camera, t);

  // angles in paramblock are automatically converted to radians, so no need to convert here
  fov_vert_angle = pblock->GetFloat(pb_fov_vert_angle, t);
  zenith_fov = pblock->GetInt(pb_zenithfov, t);
  fov_horiz_angle = pblock->GetFloat(pb_fov_horiz_angle, t);
  parallax_distance = pblock->GetFloat(pb_parallax_distance, t);
  separation = pblock->GetFloat(pb_separation, t);
  neck_offset = pblock->GetFloat(pb_neck_offset, t);
  zenith_mode = pblock->GetInt(pb_zenith_mode, t);

  separation_map = pblock->GetBitmap(pb_separation_map, t);
  if (separation_map != NULL) {
    separation_map->Load();
    if (separation_map->bm != NULL) {
      separation_map->bm->SetFilter(BMM_FILTER_PYRAMID);
    }
  }
 
  flip_x = pblock->GetInt(pb_flip_x, t);
  flip_y = pblock->GetInt(pb_flip_y, t);

  horiz_neck = pblock->GetInt(pb_horiz_neck, t);;
  poles_corr = pblock->GetInt(pb_poles_corr, t);;
  poles_corr_start = pblock->GetFloat(pb_poles_corr_start, t);
  poles_corr_end = pblock->GetFloat(pb_poles_corr_end, t);
  parallel_cams = pblock->GetInt(pb_parall_cams, t);

  // check poles corr angles
  if (poles_corr_end < poles_corr_start)
    poles_corr_end = poles_corr_start;

  //zenith_fov = (fov_vert_angle < 0.0f) ? TRUE : FALSE;
  //fov_vert_angle = abs(fov_vert_angle);

  //fov=pblock->GetFloat(pb_fov, fdata.t);
  fov = 1.0; // fov_vert_angle / 2.0f;  // [rz] testing only. Need better approximation formula.
  targetDist = GetTDist((TimeValue) fdata.t);
  aperture = 0.0f;

  camera.SetPos(fdata.camToWorld.offs, -fdata.camToWorld.m[2], fdata.camToWorld.m[1], fdata.camToWorld.m[0]);
  camera.Init(fdata.imgWidth, fdata.imgHeight, fov, 1.0f, aperture, targetDist);

  this->vray = vray;
}
コード例 #5
0
ファイル: plGrassComponent.cpp プロジェクト: Asteral/Plasma
    BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        int id = LOWORD(wParam);
        int code = HIWORD(wParam);

        IParamBlock2 *pb = map->GetParamBlock();
        HWND cbox = NULL;

        int selection;
        switch (msg)
        {
        case WM_INITDIALOG:
            cbox = GetDlgItem(hWnd, IDC_GRASS_WAVE);
            SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)"1");
            SendMessage(cbox, CB_ADDSTRING, 1, (LPARAM)"2");
            SendMessage(cbox, CB_ADDSTRING, 2, (LPARAM)"3");
            SendMessage(cbox, CB_ADDSTRING, 3, (LPARAM)"4");

            selection = pb->GetInt(plGrassComponent::kWave);
            ISetToWave(selection, hWnd, pb, map);
            return TRUE;

        case WM_COMMAND:
        case CC_SPINNER_CHANGE:
            int wave = SendMessage(GetDlgItem(hWnd, IDC_GRASS_WAVE), CB_GETCURSEL, 0, 0);
            if (id == IDC_GRASS_WAVE)
            {
                if (wave != pb->GetInt(ParamID(plGrassComponent::kWave)))
                    ISetToWave(wave, hWnd, pb, map);
            }
            else if (id == IDC_GRASS_DIST_X || id == IDC_GRASS_DIST_X_SPIN)
                pb->SetValue(plGrassComponent::kDistXTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDistX)), wave);
            else if (id == IDC_GRASS_DIST_Y || id == IDC_GRASS_DIST_Y_SPIN)
                pb->SetValue(plGrassComponent::kDistYTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDistY)), wave);
            else if (id == IDC_GRASS_DIST_Z || id == IDC_GRASS_DIST_Z_SPIN)
                pb->SetValue(plGrassComponent::kDistZTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDistZ)), wave);
            else if (id == IDC_GRASS_DIR_X || id == IDC_GRASS_DIR_X_SPIN)
                pb->SetValue(plGrassComponent::kDirXTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDirX)), wave);
            else if (id == IDC_GRASS_DIR_Y || id == IDC_GRASS_DIR_Y_SPIN)
                pb->SetValue(plGrassComponent::kDirYTab, 0, pb->GetFloat(ParamID(plGrassComponent::kDirY)), wave);
            else if (id == IDC_GRASS_SPEED || id == IDC_GRASS_SPEED_SPIN)
                pb->SetValue(plGrassComponent::kSpeedTab, 0, pb->GetFloat(ParamID(plGrassComponent::kSpeed)), wave);

            return TRUE;
        }
        return FALSE;
    }
コード例 #6
0
void OrientConstRotation::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev )
{
	if(GetLocked()==false)
	{
		this->ip = ip;
		editCont = this;
		if (flags & BEGIN_EDIT_HIERARCHY) {
			InterpCtrlUI *ui;
			ui = new InterpCtrlUI(NULL,ip,this);
			DWORD f=0;			
			SetProperty(PROPID_INTERPUI,ui);		
		} 
		else {
			orientCD.BeginEditParams(ip, this, flags, prev);
		}

		ip->RegisterTimeChangeCallback(&orientConstTimeChangeCallback);
		orientConstTimeChangeCallback.orient_controller = this;
		
		IParamMap2* pmap = pblock->GetMap();
		if (pmap) hWnd = pmap->GetHWnd();

		if (last_selection < 0){
			RedrawListbox(GetCOREInterface()->GetTime());
		}
		else {
			RedrawListbox(GetCOREInterface()->GetTime(), last_selection);
			ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
			if (spin != NULL){
				float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection);
				spin->SetValue(value, FALSE);
			}
			ReleaseISpinner(spin);

		}
	}
}
コード例 #7
0
ファイル: CrackVisualizer.cpp プロジェクト: skydave/thesis
AColor CrackVisualizer::EvalColor(ShadeContext& sc)
{
	if (gbufID) sc.SetGBufferID(gbufID);

	float dist = pblock->GetFloat( pb_spin, sc.CurTime() )*0.1f;
	float distSquared = dist*dist;
	float minDist = 9999999999999999999.0f;

	// we must be sure that minDist is a value greater than dist
	// ...

	//AColor edgeColor = AColor (1.0f,0.0f,0.0f,1.0f);
	AColor edgeColor = pblock->GetAColor( pb_color, sc.CurTime() );
	edgeColor.a = 1.0f;
	


	int nodeID = sc.NodeID();

	if( !sc.globContext )
		return AColor (0.0f,0.0f,0.0f,0.0f);

	RenderInstance* inst = sc.globContext->GetRenderInstance(nodeID);
	if( (inst==NULL) || (inst->mesh==NULL) || NULL == inst->mesh->faces || inst->mesh->getNumFaces() <= sc.FaceNumber() )
	{
		return AColor (0.0f,0.0f,0.0f,0.0f);
	} 

	// if an entry for the current nodeID doesnt exist 
	if( adjBoundaryEdges.find( nodeID ) == adjBoundaryEdges.end() )
		// build the table
		findAdjBoundaryEdges( nodeID, inst );

	int faceIndex = sc.FaceNumber();
	Face& f = inst->mesh->faces[faceIndex];

	// compute Position of p
	Point3 bary = sc.BarycentricCoords();
	Point3 p = bary[0]*inst->mesh->getVert(f.getVert(0)) + bary[1]*inst->mesh->getVert(f.getVert(1)) + bary[2]*inst->mesh->getVert(f.getVert(2));


	// p is not close to any boundary edge
	// check if p close to any vertex which neighbours a boundaryedge from another triangle
	for( int i=0; i<3; ++i )
	{
		// if wireframe
		if(0)
		{
			DWORD edgeIdx = f.GetEdgeIndex( f.getVert(i), f.getVert((i+1)%3) );

			// get vertex positions
			Point3 v0 = inst->mesh->getVert(f.getVert(i));
			Point3 v1 = inst->mesh->getVert(f.getVert(i+1)%3);

			// compute distance p <-> edge v0, v1
			//float edgeDistance = distancePointLine( p, v0, v1 );
			float edgeDistance = Dist3DPtToLine( &p, &v0, &v1 );
			edgeDistance = edgeDistance*edgeDistance;

			// if distance of p is closer then 1/10 of the distance of v2 to that edge
			if( edgeDistance < minDist )
				minDist = edgeDistance;
		}

		// if there is any incident boundary edge to the current vertex, than we know that it is a
		// boundary vertex
		if( !adjBoundaryEdges[nodeID][f.getVert(i)].empty() )
		{
			// current vertex is a boundary vertex
			// comute distance of p to that vertex
			float vertexDistance = (inst->mesh->getVert( f.getVert(i) ) - p).LengthSquared();

			if( vertexDistance < minDist )
				minDist = vertexDistance;

			// check all boundary edges which are adjacent to the vertex and may
			// come from other faces
			for( int j = 0; j<adjBoundaryEdges[nodeID][f.getVert(i)].size(); ++j  )
			{
				// compute distance to that edge
				Point3 v0 = inst->mesh->getVert( adjBoundaryEdges[nodeID][f.getVert(i)][j].first );
				Point3 v1 = inst->mesh->getVert( adjBoundaryEdges[nodeID][f.getVert(i)][j].second );

				// compute dotproduct
				Point3 vec = p - v0;
				Point3 direction = Normalize( v1 - v0 );
				float maxLength = Length( v1 - v0 );

				float dp = DotProd( vec, direction  );

				if( (dp<0.0f)||(dp>maxLength) )
					continue;

				float edgeDistance = LengthSquared( vec - dp*direction );

				if( edgeDistance < minDist )
					minDist = edgeDistance;
			}
		}
	}

	if( minDist < distSquared )
		return edgeColor;


	return AColor (0.0f,0.0f,0.0f,0.0f);}
コード例 #8
0
ファイル: shaderonb.cpp プロジェクト: 2asoft/xray
	float GetDiffuseLevel(TimeValue t){ return  pblock->GetFloat(onb_diffuse_level,t); }
コード例 #9
0
ファイル: noise.cpp プロジェクト: artemeliy/inf4715
float Noise::GetLowThresh()
{
if (pblock != NULL)
	return  pblock->GetFloat(noise_lowthresh, GetCOREInterface()->GetTime());
else return 0;
}
コード例 #10
0
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);
                            }
                        }
                    }
                    free(blockName_ptr);
                }
            }
        }
    }
}
コード例 #11
0
ファイル: shaderonb.cpp プロジェクト: 2asoft/xray
	float GetSoftenLevel(TimeValue t){ return  pblock->GetFloat(onb_soften,t); }
コード例 #12
0
ファイル: shaderonb.cpp プロジェクト: 2asoft/xray
	float GetSelfIllum(TimeValue t){ return  pblock->GetFloat(onb_self_illum_amnt,t); }		
コード例 #13
0
	void OrientConstRotation::RedrawListbox(TimeValue t,  int sel)
	{
		if (hWnd == NULL) return;
		if (!ip || editCont != this) return;
		int isWorldinListboxFlag = 0;
		if(!orientCD.NumParamMaps()) return;
		int selection = SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_GETCURSEL, 0, 0);
//		IParamBlock2* pb = orientCD.GetParamMap(0)->GetParamBlock();
		SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_RESETCONTENT, 0, 0);
		int ts = 64;  // appears smaller than necessary since for a large no of targets the vertical scroll bar needs space
		SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETTABSTOPS, 1, (LPARAM)&ts);
		int ct = pblock->Count(orientation_target_list);
		int ctf = pblock->Count(orientation_target_weight);
		if (ct != ctf) return;		// CAL-09/10/02: In the middle of changing table size.

		for (int i = 0; i < ct; i++){				
			TSTR str;
			INode *testNode;
			testNode = pblock->GetINode(orientation_target_list, t, i);
			if (testNode == NULL){
				str.printf( _T("%-s\t%-d"), // NOTE: for tab "\t" to use, check "use tabstops" in the resource listbox properties
										_T("World"), (int)pblock->GetFloat(orientation_target_weight, t, i));
				isWorldinListboxFlag = 1;
				ICustButton *iPickOb;
				iPickOb	= GetICustButton(GetDlgItem(hWnd, IDC_ORIENT_PICK_WORLD));
				if (iPickOb != NULL){
					iPickOb->Enable(FALSE);
					ReleaseICustButton(iPickOb);
				}
			}
			else{
				float wwt = pblock->GetFloat(orientation_target_weight, t, i);
				const TCHAR * nname = testNode->GetName();
				str.printf(_T("%-s\t%-d"), 
				testNode->GetName(),
				(int)pblock->GetFloat(orientation_target_weight, t, i));
			}
			SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) str.data());			
		}

		if(!isWorldinListboxFlag){
				ICustButton *iPickOb;
				iPickOb	= GetICustButton(GetDlgItem(hWnd, IDC_ORIENT_PICK_WORLD));
				if (iPickOb != NULL){
					iPickOb->Enable(TRUE);
					ReleaseICustButton(iPickOb);
				}
		}

		if (ct > 0){
			if (sel >= 0){
				SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, sel, 0);
			}
			else{
//		int selection = SendDlgItemMessage(hWnd, IDC_POS_TARG_LIST, LB_GETCURSEL, 0, 0);
				if (selection >= 0){
					SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, selection, 0);
					last_selection = selection;
				}
				else if (ct == 1){
					SendDlgItemMessage(hWnd, IDC_ORIENT_TARG_LIST, LB_SETCURSEL, 0, 0);
					last_selection = 0;
				}
			}
			
			ISpinnerControl* spin = GetISpinner(GetDlgItem(hWnd, IDC_ORIENT_CONS_WEIGHT_SPINNER));
			if (last_selection >= 0 && spin != NULL){
				float value = pblock->GetFloat(orientation_target_weight, GetCOREInterface()->GetTime(), last_selection);
				spin->SetValue(value, FALSE);
			}
			ReleaseISpinner(spin);
		}
		HWND hListBox = GetDlgItem(hWnd, IDC_ORIENT_TARG_LIST);
		int extent = computeHorizontalExtent(hListBox, TRUE, 1, &ts);
		SendMessage(hListBox, LB_SETHORIZONTALEXTENT, extent, 0);
		UpdateWindow(hWnd);
	}
コード例 #14
0
ファイル: shaderonb.cpp プロジェクト: 2asoft/xray
	float GetSpecularLevel(TimeValue t){ return  pblock->GetFloat(onb_specular_level,t); }
コード例 #15
0
ファイル: plLayerConverter.cpp プロジェクト: v1nc3ntm/Plasma
plLayerInterface    *plLayerConverter::IConvertLayerTex( plPlasmaMAXLayer *layer, 
                                                                plMaxNode *maxNode, uint32_t blendFlags, 
                                                                bool preserveUVOffset, bool upperLayer )
{
    hsGuardBegin( "plLayerConverter::IConvertLayerTex" );

    IParamBlock2        *bitmapPB;
    plLocation          loc;


    loc = maxNode->GetLocation();
    bitmapPB = layer->GetParamBlockByID( plLayerTex::kBlkBitmap );
    
    if( !bitmapPB )
    {
        fErrorMsg->Set( !bitmapPB, "Plasma Layer Error", "Bitmap paramblock for Plasma Layer not found" ).Show();
        fErrorMsg->Set();
        return nil;
    }

    // Get a new layer to play with
    plLayer *plasmaLayer = ICreateLayer( plString::FromUtf8( layer->GetName() ), upperLayer, loc );

    // We're using a texture, try and get its info
    PBBitmap    *pbbm = nil;
    BitmapInfo  *bi = nil;

    if( bitmapPB->GetInt( kBmpUseBitmap ) )
    {
        if( bitmapPB )
            pbbm = bitmapPB->GetBitmap( kBmpBitmap );
        if( pbbm )
            bi = &pbbm->bi;
    }

    // If the texture had bad info, assert and return the empty layer
    if( !bi || !bi->Name() || !strcmp(bi->Name(), "") )
    {
        if( upperLayer )
        {
            if( fErrorMsg->Set( !( fWarned & kWarnedNoUpperTexture ), "Plasma Export Error", sWarnNoUpperTexture, maxNode->GetName() ).CheckAskOrCancel() )
                fWarned |= kWarnedNoUpperTexture; 
            fErrorMsg->Set( false );

            delete plasmaLayer;
            return nil;
        }
        else
        {
            return (plLayerInterface *)plasmaLayer;
        }
    }

    // Setup the texture creation parameters
    plBitmapData bd;
    bd.fileName = bi->Name();

    // Create texture and add it to list if unique
    int32_t texFlags = 0;//hsGTexture::kMipMap;

    // Texture Alpha/Color
    if( bitmapPB->GetInt( kBmpInvertColor ) )
        plasmaLayer->SetBlendFlags( plasmaLayer->GetBlendFlags() | hsGMatState::kBlendInvertColor );
    if( bitmapPB->GetInt( kBmpDiscardColor ) )
        plasmaLayer->SetBlendFlags( plasmaLayer->GetBlendFlags() | hsGMatState::kBlendNoTexColor );
    if( bitmapPB->GetInt( kBmpDiscardAlpha ) )
        plasmaLayer->SetBlendFlags( plasmaLayer->GetBlendFlags() | hsGMatState::kBlendNoTexAlpha );
    if( bitmapPB->GetInt( kBmpInvertAlpha ) )
        bd.invertAlpha = true;

    // Texture quality
    if( bitmapPB->GetInt( kBmpNonCompressed ) )
        texFlags |= plBitmap::kForceNonCompressed;

    if( bitmapPB->GetInt( kBmpNoDiscard ) )
        texFlags |= plBitmap::kDontThrowAwayImage;

    switch( bitmapPB->GetInt( kBmpScaling ) )
    {
        case kScalingHalf: texFlags |= plBitmap::kHalfSize;  break;
        case kScalingNone: texFlags |= plBitmap::kNoMaxSize; break;
    }

    // Mip map filtering.
    if( bitmapPB->GetInt( kBmpNoFilter ) )
        texFlags |= plBitmap::kForceOneMipLevel;
    if( bitmapPB->GetInt( kBmpMipBias ) )
    {
        plasmaLayer->SetZFlags( plasmaLayer->GetZFlags() | hsGMatState::kZLODBias );
        plasmaLayer->SetLODBias( bitmapPB->GetFloat( kBmpMipBiasAmt, fConverterUtils.GetTime( fInterface ) ) );
    }
    float sig = bitmapPB->GetFloat( kBmpMipBlur );

    bd.texFlags = texFlags;
    bd.sig = sig;

    // Get detail parameters
    if( bitmapPB->GetInt( kBmpUseDetail ) )
    {                                           // TODO: be smarter
        if( blendFlags & hsGMatState::kBlendAdd )
            bd.createFlags |= plMipmap::kCreateDetailAdd;
        else if( blendFlags & hsGMatState::kBlendMult )
            bd.createFlags |= plMipmap::kCreateDetailMult;
        else
            bd.createFlags |= plMipmap::kCreateDetailAlpha;
        bd.detailDropoffStart = float(bitmapPB->GetInt(kBmpDetailStartSize)) / 100.f;
        bd.detailDropoffStop = float(bitmapPB->GetInt(kBmpDetailStopSize)) / 100.f;
        bd.detailMax = float(bitmapPB->GetInt(kBmpDetailStartOpac)) / 100.f;
        bd.detailMin = float(bitmapPB->GetInt(kBmpDetailStopOpac)) / 100.f;
    }

    // Get max export dimension (since the function we eventually call
    // expects the max of the two dimensions, we figure that out here and
    // pass it on)
    bd.maxDimension = bitmapPB->GetInt( kBmpExportWidth );
    int expHt = bitmapPB->GetInt( kBmpExportHeight );
    if( bd.maxDimension < expHt )
        bd.maxDimension = expHt;
    int clipID = 0, w;
    for( clipID = 0, w = bi->Width(); w > bd.maxDimension; w >>= 1, clipID++ );

    // Do the UV gen (before we do texture, since it could modify the bitmapData struct)
    IProcessUVGen( layer, plasmaLayer, &bd, preserveUVOffset );

    // Create the texture.  If it works, assign it to the layer
    if( ( plasmaLayer = IAssignTexture( &bd, maxNode, plasmaLayer, upperLayer, clipID ) ) == nil )
        return nil;

    // All done!
    return (plLayerInterface *)plasmaLayer;

    hsGuardEnd;
}
コード例 #16
0
    BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
        HWND cbox = NULL;
        switch (msg)
        {

        case WM_INITDIALOG:
            cbox = GetDlgItem(hWnd, IDC_COMP_DISTRIB_PROBCOLORCHAN);
            int i;
            for( i = 0; i < kNumColorChanOptions; i++ )
            {
                SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)kProbColorChanStrings[i].fString);
            }
            SendMessage(cbox, CB_SETCURSEL, map->GetParamBlock()->GetInt(plDistribComponent_old::kProbColorChan), 0);

            ISetupScaleLock(map, true);

            return TRUE;
        case WM_COMMAND:
            if( (HIWORD(wParam) == BN_CLICKED) && (LOWORD(wParam) == IDC_DISTRIB_CLEAR) )
            {
                plDistribComponent_old* dc = (plDistribComponent_old*)map->GetParamBlock()->GetOwner();
                dc->Clear();

                return TRUE;
            }
            switch( LOWORD(wParam) )
            {
                case IDC_COMP_DISTRIB_PROBCOLORCHAN:
                {
                    map->GetParamBlock()->SetValue(plDistribComponent_old::kProbColorChan, t, SendMessage(GetDlgItem(hWnd, LOWORD(wParam)), CB_GETCURSEL, 0, 0));
                    return TRUE;
                }
                break;

                case IDC_COMP_DISTRIB_FADEINACTIVE:
                case IDC_COMP_DISTRIB_FADEINTRAN:
                case IDC_COMP_DISTRIB_FADEINOPAQ:
                case IDC_COMP_DISTRIB_FADEOUTTRAN:
                case IDC_COMP_DISTRIB_FADEOUTOPAQ:
                case IDC_COMP_DISTRIB_FADEINTRAN_SPIN:
                case IDC_COMP_DISTRIB_FADEINOPAQ_SPIN:
                case IDC_COMP_DISTRIB_FADEOUTTRAN_SPIN:
                case IDC_COMP_DISTRIB_FADEOUTOPAQ_SPIN:
                {
                    plDistribComponent_old* dc = (plDistribComponent_old*)map->GetParamBlock()->GetOwner();
                    Box3 fade;
                    if( !dc->IValidateFade(fade) )
                    {
                        map->GetParamBlock()->SetValue(plDistribComponent_old::kFadeInTran, t, fade.Min()[0]);
                        map->GetParamBlock()->SetValue(plDistribComponent_old::kFadeInOpaq, t, fade.Min()[1]);
                        map->GetParamBlock()->SetValue(plDistribComponent_old::kFadeOutTran, t, fade.Max()[0]);
                        map->GetParamBlock()->SetValue(plDistribComponent_old::kFadeOutOpaq, t, fade.Max()[1]);

                        map->Invalidate(plDistribComponent_old::kFadeInTran);
                        map->Invalidate(plDistribComponent_old::kFadeInOpaq);
                        map->Invalidate(plDistribComponent_old::kFadeOutTran);
                        map->Invalidate(plDistribComponent_old::kFadeOutOpaq);
                        ShowWindow(hWnd, SW_HIDE);
                        ShowWindow(hWnd, SW_SHOW);
                    }
                    return TRUE;
                }
                break;
#if 0 // Obsolete, now kRndPosRadius is percentage of kSpacing
                case IDC_COMP_DISTRIB_RNDPOSRADIUS:
                case IDC_COMP_DISTRIB_RNDPOSRADIUS_SPIN:
                {
                    IParamBlock2 *pb = map->GetParamBlock();

                    float maxRndPosRad = pb->GetFloat(plDistribComponent_old::kSpacing) * 0.5f;
                    if( pb->GetFloat(plDistribComponent_old::kRndPosRadius) > maxRndPosRad )
                    {
                        pb->SetValue(plDistribComponent_old::kRndPosRadius, t, maxRndPosRad);
                        map->Invalidate(plDistribComponent_old::kRndPosRadius);
                        ShowWindow(hWnd, SW_HIDE);
                        ShowWindow(hWnd, SW_SHOW);
                    }
                    
                    return TRUE;
                }
#endif // Obsolete, now kRndPosRadius is percentage of kSpacing
                case IDC_COMP_DISTRIB_LOCKSCALEXY:
                case IDC_COMP_DISTRIB_LOCKSCALEXYZ:
                    ISetupScaleLock(map, false);
                    return TRUE;

            }
            break;
        }

        return false;
    }
コード例 #17
0
bool HoudiniEngineMesh::UpdateParameters(TimeValue t)
{
	bool need_cook = false;
	if ( assetId >= 0 )
	{
		hapi::Asset asset(assetId);
		if (asset.isValid())
		{
			INode* node = this->GetINode();
			if (node)
			{
				MSTR pname;
				int subs = node->NumSubs();
				for (int i = 0; i < subs; ++i)
				{
					pname = node->SubAnimName(i);
					Animatable* anim = node->SubAnim(i);
					if (anim)
					{
						int blocks = anim->NumParamBlocks();
						for (int block = 0; block < blocks; ++block)
						{
							IParamBlock2 *pblock = anim->GetParamBlock(block);
							if (pblock) {
								TSTR pbname = pblock->GetLocalName();
								int nNumParams = pblock->NumParams();
								ParamID id;
								std::map<std::string, hapi::Parm> params = asset.parmMap();
								for (int i = 0; i < nNumParams; i++)
								{
									id = pblock->IndextoID(i);
									MSTR pname = pblock->GetLocalName(id);
									std::string hname = CStr::FromMSTR(pblock->GetLocalName(id)).data();

									int index = (int)(hname[hname.size() - 1] - '0');
									hname.pop_back();

									if (std::string("__he_input") == hname)
									{
										// input node
										INode* inputnode = pblock->GetINode(id, t);
										if (inputnode)
										{
											need_cook = SetInputNode(index, inputnode) || need_cook;
										}
									}
									else
									{
										// parameters
										if (params.find(hname) != params.end())
										{
											hapi::Parm parm = params[hname];
											if (HAPI_ParmInfo_IsInt(&parm.info()))
											{
												int value = pblock->GetInt(id, t);
												if (value != parm.getIntValue(index))
												{
													parm.setIntValue(index, value);
													need_cook = true;
												}
											}
											else if (HAPI_ParmInfo_IsFloat(&parm.info()))
											{
												float value = pblock->GetFloat(id, t);
												if (value != parm.getFloatValue(index))
												{
													parm.setFloatValue(index, value);
													need_cook = true;
												}
											}
											else if (HAPI_ParmInfo_IsString(&parm.info()))
											{
												std::string value = CStr::FromMSTR(pblock->GetStr(id, t));
												if (value != parm.getStringValue(index))
												{
													parm.setStringValue(index, value.c_str());
													need_cook = true;
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	return need_cook;
}
コード例 #18
0
ファイル: shaderstrauss.cpp プロジェクト: artemeliy/inf4715
 float GetMetalness( TimeValue t){return pblock->GetFloat(st_metalness,t);  }     
コード例 #19
0
    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;
                }

                //TYPE_FILENAME   
                //TYPE_HSV   
                //TYPE_COLOR_CHANNEL   
                //TYPE_TIMEVALUE   
                //TYPE_RADIOBTN_INDEX   
                //TYPE_MTL   
                //TYPE_TEXMAP   

                case TYPE_BITMAP:
                {
                    PBBitmap * bitmap = pblock->GetBitmap( parameterID );
                    exportSampler ( paramName, bitmap );

                    break;
                }

                //TYPE_INODE   
                //TYPE_REFTARG   
                //TYPE_INDEX   
                //TYPE_MATRIX3   
                //TYPE_PBLOCK2   

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

                    int numOfValues = 4;
                    Point4 paramPoint3Value = pblock->GetPoint4( parameterID );
                    float* paramValue = (float*)paramPoint3Value;

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

                    break;
                }

                default:
                {
                    //:TODO: warning (file and/or popup)
                    GetCOREInterface()->Log()->LogEntry( SYSLOG_WARN, DISPLAY_DIALOG, _M( "Parameter export problem" ),_M( "Unsupported parameter type (%i) for parameter %s\n" ), parameterType, paramName );
                }
            }
        }
    }
コード例 #20
0
ファイル: plate.cpp プロジェクト: artemeliy/inf4715
		float GetBlur(TimeValue t) { 
			return pblock->GetFloat(plate_blur,t); 
			}
コード例 #21
0
ファイル: shaderonb.cpp プロジェクト: 2asoft/xray
	float GetDiffuseRoughness(TimeValue t){ return  pblock->GetFloat(onb_roughness, t); }
コード例 #22
0
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);
                                    ParamDef def = pb->GetParamDef(pid);
                                    ParamType2 paramtype = pb->GetParameterType(pid);
                                    char * paramName=W2A(def.int_name);
                                    if (paramtype==TYPE_INT){
                                        if (ATTREQ(paramName, "lensType"))
                                            lensType = pb->GetInt(pid);
                                        if (ATTREQ(paramName, "projectionHeight"))
                                            projectionHeight = pb->GetInt(pid);
                                        if (ATTREQ(paramName, "offcenterX_pos"))
                                            offcenterX_pos = pb->GetInt(pid);
                                        if (ATTREQ(paramName, "offcenterX_neg"))
                                            offcenterX_neg = pb->GetInt(pid);
                                        if (ATTREQ(paramName, "offcenterY_pos"))
                                            offcenterY_pos = pb->GetInt(pid);
                                        if (ATTREQ(paramName, "offcenterY_neg"))
                                            offcenterY_neg = pb->GetInt(pid);
                                    }
                                    free(paramName);
                                }
                                if(lensType==2){
                                    lens_type=AWD_LENS_ORTHO;
                                    awdCamera->set_lens_proj_height(projectionHeight);
                                }
                                else if (lensType==3){
                                    lens_type=AWD_LENS_ORTHOOFFCENTER;
                                    awdCamera->set_lens_offset(offcenterX_pos, offcenterX_neg, offcenterY_neg, offcenterY_pos );
                                }
                                awdCamera->set_lens_type(lens_type);
                            }
                        }
                        if(exportTextureProjector){
                            IParamBlock2*  pb = GetParamBlock2ByName((ReferenceMaker*)node_mod, "texture_projector_params");
                            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_TEXMAP){
                                        if (ATTREQ(paramName,"projectionTexture") ){
                                            Texmap *projectionTexmap = pb->GetTexmap(pid);
                                            if (projectionTexmap != NULL && projectionTexmap->ClassID() == Class_ID(BMTEX_CLASS_ID, 0)) {
                                                projectionTexture=ExportBitmapTexture((BitmapTex *)projectionTexmap, NULL, UNDEFINEDTEXTYPE, FORTEXTUREPROJECTOR);
                                                if (projectionTexture!=NULL)
                                                    textureProjector->set_texture(projectionTexture);
                                                else{
                                                    textureProjector->make_invalide();
                                                    exportTextureProjector=false;
                                                }
                                            }
                                        }
                                    }
                                    if (paramtype==TYPE_FLOAT){
                                        if (ATTREQ(paramName, "aspect_ratio"))
                                            textureProjector->set_aspect_ratio(pb->GetFloat(pid));
                                    }
                                    free(paramName);
                                }
                            }
                            else{
                                textureProjector->make_invalide();
                                exportTextureProjector=false;
                            }
                        }
                    }
                    free(className_ptr);
                }
            }
        }
    }
    else{
    }
    if(exportCamera){
        if (parent) {
            parent->add_child(awdCamera);
        }
        else {
            awd->add_scene_block(awdCamera);
        }
    }
    else{
        delete awdCamera;
    }

    if(exportTextureProjector){
        textureProjectorCache->Set(settingsNodeID_ptr, textureProjector);
        if (parent) {
            parent->add_child(textureProjector);
        }
        else {
            awd->add_scene_block(textureProjector);
        }
        if(projectionTexture!=NULL)
            awd->add_texture(projectionTexture);
    }
    else{
        delete textureProjector;
        if(projectionTexture!=NULL)
            delete projectionTexture;
    }
    if(settingsNodeID_ptr!=NULL)
        free(settingsNodeID_ptr);
    if((exportCamera)&&(!exportTextureProjector))
        return awdCamera;
    else if((!exportCamera)&&(exportTextureProjector)&&(textureProjector!=NULL))
        return textureProjector;
    else if((exportCamera)&&(exportTextureProjector))
        return awdCamera;
    return NULL;
}
コード例 #23
0
ファイル: shaderonb.cpp プロジェクト: 2asoft/xray
	float GetGlossiness( TimeValue t){return pblock->GetFloat(onb_glossiness,t);  }