void MainWindow::BuildAntenna(){
	vp.clear();
	vn.clear();
	face.clear();
	face_cnt = 4000;
	BuildButtom();
	Sweepping();
	SetNormal();
	SetFace();
	std::ofstream mtlout("tmp.mtl");
	mtlout << "#tmp.mtl";
	mtlout.close();
	std::ofstream out("tmp.obj");
	out << "g default" << std::endl;
	for (int i = 0; i < vp.size(); i++)
	{
		out << "v " << vp[i].x << " " << vp[i].y << " " << vp[i].z << std::endl;
	}
	for (int i = 0; i < vn.size(); i++)
	{
		out << "vn " << vn[i].x << " " << vn[i].y << " " << vn[i].z << std::endl;
	}
	for (int i = 0; i < face.size(); i++)
	{
		out << "f " << face[i].idx1 << "//" << face[i].idx1 << " " << face[i].idx2 << "//" << face[i].idx2 << " " << face[i].idx3 << "//" << face[i].idx3 << std::endl;
	}
	out.close();
	antennaGLWidget->delAllGLList();
	Andu::AnduMeshReader reader;
	Caca::Mesh* pMesh = new Caca::Mesh();
	reader.Read(pMesh, "tmp.obj");
	antennaGLWidget->addGLList(1, pMesh);
	antennaGLWidget->updateGL();
}
Exemple #2
0
void UIFont::CopyFrom(UIFont *Other)
{
    if (!Other)
        return;

    SetFace(Other->GetFace());
    SetColor(Other->GetColor());
    SetBrush(Other->GetBrush());
    QPoint offset;
    QColor color;
    int    blur;
    quint16 size;
    Other->GetShadow(offset, color, blur);
    SetShadow(Other->HasShadow(), offset, color, blur);
    Other->GetOutline(color, size);
    SetOutline(Other->HasOutline(), color, size);
    SetOffset(Other->GetOffset());
    SetRelativeSize(Other->GetRelativeSize());
    SetSize(Other->GetFace().pixelSize());
    SetStretch(Other->GetStretch());
    SetImageFileName(Other->GetImageFileName());
    SetImageReady(Other->GetImageReady());
    UIImage* image = Other->GetImage();
    if (image)
    {
        SetImage(image);
        m_image->UpRef();
    }
}
NS_IMETHODIMP
HTMLFontElement::SetFace(const nsAString& aFace)
{
    ErrorResult rv;
    SetFace(aFace, rv);
    return rv.ErrorCode();
}
Exemple #4
0
/**
* Create an instance of the font class with given font file and size
*/
STFont::STFont(const std::string& fontName, int fontSize)
    : mImpl(new STFontImpl())
{
    // Start members as "invalid"
    mImpl->size = -1;
    mImpl->ftFace = NULL;

    FT_Error fterr;

    // Need to initialized the freetype2 library
    if (!sFTLibrary) {

        sFTLibrary = new FT_Library();

        fterr = FT_Init_FreeType(sFTLibrary);

        if ( fterr ) {
            fprintf(stderr, "Fatal: Could not initialize freetype library. Error code %d\n", fterr);
            throw new std::runtime_error("Error creating STFont");
        }
    }

    // Once freetype2 library is initialized, load the requested font face
    if (SetFace(fontName, fontSize) != ST_OK) {
        throw new std::runtime_error("Error creating STFont");
    }
}
Character::Character(std::string fromString) {
    std::vector<std::string> tokens = utils::Tokenfy(fromString, '|');
    if (tokens[0] == "PLAYER_OBJECT") {
        SetName(tokens[57]);
        SetLastname(tokens[58]);
        SetRace(tokens[59]);
        SetGender(tokens[60]);
        SetFace(tokens[61]);
        SetSkin(tokens[62]);
        SetZone(tokens[63]);
        SetLevel(std::stoi(tokens[64]));
        SetHp(std::stoi(tokens[65]));
        SetMaxHp(std::stoi(tokens[66]));
        SetBp(std::stoi(tokens[67]));
        SetMaxBp(std::stoi(tokens[68]));
        SetMp(std::stoi(tokens[69]));
        SetMaxMp(std::stoi(tokens[70]));
        SetEp(std::stoi(tokens[71]));
        SetMaxEp(std::stoi(tokens[72]));
        SetStrength(std::stoi(tokens[73]));
        SetConstitution(std::stoi(tokens[74]));
        SetIntelligence(std::stoi(tokens[75]));
        SetDexterity(std::stoi(tokens[76]));
        SetX(std::stof(tokens[77]));
        SetY(std::stof(tokens[78]));
        SetZ(std::stof(tokens[79]));
        SetPitch(std::stof(tokens[80]));
        SetYaw(std::stof(tokens[81]));
    }
    // if (tokens[0] == "NPC_OBJECT") {
    //    
    // }
}
// 通过性别和索引设置头像id
void CGamePro_CharCreate::SetFaceByRaceAndIndex(int iRace, int iIndex)
{
	switch(iRace)
	{
	case 0:
		{
			SetFace(m_FaceMng.GetWomanFaceId(iIndex));
			break;
		}
	case 1:
		{
			SetFace(m_FaceMng.GetManFaceId(iIndex));
			break;
		}
	}
}
Exemple #7
0
status_t
FFont::Unflatten(type_code c, const void *buf, ssize_t size)
{
    if( c != FONT_TYPE ) return B_BAD_TYPE;

    // Make sure buffer contains all data.  If we later want
    // to add new attributes, we can make a more sophisticated
    // check to allow partial structures.
    if( size < sizeof(flat_font_data) ) return B_BAD_VALUE;

    // Easy reference to the buffer.
    flat_font_data* fdat = (flat_font_data*)buf;

    // Initialize from default font, just in case.
    *this = FFont();

    // Set up family and style for font.
    SetFamilyAndStyle(fdat->family,fdat->style);

    // This is used as a temporary when byte-swapping floats.
    // Note that this assumes a float is 4 bytes.
    union {
        uint32 aslong;
        float asfloat;
    } swap;

    // Byte-swap size, shear, and rotation out of the flattened
    // structure.  This is written for clarity more than speed,
    // since the additional overhead will be entirely subsumed
    // by everything else going on.
    swap.asfloat = fdat->size;
    swap.aslong = ntohl(swap.aslong);
    SetSize(swap.asfloat);
    swap.asfloat = fdat->shear;
    swap.aslong = ntohl(swap.aslong);
    SetShear(swap.asfloat);
    swap.asfloat = fdat->rotation;
    swap.aslong = ntohl(swap.aslong);
    SetRotation(swap.asfloat);

    // Byte-swap the remaining data from the flattened structure.
    SetFlags(ntohl(fdat->flags));
    SetFace(ntohs(fdat->face));
    SetSpacing(fdat->spacing);
    SetEncoding(fdat->encoding);
    SetMask(ntohl(fdat->mask));

    return B_NO_ERROR;
}
Exemple #8
0
	void AttachToPlayer (player_t *player)
	{
		player_t *oldplayer = CPlayer;

		DBaseStatusBar::AttachToPlayer (player);
		if (oldplayer != CPlayer || savegamerestore/*added for morphing*/)
		{
			SetFace (&skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin]);
		}
		if ( NETWORK_GetState( ) != NETSTATE_SINGLE )
		{
			// set face background color
			StatusBarTex.SetPlayerRemap(translationtables[TRANSLATION_Players][int(CPlayer - players)]);
		}
		MugShot.bEvilGrin = false;
	}
void Polyhedron::Define(const Frustum& frustum)
{
    const Vector3* vertices = frustum.vertices;
    
    faces.Resize(6);
    SetFace(0, vertices[0], vertices[4], vertices[5], vertices[1]);
    SetFace(1, vertices[7], vertices[3], vertices[2], vertices[6]);
    SetFace(2, vertices[7], vertices[4], vertices[0], vertices[3]);
    SetFace(3, vertices[1], vertices[5], vertices[6], vertices[2]);
    SetFace(4, vertices[4], vertices[7], vertices[6], vertices[5]);
    SetFace(5, vertices[3], vertices[0], vertices[1], vertices[2]);
}
void CREvent::RandomChoseDetails()
{
	WORD MaxNum[2],Results[2];
	MaxNum[0] = GetFaceNum(m_chSex);
	MaxNum[1] = GetHairNum(m_chSex);
	for (int i = 0;i<2;i++)
	{		
		Results[i] = random((int)MaxNum[i] + 1);
		while (Results[i] == 0)
		{
			Results[i] = random((int)MaxNum[i]);
		}
	}
	SetFace(Results[0]);
	SetHairStyle(Results[1]);
	MaxNum[1] = GetHairColorNum(m_chSex,m_byHairStyle);
	SetHairColor(0);
}
Character::Character(std::string name, std::string lastname, std::string race, std::string gender, 
                     std::string face, std::string skin, std::string zone, int level, int hp, 
                     int maxHp, int bp, int maxBp, int mp, int maxMp, int ep, int maxEp, 
                     int strength, int constitution, int intelligence, int dexterity, float x, 
                     float y, float z, float pitch, float yaw) {
    SetName(name);
    SetLastname(lastname);
    SetRace(race);
    SetGender(gender);
    SetFace(face);
    SetSkin(skin);
    SetZone(zone);
    SetHead("head");
    SetChest("chest");
    SetArms("arms");
    SetHands("hands");
    SetLegs("legs");
    SetFeet("feet");
    SetCloak("cloak");
    SetNecklace("necklace");
    SetRingOne("ringOne");
    SetRingTwo("ringTwo");
    SetRightHand("rightHand");
    SetLeftHand("leftHand");
    SetLevel(level);
    SetHp(hp);
    SetMaxHp(maxHp);
    SetBp(bp);
    SetMaxBp(maxBp);
    SetMp(mp);
    SetMaxMp(maxMp);
    SetEp(ep);
    SetMaxEp(maxEp);
    SetStrength(strength);
    SetConstitution(constitution);
    SetIntelligence(intelligence);
    SetDexterity(dexterity);
    SetX(x);
    SetY(y);
    SetZ(z);
    SetPitch(pitch);
    SetYaw(yaw);
}
Exemple #12
0
void Polyhedron::Define(const BoundingBox& box)
{
    Vector3 vertices[8];
    vertices[0] = box.min;
    vertices[1] = Vector3(box.max.x, box.min.y, box.min.z);
    vertices[2] = Vector3(box.min.x, box.max.y, box.min.z);
    vertices[3] = Vector3(box.max.x, box.max.y, box.min.z);
    vertices[4] = Vector3(box.min.x, box.min.y, box.max.z);
    vertices[5] = Vector3(box.max.x, box.min.y, box.max.z);
    vertices[6] = Vector3(box.min.x, box.max.y, box.max.z);
    vertices[7] = box.max;
    
    faces.Resize(6);
    SetFace(0, vertices[3], vertices[7], vertices[5], vertices[1]);
    SetFace(1, vertices[6], vertices[2], vertices[0], vertices[4]);
    SetFace(2, vertices[6], vertices[7], vertices[3], vertices[2]);
    SetFace(3, vertices[1], vertices[5], vertices[4], vertices[0]);
    SetFace(4, vertices[7], vertices[6], vertices[4], vertices[5]);
    SetFace(5, vertices[2], vertices[3], vertices[1], vertices[0]);
}
Exemple #13
0
void Polyhedron::Define(const BoundingBox& box)
{
    Vector3 vertices[8];
    vertices[0] = box.min_;
    vertices[1] = Vector3(box.max_.x_, box.min_.y_, box.min_.z_);
    vertices[2] = Vector3(box.min_.x_, box.max_.y_, box.min_.z_);
    vertices[3] = Vector3(box.max_.x_, box.max_.y_, box.min_.z_);
    vertices[4] = Vector3(box.min_.x_, box.min_.y_, box.max_.z_);
    vertices[5] = Vector3(box.max_.x_, box.min_.y_, box.max_.z_);
    vertices[6] = Vector3(box.min_.x_, box.max_.y_, box.max_.z_);
    vertices[7] = box.max_;
    
    faces_.Resize(6);
    SetFace(0, vertices[3], vertices[7], vertices[5], vertices[1]);
    SetFace(1, vertices[6], vertices[2], vertices[0], vertices[4]);
    SetFace(2, vertices[6], vertices[7], vertices[3], vertices[2]);
    SetFace(3, vertices[1], vertices[5], vertices[4], vertices[0]);
    SetFace(4, vertices[7], vertices[6], vertices[4], vertices[5]);
    SetFace(5, vertices[2], vertices[3], vertices[1], vertices[0]);
}
void nuiFontRequest::_SetFace(int32 Face)
{
  SetFace(Face, 1.0);
}
Exemple #15
0
void
MainWindow::MessageReceived(BMessage *msg)
{
	switch (msg->what)
	{
		case B_ABOUT_REQUESTED:
		{
			AboutRequested();
			break;
		}
		case M_SHOW_HELP:
		{
			HelpWindow *helpwin = new HelpWindow();
			helpwin->Show();
			break;
		}
		case M_SHOW_CUSTOM:
		{
			CustomWindow *cswin = new CustomWindow();
			cswin->Show();
			break;
		}
		case M_NEW_GAME:
		{
			SetFace(FACE_NORMAL);
			SetupGame();
			break;
		}
		case M_SHOW_SCORES:
		{
			ScoreWindow *scorewin = new ScoreWindow();
			scorewin->Show();
			break;
		}
		case M_PAUSE_GAME:
		{
			BMenuItem *item = fMenuBar->FindItem(M_PAUSE_GAME);
			if (fTimerView->GetState() == TIMER_START)
			{
				fTimerView->SetState(TIMER_STOP);
				if (item)
					item->SetMarked(true);
				fFieldView->SetPauseMode(true);
			}
			else
			{
				if (item->IsMarked())
				{
					fTimerView->SetState(TIMER_START);
					if (item)
						item->SetMarked(false);
					fFieldView->SetPauseMode(false);
				}
			}
			break;
		}
		case M_SET_DIFFICULTY:
		{
			int32 level;
			if (msg->FindInt32("level",&level) != B_OK)
				break;

			BMenuItem *item = fMenuBar->FindItem(M_SET_DIFFICULTY);
			BMenu *menu = item ? item->Menu() : NULL;

			item = menu->FindMarked();
			if (item)
				item->SetMarked(false);
			menu->ItemAt(level)->SetMarked(true);

			gDifficulty = level;
			SetupGame();
			fFieldView->SetPauseMode(false);
			break;
		}
		case M_UPDATE_COUNT:
		{
			fCounterView->SetCount(fFieldView->MineCount() - fFieldView->FlagCount());
			break;
		}
		case M_START_TIMER:
		{
			fTimerView->SetState(TIMER_RESET);
			fTimerView->SetState(TIMER_START);
			gGameState = GAME_STARTED;
			break;
		}
		case M_SONAR_PENALTY:
		{
			fTimerView->SetState(TIMER_STOP);
			if (fTimerView->GetTime() < 979)
				fTimerView->SetTime(fTimerView->GetTime() + 20);
			else
				fTimerView->SetTime(999);
			fTimerView->SetState(TIMER_START);
			if (fFieldView->CheckWin())
				fFieldView->DoWin();
			break;
		}
		case M_SIZE_CHANGED:
		{
			ResizeTo(fFieldView->Frame().right + 10,fFieldView->Frame().bottom + 10);
			break;
		}
		case M_SET_THEME:
		{
			BString name;
			if (msg->FindString("name",&name) == B_OK)
				SetTheme(name.String());

			break;
		}
		case M_TOGGLE_SOUNDS:
		{
			gPlaySounds = gPlaySounds ? false : true;
			BMenuItem *item = fMenuBar->FindItem(M_TOGGLE_SOUNDS);
			if (item)
				item->SetMarked(!item->IsMarked());
			break;
		}
		default:
		{
			BWindow::MessageReceived(msg);
			break;
		}
	}
}
void CombinedLifeMeterEnemy::Update( float fDelta )
{
	CombinedLifeMeter::Update( fDelta );

	if( m_fSecondsUntilReturnToNormalFace > 0 )
	{
		m_fSecondsUntilReturnToNormalFace -= fDelta;

		if( m_fSecondsUntilReturnToNormalFace < 0 )
		{
			m_fSecondsUntilReturnToNormalFace = 0;
			m_sprFace.SetState( normal );
		}
	}

	if( GAMESTATE->m_fOpponentHealthPercent == 0 )
	{
		m_sprFace.SetState( defeated );
	}

	if( m_fLastSeenHealthPercent != GAMESTATE->m_fOpponentHealthPercent )
	{
		m_sprHealthStream.SetGlow( RageColor(1,1,1,1) );
		m_sprHealthStream.BeginTweening( 0.5f, TWEEN_DECELERATE );
		m_sprHealthStream.SetCropRight( 1-GAMESTATE->m_fOpponentHealthPercent );
		m_sprHealthStream.SetGlow( RageColor(1,1,1,0) );
		m_fLastSeenHealthPercent = GAMESTATE->m_fOpponentHealthPercent;

		SetFace( damage );

		if( GAMESTATE->m_fOpponentHealthPercent == 0 )
		{
			m_sprFrame.BeginTweening( 0.5f );
			m_sprFrame.SetDiffuse( RageColor(0.5f,0.5f,0.5f,1) );
		}
	}



	//
	// launch enemy attacks to human players
	//

	// Don't apply any attacks if the enemy is already defeated
	if( GAMESTATE->m_fOpponentHealthPercent>0 )
	{

		static const CString sPossibleModifiers[NUM_ATTACK_LEVELS][3] = 
		{
			{
				"1.5x",
				"dizzy",
				"drunk"
			},
			{
				"sudden",
				"hidden",
				"wave",
			},
			{
				"expand",
				"tornado",
				"flip"
			}
		};

	#define CROSSED_SONG_SECONDS( s ) ((GAMESTATE->m_fMusicSeconds-fDelta) < s  &&  (GAMESTATE->m_fMusicSeconds) >= s )

		if( CROSSED_SONG_SECONDS(10) || 
			CROSSED_SONG_SECONDS(30) ||
			CROSSED_SONG_SECONDS(50) ||
			CROSSED_SONG_SECONDS(70) ||
			CROSSED_SONG_SECONDS(90) ||
			CROSSED_SONG_SECONDS(110) )
		{
			SetFace( attack );
		}

		if( CROSSED_SONG_SECONDS(20) || CROSSED_SONG_SECONDS(40) )
		{
			Attack a;
			a.fSecsRemaining = 10;
			a.level = ATTACK_LEVEL_1;
			a.sModifier = sPossibleModifiers[a.level][rand()%3];
			FOREACH_PlayerNumber( p )
				if( GAMESTATE->IsHumanPlayer(p) )
					GAMESTATE->LaunchAttack( p, a );
			SCREENMAN->SendMessageToTopScreen( SM_BattleTrickLevel1 );
			SetFace( attack );
		}
		if( CROSSED_SONG_SECONDS(60) || CROSSED_SONG_SECONDS(80) )
		{
			Attack a;
			a.fSecsRemaining = 10;
			a.level = ATTACK_LEVEL_2;
			a.sModifier = sPossibleModifiers[a.level][rand()%3];
			FOREACH_PlayerNumber( p )
				if( GAMESTATE->IsHumanPlayer(p) )
					GAMESTATE->LaunchAttack( p, a );
			SCREENMAN->SendMessageToTopScreen( SM_BattleTrickLevel2 );
			SetFace( attack );
		}
Exemple #17
0
int CBSPMapData_LW::LoadSpecificMapDataFromFile( const char *pFilename )
{
	int i;
	bool bResult = false;
	CLightWaveSceneLoader lightwave_scene;

	// load the LightWave scene file
	lightwave_scene.LoadFromFile( pFilename );

//	MessageBox(NULL, "LW scene file has been loaded", "progress report", MB_OK);


	//First, we have to get the name of the mapfile in this "*.lws" file
	//The name of the mapfile has to be "_MAP_*.lwo" (* is can be an arbitrary string)

	// find the object file that has the filename starting with "_MAP_"
	CLWS_ObjectLayer* pObjectLayer = NULL;
//	char* pLWOFileName;
//	string strBodyFilename;
	char acBodyFilename[512];
	for( i=0; i<lightwave_scene.GetNumObjectLayers(); i++ )
	{
		pObjectLayer = lightwave_scene.GetObjectLayer(i);

		if( !pObjectLayer )
			MessageBox(NULL, "invalid object layer", "error", MB_OK|MB_ICONWARNING);

//		pLWOFileName = pObjectLayer->GetObjectFilename().c_str();
		string& strLWOFilename = pObjectLayer->GetObjectFilename();

		CFileNameOperation::GetBodyFilenameBySlash( acBodyFilename, strLWOFilename.c_str() );

		//find lwo2 file that represents the map object.
		if( strncmp( acBodyFilename, "_MAP_", 5 ) == 0 )
		{
			// load the object
			bResult = m_LWO2Object.LoadLWO2Object(acBodyFilename);
			break;
		}
	}

	// compute normals on each face(polygon) in the LightWave object 
//	m_LWO2Object.ComputeFaceNormals();


	string log_filename = "DebugInfoFile\\lwo2_loaded_data.txt";
	m_LWO2Object.WriteDebug(log_filename.c_str());

	list<LWO2_Layer>::iterator itrLayer;

	this->m_aPlane.reserve(DEFAULT_NUM_PLANES);
	this->m_aMainFace.reserve(DEFAULT_NUM_MAINFACES);
	this->m_aInteriorFace.reserve(DEFAULT_NUM_MAINFACES);

//	itrLayer = m_LWO2Object.m_layer.begin();
	list<LWO2_Layer>& lstLayer = m_LWO2Object.GetLayer();
	itrLayer = lstLayer.begin();
	for(; itrLayer != lstLayer.end() ; itrLayer++)
	{
		if( itrLayer->GetName() == "LYR_Slag" )
			continue;

		if( itrLayer->GetName() == "LYR_Main" )
			SetFace(&m_aMainFace, itrLayer);

		if( itrLayer->GetName() == "LYR_Interior" )
			SetFace(&m_aInteriorFace, itrLayer);

		if( itrLayer->GetName() == "LYR_Skybox" )
			SetFace(&m_aSkyboxFace, itrLayer);

		if( itrLayer->GetName() == "LYR_EnvLight" )
		{
			C3DMeshModelBuilder_LW mesh_builder( &m_LWO2Object );
			mesh_builder.BuildMeshFromLayer( *itrLayer );
			m_EnvLightMesh = mesh_builder.GetArchive();
		}
/*		if( itrLayer->GetName() == "LYR_BoundingVolume" )
			SetFace;
		if( itrLayer->GetName() == "LYR_NoClip" )
			SetFace;*/
	}

	// Sort textures and others
	SetTextureFilename();

	// set texture indices
	SetSurface();

	// create additional filenames to support fake bumpy textures
	SetFakeBumpTextures();

	//convert lightwave fog into generic fog
	CLWS_Fog* pLWSFog = lightwave_scene.GetFog();
	if( pLWSFog )
	{
		m_pFog = new SFog;
		m_pFog->cFogType = (char)pLWSFog->iType;
		m_pFog->fMinDist = pLWSFog->fMinDist;
		m_pFog->fMaxDist = pLWSFog->fMaxDist;
		m_pFog->fMinAmount = pLWSFog->fMinAmount;
		m_pFog->fMaxAmount = pLWSFog->fMaxAmount;
		m_pFog->color.fRed   = pLWSFog->afColor[0];	// red
		m_pFog->color.fGreen = pLWSFog->afColor[1];	// green
		m_pFog->color.fBlue  = pLWSFog->afColor[2];	// blue
	}

	// convert lightwave lights into generic lights
	SetLight( lightwave_scene );

	// for occlusion testing
	CreateTriangleMesh();

//	SetUVsForLightmaps();

	return 1;

}
Exemple #18
0
void MeshExtraData::BuildMeshExtraData( Mesh * mesh, int map_channel )
{
	// UVW Normals setup
	Tab <Point3> norv;

	int i_tf, i_tv;

	SetNumRVerts( mesh->numVerts );
	SetNumFaces( mesh->numFaces );
	SetNumUVerts( mesh->getNumMapVerts(map_channel) );

	faceSel.SetSize( mesh->numFaces );
	faceSel.ClearAll();

	norv.SetCount( mesh->numVerts );

	for (i_tv=0; i_tv<mesh->numVerts; i_tv++) 
	{
		norv[i_tv] = Point3(0,0,0);
	}

	UVVert *mv = mesh->mapVerts( map_channel );
	TVFace *tf = mesh->mapFaces( map_channel );

	for ( i_tf = 0; i_tf < mesh->numFaces; i_tf++ )
	{
		float a0, a1, a2, dp, lenA, lenB;

		Point3 v0 = mv[tf[i_tf].getTVert(0)];
		Point3 v1 = mv[tf[i_tf].getTVert(1)];
		Point3 v2 = mv[tf[i_tf].getTVert(2)];

		lenA = Length( v1 - v0 );
		lenB = Length( v2 - v0 );

		if ( lenA == 0.0f || lenB == 0.0f )
		{
			a0 = 0.0f;
		}
		else
		{
			dp = DotProd((v1-v0)/lenA,(v2-v0)/lenB);
			if (dp>1.0f) dp = 1.0f;
			if (dp<-1.0) dp = -1.0f;
			a0 = acos(dp);
		}

		lenA = Length( v0 - v1 );
		lenB = Length( v2 - v1 );

		if ( lenA == 0.0f || lenB == 0.0f )
		{
			a1 = 0.0f;
		}
		else
		{
			dp = DotProd((v0-v1)/lenA,(v2-v1)/lenB);
			if (dp>1.0f) dp = 1.0f;
			if (dp<-1.0) dp = -1.0f;
			a1 = acos(dp);
		}

		a2 = PI - ( a0 + a1 );

		Point3 vetnorm = (v1-v0)^(v2-v0);
		norv[mesh->faces[i_tf].getVert(0)] += vetnorm * a0;
		norv[mesh->faces[i_tf].getVert(1)] += vetnorm * a1;
		norv[mesh->faces[i_tf].getVert(2)] += vetnorm * a2;
		SetFace(i_tf, IPoint3(	int(mesh->faces[i_tf].getVert(0)),
								int(mesh->faces[i_tf].getVert(1)),
								int(mesh->faces[i_tf].getVert(2))) );
	}

	for (i_tv=0; i_tv<mesh->numVerts; i_tv++) 
	{
		Point3 vnormal = Normalize(norv[i_tv]);
		SetRvert(i_tv,vnormal);
	}	

	// Build Face Selections

	for ( i_tf=0; i_tf<mesh->numFaces; i_tf++ )
	{
		if ( mv[ tf[i_tf].t[0] ] == mv[ tf[i_tf].t[1] ] && mv[ tf[i_tf].t[1] ] == mv[ tf[i_tf].t[2] ] )
			faceSel.Clear(i_tf);
		else 
			faceSel.Set(i_tf);
	}

	if ( faceSel.NumberSet() == 0 ) 
		noneSel = TRUE;
	else
		noneSel = FALSE;
}