示例#1
0
void CBoxHolder::Serialize(CArchive &ar)
{
	CBox* box=NULL;
	int n;
	CString st;
	CObject::Serialize(ar);
	if (ar.IsStoring()){
		n=m_Children.GetSize();
		ar << n;
		for (int i=0; i<n; i++){
			box=GetBox(i);
			st=box->Signature();
			if (st=="")
				st=box->ClassName();
			TRACE("Serialize Class Name: %s\n", st);
			ar << st;
			box->Serialize(ar);
		}
	}
	else{
		ar >> n;
		for (int i=0; i<n; i++){
			ar >> st;
			box=CFactory::instance(st);
			if (box==NULL)
				AfxThrowArchiveException(CArchiveException::generic,"");
			box->Serialize(ar);
			AddBox(box);
		}
	}
}
void
avtMultiResolutionPartitionStrategy::FindBoxes(int level, int cell)
{
    int  i;

    RegionDescription &rd = reg_desc[level][cell];
    if (rd.allOn)
    {
        int extents[6];
        GetExtents(level, cell, extents);
        AddBox(extents);
    }
    else if (rd.someOn)
    {
        // Note: assume level > 0, because level 0 cells are always all on 
        // or all off.
        int subcells[8];
        GetSubCells(level, cell, subcells);
        bool allOn[8];
        bool someOn[8];
        for (i = 0 ; i < 8 ; i++)
        {
            allOn[i]  = reg_desc[level-1][subcells[i]].allOn;
            someOn[i] = reg_desc[level-1][subcells[i]].someOn;
        }

        SearchFor2x2Box(allOn, someOn, level-1, subcells);
        SearchFor2x1Line(allOn, someOn, level-1, subcells);
        for (i = 0 ; i < 8 ; i++)
        {
            if (someOn[i])
                FindBoxes(level-1, subcells[i]);
        }
    }
}
示例#3
0
bool CSequenceDiagram::AddExecution(lifeLine_h lifeLine, double x1, double x2, unsigned int row, char* label_p, unsigned char labelLength, int colorRGB)
{
  GraphicalObject_LifeLine_Box_t* lifeLine_p = (GraphicalObject_LifeLine_Box_t*)lifeLine;

  AddBox(x1, lifeLine_p->y_execBottom, x2, lifeLine_p->y_execTop, row, label_p, labelLength, colorRGB);

  return true;
}
示例#4
0
int CHomePanel::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if ( CTaskPanel::OnCreate( lpCreateStruct ) == -1 ) return -1;

	m_boxConnection.Create( this, _T("Connection"), IDR_NEIGHBOURSFRAME );
	m_boxLibrary.Create( this, _T("Library"), IDR_LIBRARYFRAME );
	m_boxDownloads.Create( this, _T("Downloads"), IDR_DOWNLOADSFRAME );
	m_boxUploads.Create( this, _T("Uploads"), IDR_UPLOADSFRAME );

	AddBox( &m_boxConnection );
	AddBox( &m_boxLibrary );
	AddBox( &m_boxDownloads );
	AddBox( &m_boxUploads );
	// SetStretchBox( &m_boxLibrary );

	return 0;
}
示例#5
0
//------------------------------------------------------------------------
void CParachute::PhysicalizeCanvas(bool enable)
{
    IEntity* pCanvas = m_pEntitySystem->GetEntity(m_canvasId);
    if (!pCanvas)
        return;

    if (enable)
    {
        SEntityPhysicalizeParams params;
        params.type = PE_RIGID;
        params.mass = 0;
        pCanvas->Physicalize(params);

        IPhysicalEntity* pPhysics = pCanvas->GetPhysics();
        if (!pPhysics)
            return;

        // add parachute physics geometry
        m_paraPhysIds.clear();
        m_paraPhysIds.resize(8);

        for(int iCel=0; iCel<7; iCel++)
        {
            SWing *pCel = &m_aCels[iCel];

            m_paraPhysIds.push_back( AddCel(pPhysics, iCel+1, pCel) );

            pCel->fSurface = pCel->vSize.x * pCel->vSize.y;

            pCel->pLiftPointsMap = &m_LiftPointsMap;
            pCel->pDragPointsMap = &m_DragPointsMap;
        }
        Vec3 minExt(0.0f,0.0f,0.95f), maxExt(0.5f,0.3f,1.9f);
        m_paraPhysIds.push_back( AddBox(&minExt, &maxExt, 70.0f) );

        pe_params_part pp;
        pp.partid = m_paraPhysIds.back();
        pp.flagsAND = ~(geom_collides);
        pPhysics->SetParams(&pp);

        pe_status_dynamics stats;
        pPhysics->GetStatus(&stats);
        CryLog("Parachute mass: %f", stats.mass);
    }
    else
    {
        IPhysicalEntity* pPhysics = pCanvas->GetPhysics();
        if (pPhysics)
        {
            // remove parachute geometry
            for (std::vector<int>::iterator it = m_paraPhysIds.begin(); it != m_paraPhysIds.end(); ++it)
            {
                pPhysics->RemoveGeometry(*it);
            }
        }
        m_paraPhysIds.clear();
    }
}
示例#6
0
void CEffectsGame::CreateBoxesScene()
{
	float size = 60;

	// floor
	NewtonBody *bFloor = AddBox(pScene, pWorld, Vector3(0,-1,0), Vector3(10000,1,10000), Vector3());	
	NewtonBody *bCeiling = AddBox(pScene, pWorld, Vector3(0,size/2,0), Vector3(size,0.1,size), Vector3());	

	// walls
	AddBox(pScene, pWorld, Vector3(-size/2,size/4,0), Vector3(1,size/2,size), Vector3());	
	AddBox(pScene, pWorld, Vector3(+size/2,size/4,0), Vector3(1,size/2,size), Vector3());	
	AddBox(pScene, pWorld, Vector3(0,size/4,-size/2), Vector3(1,size/2,size), Vector3(0,90,0));	
	AddBox(pScene, pWorld, Vector3(0,size/4,+size/2), Vector3(1,size/2,size), Vector3(0,90,0));	

	// light
	//pScene->fog = new SFog(SRGBA(0,0,0,255), 3, 8);
	pScene->ambientColor = SRGBA(50,50,60,255);

	// create block
	float bias = 1.1f;
	for (int y=0; y<6; y++)
		for (int x=0; x<8; x++)
			for (int z=0; z<8; z++)			
			{
				NewtonBody *box = AddBox(pScene, pWorld, Vector3(-x*bias,y*bias+1,z*bias), Vector3(1,1,1), Vector3(), 100);
				DropDownBox(box);
			}

	pScene->Add( pLight = new CPointLight(Vector3(0,1,0), SRGBA(255,233,155,255)) );
	pLight->specular = SRGBA(255,255,255,100);
	pLight->range = 1;
	pLight->intensity = 1;

	pScene->Add( new CDirectionalLight(Vector3(1,-2,0.5), WHITE));
}
示例#7
0
void Cloud::Renderer::DebugRenderer::AddBox(const ClFloat3& position, const ClFloat3& rotation, const ClFloat3& scale, const ClFloat4& colour)
{
    ClMatrix4 matrix = ClMatrix4::Identity();
    matrix *= ClMatrix4::Scale(ClFloat4(scale, 0));
    matrix *= ClMatrix4::Rotation(ClFloat4(rotation, 0));
    
    matrix.SetCol3(ClFloat4(position, 1.0f));

    AddBox(matrix, colour);
}
示例#8
0
int CInnerPanel::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if ( CTaskPanel::OnCreate( lpCreateStruct ) == -1 )return -1;
	
	SetOwner( GetParent() );
	SetFooter( NULL, TRUE );
	
//	m_wndVideo.Create( this, 140, _T("±¾µØÊÓƵ"), IDI_TASKPANEL );
	AddBox( &wndVideo );
	
	return 0;
}
示例#9
0
bool ModelBoxSubstr::MakeIt(Box2di A,Box2di S)
{
   mNbBox = 0;
   if  (InterVide(A,S))
   {
        AddBox(A._p0,A._p1);
        return true;
   }
 
   if (A._p0.y < S._p0.y)
   {
       Pt2di p0(ElMax(A._p0.x ,S._p0.x) , A._p0.y);
       Pt2di p1(A._p1.x               , S._p0.y);
       AddBox(p0,p1);
   }
 
 
   if (A._p1.x > S._p1.x)
   {
       Pt2di p0(S._p1.x,ElMax(A._p0.y,S._p0.y));
       Pt2di p1 = A._p1;
       AddBox(p0,p1);
   }
 
   if (A._p1.y > S._p1.y)
   {
      Pt2di p0(A._p0.x,S._p1.y);
      Pt2di p1(ElMin(A._p1.x,S._p1.x),A._p1.y);
      AddBox(p0,p1);
   }
 
   if (A._p0.x < S._p0.x)
   {
      Pt2di p0 =  A._p0;
      Pt2di p1(S._p0.x,ElMin(A._p1.y,S._p1.y));
      AddBox(p0,p1);
   }

   return false;
}
示例#10
0
void CurrentApp::AddWidget(PxShape* shape, PxRigidActor* actor, glm::vec4 colour)
{
	PxGeometryType::Enum type = shape->getGeometryType();
	switch (type)
	{
	case PxGeometryType::eBOX:
		AddBox(shape, actor, colour);
		break;
	case PxGeometryType::ePLANE:
		AddPlane(shape, actor, glm::vec4(0, 0.4, 0, 1));
		break;
	}
}
示例#11
0
    void AddDirections( VECTOR2D aP, int aMask, int aColor )
    {
        BOX2I b( aP - VECTOR2I( 10000, 10000 ), VECTOR2I( 20000, 20000 ) );

        AddBox( b, aColor );
        for( int i = 0; i < 8; i++ )
        {
            if( ( 1 << i ) & aMask )
            {
                VECTOR2I v = DIRECTION_45( ( DIRECTION_45::Directions ) i ).ToVector() * 100000;
                AddSegment( SEG( aP, aP + v ), aColor );
            }
        }
    }
示例#12
0
// Adds an inline box as a chained hierarchy overflowing to this line.
void LayoutLineBox::AddChainedBox(LayoutInlineBox* chained_box)
{
	std::stack< LayoutInlineBox* > hierarchy;
	LayoutInlineBox* chain = chained_box;
	while (chain != NULL)
	{
		hierarchy.push(chain);
		chain = chain->GetParent();
	}

	while (!hierarchy.empty())
	{
		AddBox(new LayoutInlineBox(hierarchy.top()));
		hierarchy.pop();
	}
}
示例#13
0
/*-------------------------------------------------------
	학습하는 함수

	nClass(입력) : 학습 데이터의 클래스
	pInput(입력) : 하나의 학습 입력 벡터 x, 길이는 m_nInput(=n)과 같아야 한다.

	* 사실은 n개 이상이어도 된다. 하지만 n개보다 적으면 문제가 생긴다.
-------------------------------------------------------*/
void CFMMNN::Training(int nClass, float* pInput)
{
	if(pInput == NULL)
		return;
	m_pInput = pInput;

	int nBox = FindMaxMembershipBox(nClass);
	if(nBox < 0) // 확장할 수 있는 게 없으면
		AddBox(nClass); // 박스를 하나 새로 만든다.
	else // 확장할 수 있으면
	{
		register MINMAX* pBox = &m_pBox[nClass][nBox];
		ExpandBox(pBox); // 확장한다.
		TestBox(pBox, nClass); // overlap 테스트해서 축소한다.
	}
}
void 
avtMultiResolutionPartitionStrategy::Make2x1Line(int level, int c1, int c2)
{
    int extents[6];
    GetExtents(level, c1, extents);

    int e2[6];
    GetExtents(level, c2, e2);
    extents[0] = (extents[0] < e2[0] ? extents[0] : e2[0]);
    extents[1] = (extents[1] > e2[1] ? extents[1] : e2[1]);
    extents[2] = (extents[2] < e2[2] ? extents[2] : e2[2]);
    extents[3] = (extents[3] > e2[3] ? extents[3] : e2[3]);
    extents[4] = (extents[4] < e2[4] ? extents[4] : e2[4]);
    extents[5] = (extents[5] > e2[5] ? extents[5] : e2[5]);

    AddBox(extents);
}
void ImageGroundTruthPanelViewer::LoadBoxes(vector_layer_ptr_t & p_layer, const std::vector < GroundTruthBox > & v_boxes)
{
    std::vector < GroundTruthBox >::const_iterator box_it;

    try
    {
        p_layer->clear();
        for(box_it = v_boxes.begin(); box_it < v_boxes.end(); ++ box_it)
        {
            AddBox(p_layer, * box_it);
        }
    }
    catch( ... )
    {
        JPB_wx_THROW("échec du chargement des polygones dans le calque")
    }
}
void 
avtMultiResolutionPartitionStrategy::Make2x2Box(int level, int *cellids)
{
    int extents[6];
    GetExtents(level, cellids[0], extents);
    for (int i = 1 ; i < 4 ; i++)
    {
        int e2[6];
        GetExtents(level, cellids[i], e2);
        extents[0] = (extents[0] < e2[0] ? extents[0] : e2[0]);
        extents[1] = (extents[1] > e2[1] ? extents[1] : e2[1]);
        extents[2] = (extents[2] < e2[2] ? extents[2] : e2[2]);
        extents[3] = (extents[3] > e2[3] ? extents[3] : e2[3]);
        extents[4] = (extents[4] < e2[4] ? extents[4] : e2[4]);
        extents[5] = (extents[5] > e2[5] ? extents[5] : e2[5]);
    }
    AddBox(extents);
}
示例#17
0
void CEffectsGame::ReloadGeometry()
{	
	RemoveBodies();

	ifstream is("level.json");
	json_spirit::mValue array;
	json_spirit::read(is, array);

	const json_spirit::mArray &boxes = array.get_array();
	int num = boxes.size();
	
	for (int i=0; i<num; i++)
	{
		const json_spirit::mObject &box = boxes[i].get_obj();

		
		json_spirit::mArray position = box.find("pos")->second.get_array();
		Vector3 pos = Vector3(
			position[0].get_real(),
			position[1].get_real(),
			position[2].get_real()
			);

		json_spirit::mArray size = box.find("size")->second.get_array();
		Vector3 s = Vector3(
			size[0].get_real(),
			size[1].get_real(),
			size[2].get_real()
			);

		json_spirit::mArray rotation = box.find("rotation")->second.get_array();
		Vector3 rot = Vector3(
			rotation[0].get_real(),
			rotation[1].get_real(),
			rotation[2].get_real()
			);

		bodies.AddToTail( AddBox(pScene, pWorld, pos, s, rot) );
	}
}
示例#18
0
double cTerrainGen2D::BuildWalls(double width, const tParams& params, cRand& rand, std::vector<float>& out_data)
{
	double spacing_min = params[eParamsWallSpacingMin];
	double spacing_max = params[eParamsWallSpacingMax];
	double wall_w_min = params[eParamsWallWidthMin];
	double wall_w_max = params[eParamsWallWidthMax];
	double wall_g_min = params[eParamsWallHeightMin];
	double wall_g_max = params[eParamsWallHeightMax];

	double total_w = 0;
	while (total_w < width)
	{
		double spacing = rand.RandDouble(spacing_min, spacing_max);
		double w = rand.RandDouble(wall_w_min, wall_w_max);
		double h = rand.RandDouble(wall_g_min, wall_g_max);

		double curr_w = AddBox(spacing, w, h, out_data);
		total_w += curr_w;
	}

	return total_w;
}
示例#19
0
double cTerrainGen2D::BuildGaps(double width, const tParams& params, cRand& rand, std::vector<float>& out_data)
{
	double spacing_min = params[eParamsGapSpacingMin];
	double spacing_max = params[eParamsGapSpacingMax];
	double gap_w_min = params[eParamsGapWidthMin];
	double gap_w_max = params[eParamsGapWidthMax];
	double gap_d_min = params[eParamsGapDepthMin];
	double gap_d_max = params[eParamsGapDepthMax];

	double total_w = 0;
	while (total_w < width)
	{
		double spacing = rand.RandDouble(spacing_min, spacing_max);
		double w = rand.RandDouble(gap_w_min, gap_w_max);
		double d = rand.RandDouble(gap_d_min, gap_d_max);

		double curr_w = AddBox(spacing, w, d, out_data);
		total_w += curr_w;
	}

	return total_w;
}
示例#20
0
CNCSError ECWDEMCompressor::Compress(ImageFormatECWDEM *NewIFECW, RasterBounds *RBounds, char *pDstFile, UINT32 ImgWidth, UINT32 ImgHeight, char Depth, UINT16 nRate)
{
//NCSFileViewFileInfoEx has basic info about the file - dimensions, bands,
//georeferencing information etc.
    NCSFileViewFileInfoEx *pDstInfo = (NCSFileViewFileInfoEx *)NCSMalloc(sizeof(NCSFileViewFileInfoEx), true);
    NCSFileViewFileInfoEx DstInfo = *pDstInfo;
    CNCSError Error;

    IFECW = NewIFECW;
    DstInfo.nSizeX = ImgWidth;
    DstInfo.nSizeY = ImgHeight;
    switch (Depth)
    {
    case 8:
        DstInfo.eCellType = NCSCT_UINT8;
        break;
    case 16:
        DstInfo.eCellType = NCSCT_UINT16;
        break;
    //case 28: DstInfo.eCellType = NCSCT_IEEE4; break;
    case 28:
        DstInfo.eCellType = NCSCT_UINT32;
        break;
    } // switch

    DstInfo.nBands = 1;
    DstInfo.nCompressionRate = nRate;
    DstInfo.eColorSpace = NCSCS_GREYSCALE;

#ifdef WCS_BUILD_VNS
    if (RBounds && RBounds->FetchCoordSys())
    {
        IFECW->CreateECWGeoRefNewAPI(RBounds->FetchCoordSys(), &DstInfo, RBounds);
    } // if
#endif // WCS_BUILD_VNS

//DstInfo.szProjection = "RAW";
//DstInfo.szDatum = "RAW";
//DstInfo.eCellSizeUnits = ECW_CELL_UNITS_METERS;
//DstInfo.fCellIncrementX = 1.0;
//DstInfo.fCellIncrementY = 1.0;
//DstInfo.fOriginX = 0.0;
//DstInfo.fOriginY = 0.0;

    DstInfo.pBands = (NCSFileBandInfo *)(new NCSFileBandInfo[DstInfo.nBands]);
    DstInfo.pBands[0].nBits = Depth;
    DstInfo.pBands[0].bSigned = false;
    DstInfo.pBands[0].szDesc = "Elevation";

//Call SetFileInfo to establish the file information we are going to
//use for compression.  The parameters used are those from the NCSFileViewFileInfoEx
//struct we have populated using metadata derived from our input raster.
    Error = SetFileInfo(DstInfo);
    Error = Open(pDstFile, false, true);
    if (Error == NCS_SUCCESS)
    {
#ifdef WCS_BUILD_JP2BOX_SUPPORT
        JP2UUID3DNBox RangeEquivs(NewIFECW->HighElev, NewIFECW->LowElev, (unsigned long int)NewIFECW->MaxValue, 0);
        AddBox(&RangeEquivs);
#endif // WCS_BUILD_JP2BOX_SUPPORT

        Error = Write();
        if (Error == NCS_SUCCESS)
            fprintf(stdout,"Finished compression\n");
        else if (Error == NCS_USER_CANCELLED_COMPRESSION)
            fprintf(stdout,"Compression cancelled\n");
        else fprintf(stdout,"Error during compression: %s\n",Error.GetErrorMessage());

        Error = Close(true);
    } // if

    return(Error);

} // ECWDEMCompressor::Compress
示例#21
0
void CEffectsGame::CreateScene()
{
	pScene->CreateSkybox("clear");

	NewtonBody *bFloor = AddBox(pScene, pWorld, Vector3(0,-0.5,0), Vector3(1000,1,1000), Vector3());	
	NewtonCollision *col = NewtonCreateTreeCollision(pWorld, 0);
	NewtonTreeCollisionBeginBuild(col);
	Vector3 v[4] = {
		Vector3(-1000,0.5f,-1000),
		Vector3(-1000,0.5f,+1000),
		Vector3(+1000,0.5f,+1000),
		Vector3(+1000,0.5f,-1000)
	};
	NewtonTreeCollisionAddFace(col, 4, &v[0][0], sizeof(Vector3), 1);
	NewtonTreeCollisionEndBuild(col, 0);

	



	NewtonBodySetCollision(bFloor, col);

	CObject3D *f = (CObject3D*)NewtonBodyGetUserData(bFloor);
	f->visible = false;

	NewtonBodySetMaterialGroupID(bFloor, gLevelChunksMaterialID);

	// floor
	static CTexture *floorTex = new CTexture("textures/512.png");
	CMaterial *floorMat = new CMaterial();
	floorMat->features = EShaderFeature::LIGHT | EShaderFeature::FOG | EShaderFeature::SHADOW | EShaderFeature::TEXTURE;
	CPlaneGeometry *floorGeom = new CPlaneGeometry(1000,1000);
	CObject3D *floor = new CMesh( floorGeom, floorMat );
	floor->geometry->materials.AddToTail(floorMat);
	floorMat->pTexture = floorTex;
	floorGeom->SetTextureScale(40,40);
	floor->SetPosition(-500, 0, -500);
	pScene->Add(floor);

	

	pLevel = new CLevel(pScene, pWorld);
	pLevel->Create(32,80,32);

	int width = 24;
	int depth = 24;
	int storeys = 8;
	int storyHeight = 8;

	for (int y=0; y<storeys*storyHeight; y++)
		for (int x=0; x<width; x++)
			for (int z=0; z<depth; z++)
			{
				int block = 0;
				if (x==0 || z==0 || x==width-1 || z==depth-1) block = 1;
				if (y%storyHeight == storyHeight-1) block = 1;
				if (x>5 && z>5 && x<width-5 && z<depth-5) block = 0;

				if (y%storyHeight > 2 && y%storyHeight <= 4) 
				{
					if (x%8 >= 2 && x%8 < 7) block = 0;
					if (z%8 >= 2 && z%8 < 7) block = 0;
				}

				if ((x==5 && z==5) || (x==width-5 && z==depth-5) || (x==5 && z==depth-5) || (x==width-5 && z==5) ) block = 4;

				
				if (block > 0)	block = 4;
				pLevel->GetTile(x,y,z)->type = block;
			}

	int sx = 55;
	int sz = 55;
	



	pLevel->Recreate();

	for (int x=0; x<pLevel->chunksX; x++)
		for (int y=0; y<pLevel->chunksY; y++)
			for (int z=0; z<pLevel->chunksZ; z++)
			{
				pLevel->GetChunk(x,y,z)->RecreateCollision();
			}	

	// once the map has been created, creatie bodies that will collide
	/*for (int x=0; x<pLevel->sizeX; x++)
		for (int y=0; y<pLevel->sizeY; y++)
			for (int z=0; z<pLevel->sizeZ; z++)
			{
				if (pLevel->GetTile(x,y,z)->type == 0) continue;

				CObject3D *o = new CObject3D();
				o->SetPosition(Vector3(x+0.5, y+0.5, z+0.5));
				
				NewtonBody *box = CPhysics::CreateBox(pWorld, o, 1,1,1, 0);
				NewtonBodySetFreezeState(box, 1);

				delete o;
			}*/

	// let's create a collision tree for each chunk
/*	for (int x=0; x<pLevel->chunksX; x++)
		for (int y=0; y<pLevel->chunksY; y++)
			for (int z=0; z<pLevel->chunksZ; z++)
			{
				NewtonCollision * col = NewtonCreateTreeCollision(pWorld, 0);
				NewtonTreeCollisionBeginBuild(col);

				CArray<Vector3> &verts = pLevel->GetChunk(x,y,z)->pMesh->geometry->vertices;
				for (int i=0; i<pLevel->GetChunk(x,y,z)->pMesh->geometry->faces.Size(); i++)
				{
					Face3 face = pLevel->GetChunk(x,y,z)->pMesh->geometry->faces[i];
					Vector3 v[] = { verts[face.a], verts[face.b], verts[face.c] };
					NewtonTreeCollisionAddFace(col, 3, &v[0][0], sizeof(Vector3), 1);
				}
				NewtonTreeCollisionEndBuild(col, 1);

				// create body
				float m[16] = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
				NewtonBody *body = NewtonCreateBody(pWorld, col, &m[0]);
				NewtonReleaseCollision(pWorld, col);
				NewtonBody
			}
*/
	/*
	CreateBuilding(0,0,0, 3,8,3);
	CreateBuilding(20,0,-10, 2,4,6);
	CreateBuilding(-5,0,-20, 5,2,3);
	*/

	// point light that will circle the building
	pLight = new CPointLight(Vector3(), SRGBA(255,200,50));
	pLight->range = 8.0f;
	pLight->overbright = true;
	pScene->Add(pLight);

	pScene->fog = new SFog( SRGBA(172,201,241, 255), 200, 500);

	// point light at 0,1,0
	CLight *pLight = new CPointLight(Vector3(0,1,0), RED);//SRGBA(255,233,155,255));
	//pScene->Add( pLight );
	pLight->specular = pLight->color;//SRGBA(255,255,255,100);
	pLight->range = 1;
	pLight->intensity = 1;	

	// directional Sun light
	CDirectionalLight *pDirLight = new CDirectionalLight(Vector3(0,0,0), SRGBA(255,225,175,255));
	pDirLight->SetPosition(+70,90,-70);
	pDirLight->LookAt(Vector3());
	pDirLight->UpdateMatrixWorld(true);
	pDirLight->shadowNear = 20;
	pDirLight->shadowFar = 200;
	pDirLight->castShadow = true;
	float aspect = (float)gEngine.width / gEngine.height;
	pDirLight->width = 200.0f;
	pDirLight->height = pDirLight->width / aspect;
	pScene->Add( pDirLight );
	
	// ambient light
	pScene->ambientColor = SRGBA(200,200,255,255);

	pCamera->LookAt(Vector3());
}
void
avtMultiResolutionPartitionStrategy::SearchFromCorners(void)
{
    int  c, d, i, j, k;
    for (c = 0 ; c < 8 ; c++)
    {
        int i_step = 0;
        int j_step = 0;
        int k_step = 0;
        int i_start = 0;
        int j_start = 0;
        int k_start = 0;
        if (c & 1)
        {
            i_step = -1;
            i_start = full_dim_size-1;
        }
        else
        {
            i_step = +1;
            i_start = 0;
        }
        if (c & 2)
        {
            j_step = -1;
            j_start = full_dim_size-1;
        }
        else
        {
            j_step = +1;
            j_start = 0;
        }
        if (c & 4)
        {
            k_step = -1;
            k_start = full_dim_size-1;
        }
        else
        {
            k_step = +1;
            k_start = 0;
        }

        int index = k_start * full_dim_size*full_dim_size 
                    + j_start*full_dim_size + i_start;
        if (!reg_desc[0][index].allOn)
            continue;

        int box[6];
        box[0] = i_start;
        box[1] = i_start;
        box[2] = j_start;
        box[3] = j_start;
        box[4] = k_start;
        box[5] = k_start;
        bool canGrowI = true;
        bool canGrowJ = true;
        bool canGrowK = true;
        bool canGrow = true;
        for (d = 0 ; d < full_dim_size-1 && canGrow ; d++)
        {
            if (canGrowI)
                canGrowI = GrowBox(box, 0, i_step);
            if (canGrowJ)
                canGrowJ = GrowBox(box, 1, j_step);
            if (canGrowK)
                canGrowK = GrowBox(box, 2, k_step);
            canGrow = canGrowI || canGrowJ || canGrowK;
        }
        int box_size = (box[1] - box[0] + 1) * (box[3] - box[2] + 1)
                     * (box[5] - box[4] + 1);
        if (box_size >= 1)
        {
            for (i = box[0] ; i <= box[1] ; i++)
                for (j = box[2] ; j <= box[3] ; j++)
                    for (k = box[4] ; k <= box[5] ; k++)
                    {
                        int index = k * full_dim_size*full_dim_size 
                                    + j*full_dim_size + i;
                        reg_desc[0][index].someOn = false;
                        reg_desc[0][index].allOn = false;
                    }
            box[1] = (box[1]+1 > orig_dims[0] ? orig_dims[0] : box[1]+1);
            box[3] = (box[3]+1 > orig_dims[1] ? orig_dims[1] : box[3]+1);
            box[5] = (box[5]+1 > orig_dims[2] ? orig_dims[2] : box[5]+1);
            AddBox(box);
        }
    }
}