Ejemplo n.º 1
0
Point3 PBombField::Force(TimeValue t,const Point3 &pos, const Point3 &vel,int index)
{	float d,chaos,dv;
	Point3 dlta,xb,yb,zb,center,expv;
	int decaytype,symm;
	Point3 zero=Zero;
		fValid = FOREVER;		
		if (!tmValid.InInterval(t)) 
		{	tmValid = FOREVER;
			tm = node->GetObjectTM(t,&tmValid);
			invtm = Inverse(tm);
		}
		xb=tm.GetRow(0);
		yb=tm.GetRow(1);
		zb=tm.GetRow(2);
		center=tm.GetTrans();
		fValid &= tmValid;
		TimeValue t0,t2,lastsfor;
		obj->pblock->GetValue(PB_STARTTIME,t,t0,fValid);
		obj->pblock->GetValue(PB_LASTSFOR,t,lastsfor,fValid);
		t2=t0+lastsfor;
		dlta=Zero;
		if ((t>=t0)&&(t<=t2))
		{ float L=Length(dlta=pos-center);
		  obj->pblock->GetValue(PB_DECAY,t,d,fValid);
		  obj->pblock->GetValue(PB_DECAYTYPE,t,decaytype,fValid);
		  if ((decaytype==0)||(L<=d))
		  { obj->pblock->GetValue(PB_DELTA_V,t,dv,fValid);
		    obj->pblock->GetValue(PB_CHAOS,t,chaos,fValid);
		    obj->pblock->GetValue(PB_SYMMETRY,t,symm,fValid);
		    Point3 r;
		    if (symm==SPHERE)
		      expv=(r=dlta/L);
	        else if (symm==PLANAR)
		    { L=DotProd(dlta,zb);
			  expv=(L<0.0f?L=-L,-zb:zb);
		    }
		    else
		    { Point3 E;
		      E=DotProd(dlta,xb)*xb+DotProd(dlta,yb)*yb;
		      L=Length(E);
		      expv=E/L;
		    }
		    dlta=(dv*expv)/(float)dtsq;
			if (decaytype==1)
			 dlta*=(d-L)/d;
			else if (decaytype==2)
			 dlta*=(1/(float)exp(L/d));
			if ((!FloatEQ0(chaos))&&(lastsfor==0.0f))
			{ float theta;
			  theta=HalfPI*chaos*RND01();
			  // Martell 4/14/01: Fix for order of ops bug.
			  float ztmp=RND11(); float ytmp=RND11(); float xtmp=RND11();
			  Point3 d=Point3(xtmp,ytmp,ztmp);
			  Point3 c=Normalize(dlta^d);
			  RotateOnePoint(&dlta.x,&zero.x,&c.x,theta);
			}
		  }	else dlta=Zero; 
		}
	return dlta;
	}
Ejemplo n.º 2
0
RefResult SWrapObject::NotifyRefChanged( 
		Interval changeInt,
		RefTargetHandle hTarget, 
		PartID& partID, 
		RefMessage message )
	{				
	switch (message) {		
		case REFMSG_CHANGE:	
			{ if (hTarget==custnode) cmValid.SetEmpty();
			  if (hTarget==pblock) InvalidateUI();
			SimpleWSMObject::NotifyRefChanged(changeInt,hTarget,partID,message);
			}
			break;
		case REFMSG_TARGET_DELETED:	
			{ if (hTarget==custnode) custnode=NULL;
			}
			break;
		case REFMSG_NODE_NAMECHANGE:
			{ if (hTarget==custnode) 
			  { custname = TSTR(custnode->GetName());
			    ShowName();
				}
			  break;
			}
		default: SimpleWSMObject::NotifyRefChanged(changeInt,hTarget,partID,message);
		}
	return REF_SUCCEED;
	}
Ejemplo n.º 3
0
 CProcessSessionState(SessionId id,INode *_node,DaliClientRole _role)
     : CSessionState(id)
 {
     node = _node;
     node->Link();
     role = _role;
 }
Ejemplo n.º 4
0
void ResetXForm::SelectionSetChanged(Interface *ip,IUtil *iu)
	{
	if (ip->GetSelNodeCount()) {
		BOOL res = FALSE;
		for (int i=0; i<ip->GetSelNodeCount(); i++) {
			INode *node = ip->GetSelNode(i);
			if (!node->IsGroupMember() && !node->IsGroupHead()) {
				res = TRUE;
				break;
				}
			}
		EnableWindow(GetDlgItem(hPanel,IDC_RESETTM_SELECTED),res);
	} else {
		EnableWindow(GetDlgItem(hPanel,IDC_RESETTM_SELECTED),FALSE);
		}
	}
 int getMinimalElement() const
 {
     if (!root)
     {
         throw EmptyHeapException();
     }
     return root->getKey();
 }
Ejemplo n.º 6
0
INode *CollisionImport::ImportCollisionMesh(
	const vector<Vector3>& verts, 
	const vector<Triangle>& tris,
	const vector<Vector3>& norms,
	Matrix3& tm,
	INode *parent
	)
{
	INode *returnNode = NULL;
	if ( ImpNode *node = ni.i->CreateNode() )
	{
		TriObject *triObject = CreateNewTriObject();
		node->Reference(triObject);

		Mesh& mesh = triObject->GetMesh();
		INode *tnode = node->GetINode();

		// Vertex info
		{
			int nVertices = verts.size();
			mesh.setNumVerts(nVertices);
			for (int i=0; i < nVertices; ++i){
				Vector3 v = verts[i] * ni.bhkScaleFactor;
				mesh.verts[i].Set(v.x, v.y, v.z);
			}
		}

		// Triangles and texture vertices
		ni.SetTriangles(mesh, tris);
		//ni.SetNormals(mesh, tris, norms);

		MNMesh mn(mesh);
		mn.Transform(tm);
		mn.OutToTri(mesh);
		mesh.checkNormals(TRUE);

		ni.i->AddNodeToScene(node);   

		returnNode = node->GetINode();
		returnNode->EvalWorldState(0);

		if (parent != NULL)
			parent->AttachChild(tnode, 1);
	}
	return returnNode;
}
Ejemplo n.º 7
0
BOOL SWrapPickOperand::HitTest(
		IObjParam *ip,HWND hWnd,ViewExp *vpt,IPoint2 m,int flags)
	{	
	INode *node = ip->PickNode(hWnd,m,this);
	
	if (node) 
	{	ObjectState os = node->GetObjectRef()->Eval(ip->GetTime());
	  if (!IsGEOM(os.obj)) 
		{	node = NULL;
			return FALSE;
			}
	node->BeginDependencyTest();
	po->NotifyDependents(FOREVER,0,REFMSG_TEST_DEPENDENCY);
	if (node->EndDependencyTest()) return FALSE;
	}
	return node ? TRUE : FALSE;
	}
void TestSplitBySourceDlgProc::UpdateSourceDlg( IParamMap2* map )
{
	if (map == NULL) return;
	IParamBlock2* pblock = map->GetParamBlock();
	if (pblock == NULL) return;
	HWND hWnd = map->GetHWnd();

	HWND hWndSystem = GetDlgItem(hWnd, IDC_SOURCELIST);
	SendMessage(hWndSystem, LB_RESETCONTENT, 0, 0);
	IPFSystemPool* pool = GetPFSystemPool();
	for(int i=0; i<pool->NumPFSystems(); i++) {
		INode* pSystem = pool->GetPFSystem(i);
		SendMessage(hWndSystem, LB_ADDSTRING, 0, (LPARAM)(TCHAR*)(pSystem->GetName()) );
		if (SBSIsSelectedSource(pSystem, pblock))
			SendMessage(hWndSystem, LB_SETSEL, TRUE, i);
	}
}
Ejemplo n.º 9
0
void FsDirectoryImpl::commitChunk(const Chunk& chunk)
{
    INode* pINode;

    pINode = (INode*)m_pNewChunkTable->findItem(chunk.id);

    if ( !pINode ) {
        LOG4CPLUS_WARN(m_logger, "commit a unalloacted chunk :" 
                << "id=" << chunk.id << " version=" << chunk.version << "size=" << chunk.size);
        throw NoChunkAllocated("commit a unalloacted chunk");
    }
    pINode->addChunk(chunk);

    m_pNewChunkTable->deleteItem(chunk.id);
    m_pChunkTable->addItem(chunk.id, pINode);

}
Ejemplo n.º 10
0
INodeTab GR2ImportImpl::ImportSkeleton(Skeleton& skel)
{
   Point3 zAxis(0,0,1);
   INodeTab nodes;
   nodes.SetCount(int(skel.Bones.size()));
   float scale = 1.0f;

   for (size_t i=0, n=skel.Bones.size(); i<n; ++i)
   {
      Bone& bone = skel.Bones[i];

      INode *node = o->gi->GetINodeByName(bone.Name.c_str());
      if (node != NULL)
      {
         nodes[i] = node;
         continue;
      }

      Point3 pp(0.0f,0.0f,0.0f);

      Matrix3 tm = GetWorldTransform(skel, i);
      Point3 p = tm.GetTrans();
      Quat q = tm;

      if (bone.ParentIndex >= 0)
      {
         Matrix3 m3 = GetWorldTransform(skel, bone.ParentIndex);
         pp = m3.GetTrans();
         //pp = skel.Bones[bone.ParentIndex].Transform.Origin;
      }
      node = CreateBone(bone.Name.c_str(), p, pp, zAxis);
      node->SetUserPropInt("GR2BoneIndex", int(i));
      nodes[i] = node;

      //OutputDebugString(FormatText("GR2BoneIndex: %d %s\n", i, bone.Name.c_str()));

      PosRotScaleNode(node, p, q, scale, PosRotScale(prsPos|prsRot));

      if (bone.ParentIndex >= 0)
      {
         if (INode *pn = nodes[bone.ParentIndex])
            pn->AttachChild(node, 1);
      }
   }
   return nodes;
}
Ejemplo n.º 11
0
 NodeDiscoverer(INode& node, IEventTracer& tracer, INodeDiscoveryHandler& handler)
     : TimerBase(node)
     , handler_(handler)
     , tracer_(tracer)
     , node_map_(node.getAllocator())
     , get_node_info_client_(node)
     , node_status_sub_(node)
 { }
Ejemplo n.º 12
0
void PatchDeformPW::SetResampleModContext(BOOL resample)
{
    PatchEnumProc dep;              
	DoEnumDependents(&dep);
	for ( int i = 0; i < dep.Nodes.Count(); i++)
		{
		INode *node = dep.Nodes[i];
		BOOL found = FALSE;

		if (node)
			{
			Object* obj = node->GetObjectRef();
	
			 RecursePipeAndMatch2(this,obj,resample) ;
			}
		}
}
bool HoudiniEngineMesh::CreateMaterial()
{
	bool result = false;

	if ( assetId >= 0 )
	{
		INode* node = GetINode();
		if ( node )
		{
			TSTR texturePath = pblock2->GetStr(pb_texture_path);
			Mtl* mat = util::CreateMaterial( assetId, texturePath );
			node->SetMtl(mat);
			result = true;
		}
	}
	return result;
}
Ejemplo n.º 14
0
/**
*  @brief
*    Writes the flexible scene node variables
*/
void PLSceneNode::WriteVariables(XmlElement &cNodeElement) const
{
	// Export variables?
	if (g_SEOptions.bUserPropVariables) {
		// Is there a 3ds Max node (No 3ds Max node, no properties)
		INode *pMaxNode = GetMaxNode();
		if (pMaxNode) {
			// Check for variables
			TSTR s3dsMaxString;
			if (pMaxNode->GetUserPropString(_T("Vars"), s3dsMaxString)) {
				// Get all expressions
				static RegEx cExpressionRegEx("\\s*((\\w*\\s*=\\s*\"[^\"]*\")|(\\w*\\s*=\\s*[\\w|]*))");
				const String sString = s3dsMaxString;
				uint32 nExpressionParsePos = 0;
				while (cExpressionRegEx.Match(sString, nExpressionParsePos)) {
					// Get expression
								 nExpressionParsePos = cExpressionRegEx.GetPosition();
					const String sExpression		 = cExpressionRegEx.GetResult(0);

					// Process the found expression
					static RegEx cRegEx("\\s*(\\w*)\\s*=\\s*\"?\\s*([^\"]*)\\s*\"?");
					if (cRegEx.Match(sExpression)) {
						// Get name and value
						const String sName  = cRegEx.GetResult(0);
						const String sValue = cRegEx.GetResult(1);

						// Flags variable?
						if (sName == "Flags") {
							// Update attribute
							String sFlags = cNodeElement.GetAttribute(sName);
							if (sFlags.GetLength())
								sFlags += '|' + sValue;
							else
								sFlags = sValue;
							sFlags.Trim();
							cNodeElement.SetAttribute(sName, sFlags);
						} else {
							// Set attribute
							cNodeElement.SetAttribute(sName, sValue);
						}
					}
				}
			}
		}
	}
}
void plDistribComponent_old::Clear()
{
    GetCOREInterface()->DisableSceneRedraw();
    // First, clear out any we've already done.
    int numReps = fCompPB->Count(kReplicants);
    int i;
    for( i = 0; i < numReps; i++ )
    {
        INode* rep = fCompPB->GetINode(kReplicants, TimeValue(0), i);
        if( rep )
            rep->Delete(TimeValue(0), true);
    }
    fCompPB->ZeroCount(kReplicants);

    GetCOREInterface()->EnableSceneRedraw();
    GetCOREInterface()->ForceCompleteRedraw(FALSE);
}
Ejemplo n.º 16
0
void DxStdMtl2::FindLights(INode * parentNode)
{
	TimeValue t = GetCOREInterface()->GetTime();

	for(int i=0; i < parentNode->NumberOfChildren(); i++) 
	{
		INode * node = parentNode->GetChildNode(i);
		ObjectState Os   = node->EvalWorldState(t);
		if(Os.obj && Os.obj->SuperClassID() == LIGHT_CLASS_ID) 
		{
			LightCache * lc = new LightCache(this,node);
			sceneLights.Append(1, &lc);
		}
		FindLights(node);
	}

}
Ejemplo n.º 17
0
void bhkProxyObject::CreateMesh()
{
	if (Interface *gi = this->mIP)
	{
		if (const Mesh* pMesh = &this->proxyMesh)
		{
			if (TriObject *triObject = CreateNewTriObject())
			{
				MNMesh mnmesh(*pMesh);
				Mesh& mesh = triObject->GetMesh();
				mnmesh.OutToTri(mesh);

				INode *node = gi->CreateObjectNode(triObject);
				// Wireframe Red color
				StdMat2 *collMat = NewDefaultStdMat();
				collMat->SetDiffuse(Color(1.0f, 0.0f, 0.0f), 0);
				collMat->SetWire(TRUE);
				collMat->SetFaceted(TRUE);
				gi->GetMaterialLibrary().Add(collMat);
				node->SetMtl(collMat);

				node->SetPrimaryVisibility(FALSE);
				node->SetSecondaryVisibility(FALSE);
				node->BoneAsLine(TRUE);
				node->SetRenderable(FALSE);
				node->SetWireColor( RGB(255,0,0) );

				gi->SelectNode(node);
			}
		}
	}
}
Ejemplo n.º 18
0
void FsDirectoryImpl::renameFile(const std::string& src, const std::string& dst)
{
    Path srcPath(src), dstPath(dst);
    DirNode* pDirNode, *pDstDirNode;
    INode* pINode;

    //preconditions check
    if (srcPath.isPureDir() || dstPath.isPureDir()){
        LOG4CPLUS_WARN(m_logger, "src or dst are not filename : src=" << src << " dst=" << dst);
        throw InvalidFileOrDirName("renameFile : src or dst are not filename");
    }
    if(m_pDirTree->findINode(dst)) {
        LOG4CPLUS_WARN(m_logger, "dst already exist : dst=" << dst);
        throw FileOrDirAlreadyExists("renameFile : dst");
    }
    
    //#TODO, lock

    //get source file INode
    pDirNode = m_pDirTree->findDirNode(srcPath.getDirName());
    if(!pDirNode) {
        LOG4CPLUS_WARN(m_logger, "src directory not exist :" << srcPath.getDirName());
        throw NoSuchFileOrDir("renameFile : src directory");
    }

    if (!(pINode = pDirNode->findFile(srcPath.getFileName()))){
        LOG4CPLUS_WARN(m_logger, "src file not exist :" << srcPath.getFileName());
        throw NoSuchFileOrDir("renameFile : src filename");
    }

    //create destination
    if(!( pDstDirNode = m_pDirTree->createDirNodes(dstPath.getDirName()) )) {
        LOG4CPLUS_WARN(m_logger, "invalid dst path name : "<< dstPath.getDirName());
        throw InvalidFileOrDirName("renameFile : dst");
    }

    //#TODO,this operation change meta data, make it atomic
    {
        pDirNode->deleteFile(srcPath.getFileName(), DirNode::ReserveNodeInDelete);
        pINode->setName(dstPath.getFileName());
        pDstDirNode->addFile(pINode);
        //pDstDirNode->addFile(*pINode);
        //delete pINode;
    }
}
Ejemplo n.º 19
0
void FindMousePointer(UINT x,UINT y){

CVector Start;//=CVector();
CVector End;//=CVector();

// переводим координаты курсора мышки в отрезок мира
DEVICER->MouseToWorld(x,y,Start,End);

// получаем список нод, которые наш отрезок "проткнул"
//NodeList_typ listNode=myWorld->getNodesByPos(Start,End);
asn_ext_ptr_list* myList = createPtrList();
ASNIWorld3D *my3dWorld=(ASNIWorld3D*)myWorld->getInterface("ASNIWorld3d");
my3dWorld->getNodesByPos(Start,End,myList);

//if ( listNode.size()>0) {

bool missed = true;

if ( myList->nums>0){

//    NodeList_typ::iterator it=listNode.begin();
    for ( UINT i=0; i<myList->nums; i++ ){

	INode* myNode = (INode*)myList->ptr_list[i].pointer;

        if ( std::string( myNode->GetParam("CanDel") ) == "Yes" ) {
                PointSumm+=11; // 11, т.к.  одно всё равно вычтут ниже :)
                missed = false;
                DestroyFlyingObject( myNode, true );
                break;
                }
    };

};// else CamCountMoved=10; // НЙНП



    if (animate)
    if (missed) {
	PointSumm-=1;  //ничего не нашли, значит не попали мы никуда
	if ( RANDOM(10) <3 ) CamCountMoved=2;
	if (SoundEnabled) SOUND->PlayFX("explos.wav");
	}
    // и это только в режиме игры, а не меню 
};
Ejemplo n.º 20
0
// REAPPLYANIMATION
// Now that we've reparented a node within the hierarchy, re-apply all its animation.
void ReapplyAnimation(INode *node, plSampleVec *samples)
{
    Control *controller = node->GetTMController();

    Control *rotControl = NewDefaultRotationController();   // we set the default rotation controller type above in RemoveBiped()
    Control *posControl = NewDefaultPositionController();   // '' ''
    Control *scaleControl = NewDefaultScaleController();    // '' ''
    
    controller->SetRotationController(rotControl);
    controller->SetPositionController(posControl);
    controller->SetScaleController(scaleControl);

    for(int i = 0; i < samples->size(); i++)
    {
        nodeTMInfo *info = (*samples)[i];
        Matrix3 m = info->fMat3;
        TimeValue t = info->fTime;

#if 1
        node->SetNodeTM(t, m);
#else
        AffineParts parts;

        INode *parent = node->GetParentNode();
        Matrix3 parentTM = parent->GetNodeTM(t);
        Matrix3 invParentTM = Inverse(parentTM);
        m *= invParentTM;

        decomp_affine(m, &parts);

        Quat q(parts.q.x, parts.q.y, parts.q.z, parts.q.w);
        Point3 p(parts.t.x, parts.t.y, parts.t.z);

        rotControl->SetValue(t, q);
        posControl->SetValue(t, p);
#endif
    }

    IKeyControl *posKeyCont = GetKeyControlInterface(posControl);
    IKeyControl *scaleKeyCont = GetKeyControlInterface(scaleControl);

    ReduceKeys<ILinPoint3Key>(node, posKeyCont);
    EliminateScaleKeys(node, scaleKeyCont);
    // grrrr ReduceKeys<ILinScaleKey>(node, scaleKeyCont);
}
Ejemplo n.º 21
0
 FirmwareUpdateTrigger(INode& node, IFirmwareVersionChecker& checker)
     : TimerBase(node)
     , begin_fw_update_client_(node)
     , checker_(checker)
     , node_info_retriever_(UAVCAN_NULLPTR)
     , pending_nodes_(node.getAllocator())
     , request_interval_(MonotonicDuration::fromMSec(DefaultRequestIntervalMs))
     , last_queried_node_id_(0)
 { }
Ejemplo n.º 22
0
const Chunk* FsDirectoryImpl::findChunk(const Long chunkId)
{
    INode* pInode;

    pInode = (INode*)m_pChunkTable->findItem(chunkId);
    //
    //#TODO, pb, 20070808 , it's not suitbal for batch operation, for it seams very slow.
    // so it maybe better to design another interface for batch mode scrutinizing on all chunks
    // in system.
    //
    if(pInode) return (pInode->findChunk(chunkId));

    //pInode = (INode*)m_pNewChunkTable->findItem(chunkId);
    //#TODO, pb, 20070808 , it's not suitbal for batch operation, for it seams very slow.
    //if(pInode) return (pInode->findChunk(chunkId));

    return NULL;
}
Ejemplo n.º 23
0
INode* TiledTileRef::Instantiate(NodeInstantiateInfo* instantiateInfo /*= nullptr*/) const
{
	RETURN_NULL_IF_NULL(mTile);

	TiledMapInstantiateInfo* mapInstantiateInfo = (TiledMapInstantiateInfo*)instantiateInfo;

	INode* node = nullptr;
	const auto* image = mTile->Image();
	if (mapInstantiateInfo != nullptr&&mapInstantiateInfo->OnTileRefInstantiate!=nullptr)
	{
		if (image != nullptr)
		{
			//has separate image
			auto texture = image->LoadSeparateTexture();
			auto renderingObject = RenderingObjectFactory::Instance().CreateFromTexture(texture);
			node = mapInstantiateInfo->OnTileRefInstantiate(*this, renderingObject, mapInstantiateInfo);
		}
		else if (mTile->Region() != nullptr)
		{
			auto renderingObject = RenderingObjectFactory::Instance().CreateFromTextureAtlasRegion(mTile->Region());
			node = mapInstantiateInfo->OnTileRefInstantiate(*this, renderingObject, mapInstantiateInfo);
		}
	}
	else
	{
		if (image != nullptr)
		{
			//has separate image
			auto texture = image->LoadSeparateTexture();
			node = NodeFactory::Instance().CreateSprite(texture);
		}
		else if (mTile->Region() != nullptr)
		{
			node = NodeFactory::Instance().CreateSpriteFromAtlasRegion(mTile->Region());
		}
	}

	if (node != nullptr)
	{
		node->SetUserData((void*)mTile);
	}

	return node;
}
bool CExporter::generateSkinBone(grp::SkinnedMeshExporter* skinnedMesh, INode* node, ISkin* skin)
{
	Matrix3 mSkinOffset;
	if (!skin->GetSkinInitTM(node, mSkinOffset, true))
	{
		setLastError("获取Skin偏移矩阵失败");
		return false;
	}

	int iNumBone = skin->GetNumBones();
	skinnedMesh->m_boneNames.resize(iNumBone);
	skinnedMesh->m_offsetMatrices.resize(iNumBone);
	for (int i = 0; i < iNumBone; ++i)
	{
		//mbs only
		INode* pBone = skin->GetBone(i);
		if (NULL == pBone)
		{
			setLastError("找不到skin依赖的骨骼");
			return false;
		}
		if (ENUM_NODE_DUMMY == checkNodeType(pBone))
		{
			char szError[1024];
			::StringCchPrintf(szError, sizeof(szError), "发现绑定到虚拟体[%s]的顶点", pBone->GetName());
			setLastError(szError);
			return false;
		}

		wchar_t unicodeString[256];
		mbstowcs(unicodeString, pBone->GetName(), 255);
		skinnedMesh->m_boneNames[i] = unicodeString;

		Matrix3 mBoneOffset;
		skin->GetBoneInitTM(pBone, mBoneOffset);
		mBoneOffset.Invert();
		Matrix3 meshOffset = node->GetObjectTM(0);
		mBoneOffset = meshOffset * mBoneOffset;
		//mBoneOffset = mSkinOffset * mBoneOffset;
		grp::Matrix& mCore = skinnedMesh->m_offsetMatrices[i];
		::MatrixFromMatrix3(mCore, mBoneOffset);
	}
	return true;
}
Ejemplo n.º 25
0
void
APITestUtil::COSTests()
{
	// now let's build a test object
	NURBSSet nset;
	Matrix3 mat;
	mat.IdentityMatrix();

	// build a cv surface
	int cvSurf = MakeTestCVSurface(nset, mat);

	// Now an Iso Curve on the CV surface
	int isoCrv1 = MakeTestIsoCurveU(nset, cvSurf);

	// Now an Iso Curve on the CV surface
	int isoCrv2 = MakeTestIsoCurveV(nset, cvSurf);

	// build a CV Curve on Surface
	int cvCOS = MakeTestCurveOnSurface(nset, cvSurf);

	// build a Point Curve on Surface
	int pntCOS = MakeTestPointCurveOnSurface(nset, cvSurf);

	// build a Surface Normal Offset Curve
	int cnoCrf = MakeTestSurfaceNormalCurve(nset, cvCOS);

	// build a surface surface intersection curve
	int cvSurf1 = MakeTestCVSurface(nset, TransMatrix(Point3(0.0, 0.0, -30.0)) * RotateYMatrix(0.5));
	int intCrv = MakeTestSurfSurfIntersectionCurve(nset, cvSurf, cvSurf1);

	// Vector Projection Curve
	int cvCrv1 = MakeTestCVCurve(nset, TransMatrix(Point3(-100, -200, 40)));
	int vecCrv = MakeTestProjectVectorCurve(nset, cvSurf, cvCrv1);

	// Normal Normal Curve
	int cvCrv2 = MakeTestCVCurve(nset, TransMatrix(Point3(0, -250, 10)));
	int nrmCrv = MakeTestProjectNormalCurve(nset, cvSurf1, cvCrv2);


	Object *obj = CreateNURBSObject(mpIp, &nset, mat);
	INode *node = mpIp->CreateObjectNode(obj);
	node->SetName(GetString(IDS_COS_TEST_OBJECT));
	mpIp->RedrawViews(mpIp->GetTime());
}
Ejemplo n.º 26
0
BOOL
ProxSensorObjPick::Pick(IObjParam *ip,ViewExp *vpt)
{
    if ( ! vpt || ! vpt->IsAlive() )
		{
			// why are we here?
			DbgAssert(!"Doing Pick() on invalid view port!");
			return FALSE;
		}
		

		if (vpt->HitCount() == 0)
        return FALSE;

    INode *node;
    if ((node = vpt->GetClosestHit()) != NULL) {
        // Check to see if we have a reference to this object already
        for (int i = 0; i < proxSensor->objects.Count(); i++) {
            if (proxSensor->objects[i]->node == node)
                return FALSE; // Can't click those we already have
        }

		// Don't allow a loop.  001129  --prs.
		if (node->TestForLoop(FOREVER, proxSensor) != REF_SUCCEED)
			return FALSE;

        ProxSensorObj *obj = new ProxSensorObj();
        int id = proxSensor->objects.Append(1, &obj);
        proxSensor->pblock->SetValue(PB_PS_NUMOBJS,
                                     proxSensor->iObjParams->GetTime(),
                                     proxSensor->objects.Count());

        RefResult ret = proxSensor->ReplaceReference( id+1, node);

        HWND hw = proxSensor->hRollup;
        int ind = SendMessage(GetDlgItem(hw,IDC_LIST),
                              LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)obj->listStr.data());
        SendMessage(GetDlgItem(hw,IDC_LIST),
                    LB_SETITEMDATA, (WPARAM)ind, (LPARAM)obj);
        EnableWindow(GetDlgItem(hw, IDC_DEL),
                     proxSensor->objects.Count() > 0);
    }
    return FALSE;
}
Ejemplo n.º 27
0
BOOL BlobMeshValidatorClass::Validate(PB2Value &v)
{
	INode *node = (INode*) v.r;

	for (int i = 0; i < mod->pblock2->Count(pb_nodelist); i++)
	{
		if (node == mod->pblock2->GetINode(pb_nodelist, 0, i))
			return FALSE;
	}

	node->BeginDependencyTest();
	mod->NotifyDependents(FOREVER,0,REFMSG_TEST_DEPENDENCY);
	if (node->EndDependencyTest()) 
	{     
		return FALSE;
	} 

	return TRUE;
}
Ejemplo n.º 28
0
	BOOL Validate(PB2Value &v) 
	{
		INode *node = (INode*) v.r;
		if (node->TestForLoop(FOREVER,(ReferenceMaker *) mod)!=REF_SUCCEED) return FALSE;

		ObjectState os = node->EvalWorldState(0);
		//Allow only tri object derived objects
		if (os.obj->CanConvertToType(triObjectClassID)  && os.obj->SuperClassID() != SHAPE_CLASS_ID) {			
			return TRUE;
		}
		// and out objects which support the RigidBodyInterface
		//if (os.obj->SuperClassID() == HELPER_CLASS_ID && NULL != GetInterface(BHKRIGIDBODYINTERFACE_DESC)) {
		//   return TRUE;
		//}
		if (os.obj->SuperClassID() == HELPER_CLASS_ID && os.obj->ClassID().PartB() == BHKRIGIDBODYCLASS_DESC.PartB() ) {
			return TRUE;
		}
		return FALSE;
	};
Ejemplo n.º 29
0
int LogMsgChildReceiverThread::run()
{
    INode * sender;
    char ctrl;
    while(!done)
    {
        try
        {
            if(queryWorldCommunicator().recv(in, 0, MPTAG_JLOG_CONNECT_TO_PARENT, &sender))
            {
                in.read(ctrl);
                if(ctrl=='A')
                {
                    MPLogId pid;
                    in.read(pid);
                    MPLogId cid = addChildToManager(pid, sender, false, true);
                    StringBuffer buff;
                    in.clear().append(cid);
                    queryWorldCommunicator().reply(in, MP_ASYNC_SEND);
                }
                else if(ctrl=='D')
                {
                    MPLogId cid;
                    in.read(cid);
                    removeChildFromManager(cid, true);
                }
                else
                    ERRLOG("LogMsgChildReceiverThread::run() : unknown control character on received message");
                if(sender) sender->Release();
            }
        }
        catch(IException * e)
        {
            EXCLOG(e, "LogMsgChildReceiverThread::run()");
            e->Release();
        }
        catch(...)
        {
            ERRLOG("LogMsgChildReceiverThread::run() : unknown exception");
        }
    }
    return 0;
}
Ejemplo n.º 30
0
/** Copy constructor */
INode::INode(INode & node):TreeNode < INode, GNode > (node)
{
  sNode_ = 0;
  sNode(node.sNode());
  execState(node.execState());
  status(node.status());
  childList_ = node.childList_;
  childcount_ = node.childcount_;
  aktivcount_ = node.aktivcount_;
  ordercount_ = node.ordercount_;
  aktivorder_ = node.aktivorder_;
  truncation_ = node.truncation_;
  analysis_ = node.analysis_;
  output_ = node.output_;
  if (node.labelImage_)
    labelImage_ = node.labelImage_->shallowCopy();
  else
    labelImage_ = 0;
}