Beispiel #1
0
void ZenFWRenderer::PrivateInit(const INITPARAMS& RendererInitParams)
{
	// Sound
	_New(ZSoundManager);
	mSoundRenderer = GSoundManager;
	//
	mAtmosphere.Attach((ZAtmosphere*)_New(ZAtmosphere));

	mCam = (ZCamera*)_New(ZCamera);
	mCam->SetActive();
	tmatrix tmpmat;
	tmpmat.LookAt(tvector3(150, 340, 300), tvector3(0, 0, 0)/*::zero*/, tvector3::YAxis);
	mCam->GetTransform()->SetLocalMatrix(tmpmat);
	mCam->Update();

	mCam->SetVFov(75.f*3.14159f / 180.f);
	mCam->SetPlanes(0.1f, 3000.0f);
	mCam->SetRatio( float(RendererInitParams.width)/float(RendererInitParams.height));

	InitCEGui();

	
	// GUI
	mProtoGui = (IProtoGUI*)_New(ZProtoGUI);
}
bool CGizmoTransformRotate::GetOpType(ROTATETYPE &type, unsigned int x, unsigned int y)
{
    tvector3 rayOrigin,rayDir, axis;
    tvector3 dir = m_pMatrix->GetTranslation()-m_CamSrc;
    dir.Normalize();

    BuildRay(x, y, rayOrigin, rayDir);

    if (mMask&AXIS_TRACKBALL)
        if (CheckRotatePlan(dir,1.0f,rayOrigin,rayDir,-1))
        {
            tmatrix mt = *m_pMatrix;
            mt.NoTrans();
            //mt.Inverse();
            //m_Axis = m_Axis2 = dir;
            m_Axis.TransformPoint(mt);
            /*
            m_Axis *=tvector3(GetTransformedVector(0).Length(),
            GetTransformedVector(1).Length(),
            GetTransformedVector(2).Length());
            */
            type = ROTATE_TWIN;
            return true;
        }

        // plan 1 : X/Z
        m_Axis = GetTransformedVector(0);
        if (mMask&AXIS_X)
            if (CheckRotatePlan(m_Axis,1.0f,rayOrigin,rayDir,0)) { type = ROTATE_X; return true; }
            m_Axis = GetTransformedVector(1);
            if (mMask&AXIS_Y)
                if (CheckRotatePlan(m_Axis,1.0f,rayOrigin,rayDir,1)) { type = ROTATE_Y; return true; }
                m_Axis = GetTransformedVector(2);
                if (mMask&AXIS_Z)
                    if (CheckRotatePlan(m_Axis,1.0f,rayOrigin,rayDir,2)) { type = ROTATE_Z; return true; }

                    //m_Axis = GetTransformedVector(dir);
                    if (mMask&AXIS_SCREEN)
                        if (CheckRotatePlan(dir,1.2f,rayOrigin,rayDir,-1))
                        {
                            tmatrix mt = *m_pMatrix;
                            mt.NoTrans();
                            mt.Inverse();
                            m_Axis = m_Axis2 = dir;
                            m_Axis.TransformPoint(mt);

                            m_Axis *=tvector3(GetTransformedVector(0).Length(),
                                GetTransformedVector(1).Length(),
                                GetTransformedVector(2).Length());

                            type = ROTATE_SCREEN;
                            return true;
                        }

                        type = ROTATE_NONE;

                        return false;
}
Beispiel #3
0
void GuiProgress::Tick()
{
	if (mLoadingRect)
	{
		float tmell = gTimer.GetEllapsed();
		float cs = 0.005f * tmell;

		ZTransform *trans = mLoadingRect->GetTransform();

		trans->PreScale(tvector3(1+cs*2,1+cs*2,1));
		trans->PostTranslate(tvector3(-cs,-cs,0));
		trans->Update();

		// loading anim
		static int loadinganimidx = 0;
		static float anmdlaid = 0.f;
		char tmps[512];
		snprintf(tmps, 512, "set:LoadingAnim%02d image:full_image", loadinganimidx);
		anmdlaid+=gTimer.GetEllapsed();
		if (anmdlaid >0.125f)
		{
			loadinganimidx++;
			loadinganimidx&=0xF;
			anmdlaid = 0.f;
		}
		/*
		float a1 = winMgr.getWindow("backuniform")->getAlpha() + cs*10.f;
		a1 = Clamp(a1,0,1.f);
		float a2 = winMgr.getWindow("LOADING_wnd")->getAlpha() + cs*10.f;
		a2 = Clamp(a2,0,1.f);

		winMgr.getWindow("backuniform")->setAlpha( a1 );
		winMgr.getWindow("LOADING_wnd")->setAlpha( a2 );
		*/

		winMgr.getWindow("loadingAnimWnd")->setProperty("Image", tmps);

	}
}
void CGizmoTransformMove::OnMouseMove(unsigned int x, unsigned int y)
{
	if (m_MoveType != MOVE_NONE)
	{
		tvector3 rayOrigin,rayDir,df, inters;

		BuildRay(x, y, rayOrigin, rayDir);
		m_plan.RayInter(inters,rayOrigin,rayDir);

		tvector3 axeX(1,0,0),axeY(0,1,0),axeZ(0,0,1);


        if (mLocation == LOCATE_LOCAL)
        {
            axeX.TransformVector(*m_pMatrix);
		    axeY.TransformVector(*m_pMatrix);
		    axeZ.TransformVector(*m_pMatrix);
		    axeX.Normalize();
		    axeY.Normalize();
		    axeZ.Normalize();
        }

        df = inters - m_LockVertex;

		switch (m_MoveType)
		{
        case MOVE_XZ:	df = tvector3(df.Dot(axeX) , 0,df.Dot(axeZ));		break;
		case MOVE_X:	df = tvector3(df.Dot(axeX) , 0,0);							break;
		case MOVE_Z:	df = tvector3(0, 0,df.Dot(axeZ));							break;
		case MOVE_XY:	df = tvector3(df.Dot(axeX) ,df.Dot(axeY), 0);		break;
		case MOVE_YZ:	df = tvector3(0,df.Dot(axeY) ,df.Dot(axeZ));		break;
		case MOVE_Y:	df = tvector3(0,df.Dot(axeY), 0);							break;
		}

        tvector3 adf;

		tmatrix mt;
		if (m_bUseSnap)
		{
			SnapIt(df.x,m_MoveSnap.x);
			SnapIt(df.y,m_MoveSnap.y);
			SnapIt(df.z,m_MoveSnap.z);
		}

        adf = df.x*axeX + df.y*axeY + df.z*axeZ;

		mt.Translation(adf);
		*m_pMatrix = m_svgMatrix;
		m_pMatrix->Multiply(mt);
        //if (mTransform) mTransform->Update();

        if (mEditPos)
            *mEditPos = m_pMatrix->V4.position;
	}
	else
	{
		// predict move
		if (m_pMatrix)
		{
			GetOpType(m_MoveTypePredict, x, y);
		}
	}

}
void CGizmoTransformScale::OnMouseMove(unsigned int x, unsigned int y)
{
	if (m_ScaleType != SCALE_NONE)
	{
		tvector3 rayOrigin,rayDir,df, inters, machin;
		tvector3 scVect,scVect2;

		BuildRay(x, y, rayOrigin, rayDir);
		m_plan.RayInter(inters,rayOrigin,rayDir);

		switch (m_ScaleType)
		{
		case SCALE_XZ: scVect = tvector3(1,0,1); break;
		case SCALE_X:  scVect = tvector3(1,0,0); break;
		case SCALE_Z:  scVect = tvector3(0,0,1); break;
		case SCALE_XY: scVect = tvector3(1,1,0); break;
		case SCALE_YZ: scVect = tvector3(0,1,1); break;
		case SCALE_Y:  scVect = tvector3(0,1,0); break;
		case SCALE_XYZ:scVect = tvector3(1,1,1); break;
		}

		df = inters-m_pMatrix->GetTranslation();
		df/=GetScreenFactor();
		scVect2 = tvector3(1,1,1) - scVect;

		if (m_ScaleType == SCALE_XYZ)
		{
			int difx = x - m_LockX;
			float lng2 = 1.0f + ( float(difx) / 200.0f);
			SnapScale(lng2);
			scVect *=lng2;
		}
		else
		{
			float lng2 = ( df.Dot(m_LockVertex)/ m_Lng);
			if (lng2 < 1)
			{
				if (lng2<=-4)
					lng2 = 0.001f;
				else
				{
					lng2+=4;
					lng2/=5;
				}
			}
			SnapScale(lng2);
			scVect *= lng2;
			scVect += scVect2;
		}


		tmatrix mt,mt2;



		mt.Scaling(scVect);

        mt2.Identity();
		mt2.SetLine(0,GetTransformedVector(0));
		mt2.SetLine(1,GetTransformedVector(1));
		mt2.SetLine(2,GetTransformedVector(2));

		//mt2.Translation(0,0,0);
		//mt.Multiply(mt2);

        if (mLocation == LOCATE_WORLD)
        {
            mt2 = m_svgMatrix * mt;
        }
        else
        {
		    mt2 = mt * m_svgMatrix;//.Multiply(m_svgMatrix);
        }
		*m_pMatrix = mt2;
        //if (mTransform) mTransform->Update();
	}
	else
	{
		// predict move
		if (m_pMatrix)
		{
			GetOpType(m_ScaleTypePredict, x, y);
		}
	}

}
void CGizmoTransformScale::OnMouseMove(unsigned int x, unsigned int y)
{
  if (m_ScaleType != SCALE_NONE)
  {
    tvector3 rayOrigin,rayDir,df, inters, machin;
    tvector3 scVect,scVect2;

    BuildRay(x, y, rayOrigin, rayDir);
    m_plan.RayInter(inters,rayOrigin,rayDir);

    switch (m_ScaleType)
    {
    case SCALE_XZ: scVect = tvector3(1,0,1); break;
    case SCALE_X:  scVect = tvector3(1,0,0); break;
    case SCALE_Z:  scVect = tvector3(0,0,1); break;
    case SCALE_XY: scVect = tvector3(1,1,0); break;
    case SCALE_YZ: scVect = tvector3(0,1,1); break;
    case SCALE_Y:  scVect = tvector3(0,1,0); break;
    case SCALE_XYZ:scVect = tvector3(1,1,1); break;
    }

    df = inters-m_pMatrix->GetTranslation();
    df/=GetScreenFactor();
    scVect2 = tvector3(1,1,1) - scVect;

    if (m_ScaleType == SCALE_XYZ)
    {
      int difx = x - m_LockX;
      float lng2 = 1.0f + ( float(difx) / 200.0f);
      SnapScale(lng2);
      scVect *=lng2;
    }
    else
    {
      int difx = x - m_LockX;
      int dify = y - m_LockY;

      float len = sqrtf( (float)(difx*difx) + (float)(dify*dify) );

      float lng2 = len /100.f;

      SnapScale(lng2);
      scVect *= lng2;
      scVect += scVect2;
    }


    tmatrix mt,mt2;



    mt.Scaling(scVect);

    mt2.Identity();
    mt2.SetLine(0,GetTransformedVector(0));
    mt2.SetLine(1,GetTransformedVector(1));
    mt2.SetLine(2,GetTransformedVector(2));


    if (mLocation == LOCATE_WORLD)
    {
      mt2 = mt * m_svgMatrix;
    }
    else
    {
      mt2 = mt * m_svgMatrix;//.Multiply(m_svgMatrix);
    }
    *m_pMatrix = mt2;

  }
  else
  {
    // predict move
    if (m_pMatrix)
    {
      GetOpType(m_ScaleTypePredict, x, y);
    }
  }

}
Beispiel #7
0
	tvector3			operator- (const tvector3& _vec3) const { return tvector3(x - _vec3.x, y - _vec3.y, z - _vec3.z); } 
Beispiel #8
0
	//tvector3			operator+ (const tvector3& _vec3) { return tvector3(x + _vec3.x, y + _vec3.y, z + _vec3.z); }
	tvector3			operator- () { return tvector3(-x, -y, -z); }
Beispiel #9
0
	tvector3			operator+ (const tvector3& _vec3) const { return tvector3(x + _vec3.x, y + _vec3.y, z + _vec3.z); }
Beispiel #10
0
	tvector3 cross(tvector3& _vec3) { return tvector3(-z*_vec3.y+y*_vec3.z, z*_vec3.x-x*_vec3.z, -y*_vec3.x+x*_vec3.y); }
void CGizmoTransformRotate::OnMouseMove(unsigned int x, unsigned int y)
{
    tvector3 rayOrigin, rayDir, axis;

    BuildRay(x, y, rayOrigin, rayDir);

    if (m_RotateType != ROTATE_NONE)
    {
        if (m_RotateType == ROTATE_TWIN)
        {
            tvector3 inters;
            tvector3 dir = m_pMatrix->GetTranslation()-m_CamSrc;
            dir.Normalize();

            m_plan=vector4(m_pMatrix->GetTranslation(), dir);
            m_plan.RayInter(inters,rayOrigin,rayDir);
            ptd = inters;
            tvector3 df = inters - m_pMatrix->GetTranslation();
            df/=GetScreenFactor();
            float lng1 = df.Length();
            if (lng1 >= 1.0f) lng1 = 0.9f;

            float height = (float)sin(acos(lng1));
            tvector3 m_CamRealUp,camRight;
            camRight.Cross(m_Axis,m_CamUp);
            m_CamRealUp.Cross(camRight,dir);

            tvector3 idt = height*dir;
            idt+=df;

            //ptd = idt;
            idt= m_LockVertex-idt;

            tmatrix mt,mt2;

            mt.LookAtLH(tvector3(0,0,0),idt,m_CamRealUp);
            mt.Multiply(m_InvOrigScale);
            mt.Multiply(m_svgMatrix);
            mt2 = m_OrigScale;
            mt2.Multiply(mt);
            *m_pMatrix=mt2;
            /*
            if (mEditQT)
            {
            *mEditQT = tquaternion(mt2);
            }
            */
        }
        else
        {
            Rotate1Axe(rayOrigin, rayDir);

        }

        //if (mTransform) mTransform->Update();
    }
    else
    {
        // predict move
        if (m_pMatrix)
        {
            GetOpType(m_RotateTypePredict, x, y);
        }
    }
}
Beispiel #12
0
int PreprocessOccluders(const tmatrix &invCameraMat)
{
	if (!GetInstancesCount(ZOccluderBox))
		return 0;

	PROFILER_START(PreprocessOccluders);

	tvector3 campos = invCameraMat.V4.position;
	tvector3 camdir = invCameraMat.V4.dir;

	FActiveOccluder* pActiveOccluder = &gActiveOccluders[0]; 
    tvector4 viewPoint = vector4(campos.x, campos.y, campos.z, 0);
    tvector4 viewDir = vector4(camdir.x, camdir.y, camdir.z, 0);
	float sqrFar = 1000.0f * 1000.0f;
	float sqrDist;
	int i;

	gNbActiveOccluders = 0;
	gOccluderBoxes.clear();

	ZOccluderBox *pocc = (ZOccluderBox*)FirstInstanceOf(ZOccluderBox);
	while (pocc)
	{
		addDynamicOccluder(pocc->GetTransform());

		pocc = (ZOccluderBox*)NI(pocc);
	}

    
    for (unsigned int ju = 0;ju<gOccluderBoxes.size(); ju++)
	{
		// todo : frustum culling of the  occluder (except far plane)
		// todo : compute solid angle to reorder occluder accordingly
		FOccluderBox *obox = &gOccluderBoxes[ju];

         //= oboxiter.Get();
		// check for far plane
		const tvector3 &oboxcenter = obox->mCenter;//pocc->GetTransform()->GetWorldMatrix().position;
		sqrDist= SquaredDistance(viewPoint, oboxcenter);
		if (sqrDist > sqrFar)
		{
			continue;
		}

		// check for near plane
		if (DotProduct(tvector3(viewDir), tvector3(oboxcenter - viewPoint)) < 0.0f)
		{
			continue;
		}

		// select planes of the occluder box that lies on the viewing direction
		// todo : reduce to 3 planes instead of 6 (due to box symetry)
		float invSqrDist = 1.0f/sqrDist;//Rcp(sqrDist);

		pActiveOccluder->mSolidAngle = 0.0f;

		BoxSilhouette	silhouette;

		silhouette.vertices = &obox->mVertex[0];

		for (i=0; i<6; i++)
		{
			tvector4 dir= obox->mVertex[FaceVertexIndex[i][0]];
			dir -= viewPoint;
			float vdotp = silhouette.dots[i] = DotProduct(obox->mPlanes[i], dir);

			// compute the maximum solidAngle of the box : -area * v.p/d.d
			pActiveOccluder->mSolidAngle = Max(-obox->mVertex[i].w * vdotp * invSqrDist, pActiveOccluder->mSolidAngle);

		}

		// exit if the occluder is not relevant enough
		if (pActiveOccluder->mSolidAngle < gMinSolidAngle)
			continue;


		int	  nPlanes = 0;
		tvector4*	pPlanes = &pActiveOccluder->mPlanes[0];

		// find silhouette
		tvector4		vertices[12];
        int			nVertices = silhouette.findSilhouette(vertices);

		// create a plane with a edge of the occluder and the viewpoint
        
		for (i=0; i<nVertices; i+=2)
		{
            //tplane plan(campos, vertices[i], vertices[i+1]);
            
			tvector3	v1 = vertices[i];
			v1 -= viewPoint;
			tvector3	v2 = vertices[i+1];
			v2 -= viewPoint;

            v1.Normalize();
            v2.Normalize();
			*pPlanes = CrossProduct(v1, v2);
			pPlanes->Normalize();
			
			pPlanes->w = - DotProduct(*pPlanes, vertices[i]);

			pPlanes++;
			nPlanes ++;

		}
    
		if (gAddNearPlane)
		{
			for (int i=0; i<6; i++)
			{
				if (silhouette.dots[i] < 0.0f)
				{
					pActiveOccluder->mPlanes[nPlanes] = obox->mPlanes[i];
					nPlanes++;
				}
			}
		}
        
		pActiveOccluder->mNbPlanes = nPlanes;

		pActiveOccluder++;
		gNbActiveOccluders++;

		if (gNbActiveOccluders >= gMaxCandidateOccluders)
			break;
		
	}
	

	if (gNbActiveOccluders)
	{
		qsort(gActiveOccluders, gNbActiveOccluders, sizeof(FActiveOccluder), compareOccluder);
		if (gNbActiveOccluders > gMaxActiveOccluders)
			gNbActiveOccluders = gMaxActiveOccluders;
	}

	PROFILER_END();
	return gNbActiveOccluders;
}
Beispiel #13
0
	tvector4	mVertex[8];
	tvector4	mPlanes[6];
};

struct FActiveOccluder
{
	float	mSolidAngle;
	int	    mNbPlanes;
	float	mPad1;
	float	mPad2;
	tvector4	mPlanes[9];
};

static	tvector3 BoxCorners[8] =
{
	tvector3(1.f, -1.f, -1.f),
	tvector3(-1.f, -1.f, -1.f),
	tvector3(-1.f, 1.f, -1.f),
	tvector3(1.f, 1.f, -1.f),
	tvector3(-1.f, -1.f, 1.f),
	tvector3(1.f, -1.f, 1.f),
	tvector3(1.f, 1.f, 1.f),
	tvector3(-1.f, 1.f, 1.f),
};


struct Edge
{
	int vertex[2];
	int face;
};
void CGizmoTransformScale::OnMouseMove(unsigned int x, unsigned int y)
{
	if (m_ScaleType != SCALE_NONE)
	{
		tvector3 rayOrigin,rayDir,df, inters, machin;
		tvector3 scVect,scVect2;

		BuildRay(x, y, rayOrigin, rayDir);
		m_plan.RayInter(inters,rayOrigin,rayDir);

		switch (m_ScaleType)
		{
		case SCALE_XZ: scVect = tvector3(1,0,1); break;
		case SCALE_X:  scVect = tvector3(1,0,0); break;
		case SCALE_Z:  scVect = tvector3(0,0,1); break;
		case SCALE_XY: scVect = tvector3(1,1,0); break;
		case SCALE_YZ: scVect = tvector3(0,1,1); break;
		case SCALE_Y:  scVect = tvector3(0,1,0); break;
		case SCALE_XYZ:scVect = tvector3(1,1,1); break;
		}

		df = inters-m_pMatrix->GetTranslation();
		df/=GetScreenFactor();
		scVect2 = tvector3(1,1,1) - scVect;

		if (m_ScaleType == SCALE_XYZ)
		{
			int difx = x - m_LockX;
			float lng2 = 1.0f + ( float(difx) / 200.0f);
			SnapScale(lng2);
			scVect *=lng2;
		}
		else
		{
            int difx = x - m_LockX;
            int dify = y - m_LockY;

            float len = sqrtf( (float)(difx*difx) + (float)(dify*dify) );

            float lng2 = len /100.f;
            /*
			float lng2 = ( df.Dot(m_LockVertex));
            char tmps[512];
            sprintf(tmps, "%5.4f\n", lng2 );
            OutputDebugStringA( tmps );


			if (lng2 < 1.f)
			{
				if ( lng2<= 0.001f )
					lng2 = 0.001f;
				else
				{
					//lng2+=4.f;
					lng2/=5.f;
				}
			}
            else
            {
                int a = 1;
            }
            */
			SnapScale(lng2);
			scVect *= lng2;
			scVect += scVect2;
		}


		tmatrix mt,mt2;



		mt.Scaling(scVect);

        mt2.Identity();
		mt2.SetLine(0,GetTransformedVector(0));
		mt2.SetLine(1,GetTransformedVector(1));
		mt2.SetLine(2,GetTransformedVector(2));

		//mt2.Translation(0,0,0);
		//mt.Multiply(mt2);

        if (mLocation == LOCATE_WORLD)
        {
            mt2 = mt * m_svgMatrix;
        }
        else
        {
		    mt2 = mt * m_svgMatrix;//.Multiply(m_svgMatrix);
        }
		*m_pMatrix = mt2;
        //if (mTransform) mTransform->Update();
	}
	else
	{
		// predict move
		if (m_pMatrix)
		{
			GetOpType(m_ScaleTypePredict, x, y);
		}
	}

}
Beispiel #15
0
void ZTransform::Update()
{


	this->ComputeWorldMatrix();
	// --


	// compute world bounding sphere

	if (mSpatialEntity.ptr())
	{
		// bounds computation
		ZBoundingVolume tmpb; // mesh
		//tmpb.SetBoxMinMax(tvector3(-1,-1,-1), tvector3(1,1,1));
		if (mSpatialEntity->GetClassID() == ClassIDZMeshInstance)
		{
			ZMeshInstance *pmi = (ZMeshInstance*)mSpatialEntity->QueryInstance();
			ZMesh *pMesh = pmi->GetMesh();
			tmpb = pMesh->GetBVolume();
			if (pmi->GetPhysicTriMeshInstance())
			{
				pmi->GetPhysicTriMeshInstance()->SetMatrix(mWorldMatrix);
			}
		}
		else if (mSpatialEntity->GetClassID() == ClassIDZTrigger)
		{
			tmpb = ((ZTrigger*)mSpatialEntity->QueryInstance())->GetOriginVolume();
		}
#if 0
		else if (mSpatialEntity->GetClassID() == ClassIDZOccluderBox)
		{
			tmpb.SetBoxMinMax(tvector3(-1,-1,-1), tvector3(1,1,1));
			tmpb.ComputeBSphereFromBoxMinMax();
		}
		else if (mSpatialEntity->GetClassID() == ClassIDZLight)
		{
			ILight *pLight = (ILight*)mSpatialEntity->QueryInstance();
			if ( pLight->GetLightType() == LT_POINTLIGHT)
			{
				tmpb.SetBoxMinMax(tvector3(-0.5f,-0.5f,-0.5f)*pLight->GetRadius(), tvector3(0.5f,0.5f,0.5f)*pLight->GetRadius());
				tmpb.mBSphere = vector4(0,0,0, pLight->GetRadius());
			}
			else
			{
				float valsp1 = pLight->GetLength()*pLight->GetSpotAngle2();
				//float spng = pLight->GetSpotAngle2();
				tmpb.SetBoxMinMax(tvector3(-0.5f,-0.5f,0)*valsp1, tvector3(0.5f*valsp1,0.5f*valsp1,pLight->GetLength()));
				tmpb.ComputeBSphereFromBoxMinMax();
			}
		}
#endif
		tvector3 mBounds[8];
		tmpb.Build8CornersBox(mBounds);
		for (int i=0;i<8;i++)
			mBounds[i].TransformPoint(mWorldMatrix);

		tmpb.SetMinMaxFromCorners((unsigned char*)mBounds, sizeof(tvector3), 8);
		//tmpb.ComputeBSphereFromBoxMinMax();
		tmpb.TransformBSphere(tmpb.GetBSphere(), mWorldMatrix);
		mSpatialEntity->GetBVolume() = tmpb;

		//mSpatialEntity->SetWorldBSphere(tvector4(mWorldMatrix.position, 1));

	}
	// update childs
	if (mSpatialEntity.ptr())
	{
		if (mScene)
		{
			if (!mScene->ClearAsked())
				mScene->AddSEJobChangeMatrix(mSpatialEntity, mWorldMatrix);
		}
		else
		{
			if (!GScene->ClearAsked())
				GScene->AddSEJobChangeMatrixNoSceneInsertion(mSpatialEntity, mWorldMatrix);
		}
	}

	// update childs
	std::list<smartptr<ZTransform> >::iterator iter = mChilds.begin();
	for (; iter != mChilds.end(); ++iter)
	{
		(*iter)->Update();
	}
}