本文整理汇总了C++中dir1函数的典型用法代码示例。如果您正苦于以下问题:C++ dir1函数的具体用法?C++ dir1怎么用?C++ dir1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dir1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: archIndexTestSerialization
rc_t archIndexTestSerialization(ss_m*, test_volume_t*)
{
// ============================== DIR 1 ==============================
LogArchiver::ArchiveDirectory dir1(test_env->archive_dir, BLOCK_SIZE,
true /* createIndex */);
EXPECT_TRUE(dir1.getIndex());
unsigned total = 0;
generateFakeArchive(&dir1, BLOCK_SIZE*1000, 10, total);
// ===================================================================
// ============================== DIR 2 ==============================
LogArchiver::ArchiveDirectory dir2(test_env->archive_dir, BLOCK_SIZE,
true /* createIndex */);
EXPECT_TRUE(dir2.getIndex());
// ===================================================================
LogArchiver::ArchiveIndex* index1 = dir1.getIndex();
LogArchiver::ArchiveIndex* index2 = dir2.getIndex();
EXPECT_EQ(index1->runs.size(), index2->runs.size());
for(unsigned i=0; i<index1->runs.size(); i++) {
EXPECT_EQ(index1->runs[i].entries.size(), index2->runs[i].entries.size());
for(unsigned j=0; j<index1->runs[i].entries.size(); j++) {
EXPECT_EQ(index1->runs[i].entries[j].offset, index2->runs[i].entries[j].offset);
EXPECT_EQ(index1->runs[i].entries[j].pid, index2->runs[i].entries[j].pid);
}
}
return RCOK;
}
开发者ID:shemmer,项目名称:zero,代码行数:32,代码来源:test_logarchiver.cpp
示例2: dif
void CGenericParticleProjectile::Draw()
{
inArray = true;
if (directional) {
float3 dif(pos-camera->GetPos());
dif.ANormalize();
float3 dir1(dif.cross(speed));
dir1.ANormalize();
float3 dir2(dif.cross(dir1));
unsigned char color[4];
colorMap->GetColor(color, life);
va->AddVertexTC(drawPos - dir1 * size - dir2 * size, texture->xstart, texture->ystart, color);
va->AddVertexTC(drawPos - dir1 * size + dir2 * size, texture->xend, texture->ystart, color);
va->AddVertexTC(drawPos + dir1 * size + dir2 * size, texture->xend, texture->yend, color);
va->AddVertexTC(drawPos + dir1 * size - dir2 * size, texture->xstart, texture->yend, color);
} else {
unsigned char color[4];
colorMap->GetColor(color, life);
va->AddVertexTC(drawPos - camera->right * size - camera->up * size, texture->xstart, texture->ystart, color);
va->AddVertexTC(drawPos + camera->right * size - camera->up * size, texture->xend, texture->ystart, color);
va->AddVertexTC(drawPos + camera->right * size + camera->up * size, texture->xend, texture->yend, color);
va->AddVertexTC(drawPos - camera->right * size + camera->up * size, texture->xstart, texture->yend, color);
}
}
开发者ID:jamerlan,项目名称:spring,代码行数:30,代码来源:GenericParticleProjectile.cpp
示例3: dir1
void exportToHTML::createIndexFile(const QString &filePath,const QString &catName)
{
QDir dir1(filePath);
QStringList fileList = dir1.entryList(QDir::NoDotAndDotDot|QDir::Files,QDir::NoSort);
QString tempFileName;
QFile indexFile(filePath+"/index.html");
if(indexFile.open(QIODevice::WriteOnly))
{
QTextStream out(&indexFile);
out<<"<html>";
out<<"<head><title>"<<catName<<"</title></head>";
out<<"<body align=\"justify\">";
out<<"<h2 style='font-family:monospace'> Notes categorized under "<<catName<<"</h2>";
out<<"<ul>";
for(QStringList::const_iterator iter = fileList.begin(); iter!= fileList.end(); ++iter)
{
if(*iter == "index.html")
continue;
tempFileName = *iter;
tempFileName.remove(tempFileName.size()-5,5);
out<<"<li><a href=\"./"<<*iter<<"\">"<<tempFileName<<"</a></li>\n";
}
out<<"</ul>";
out<<"</body>";
out<<"</html>";
}
}
开发者ID:Abijeet,项目名称:org-note,代码行数:30,代码来源:exporttohtml.cpp
示例4: dif
void CGeoSquareProjectile::Draw(void)
{
inArray=true;
unsigned char col[4];
col[0]=(unsigned char) (r*a*255);
col[1]=(unsigned char) (g*a*255);
col[2]=(unsigned char) (b*a*255);
col[3]=(unsigned char) (a*255);
float3 dif(p1-camera->pos);
dif.Normalize();
float3 dir1(dif.cross(v1));
dir1.Normalize();
float3 dif2(p2-camera->pos);
dif2.Normalize();
float3 dir2(dif2.cross(v2));
dir2.Normalize();
if(w2!=0){
va->AddVertexTC(p1-dir1*w1,1.0/16,1.0/8,col);
va->AddVertexTC(p1+dir1*w1,1.0/16,0.0/8,col);
va->AddVertexTC(p2+dir2*w2,1.0/16,0.0/8,col);
va->AddVertexTC(p2-dir2*w2,1.0/16,1.0/8,col);
} else {
va->AddVertexTC(p1-dir1*w1,1.0/16,1.0/8,col);
va->AddVertexTC(p1+dir1*w1,1.0/16,0.0/8,col);
va->AddVertexTC(p2+dir2*w2,1.0/16,0.5/8,col);
va->AddVertexTC(p2-dir2*w2,1.0/16,1.5/8,col);
}
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:30,代码来源:GeoSquareProjectile.cpp
示例5: dif
void CGeoSquareProjectile::Draw()
{
inArray = true;
unsigned char col[4];
col[0] = (unsigned char) (r * a * 255);
col[1] = (unsigned char) (g * a * 255);
col[2] = (unsigned char) (b * a * 255);
col[3] = (unsigned char) ( a * 255);
float3 dif(p1 - camera->GetPos());
dif.ANormalize();
float3 dir1(dif.cross(v1));
dir1.ANormalize();
float3 dif2(p2 - camera->GetPos());
dif2.ANormalize();
float3 dir2(dif2.cross(v2));
dir2.ANormalize();
const float u = (projectileDrawer->geosquaretex->xstart + projectileDrawer->geosquaretex->xend) / 2;
const float v0 = projectileDrawer->geosquaretex->ystart;
const float v1 = projectileDrawer->geosquaretex->yend;
if (w2 != 0) {
va->AddVertexTC(p1 - dir1 * w1, u, v1, col);
va->AddVertexTC(p1 + dir1 * w1, u, v0, col);
va->AddVertexTC(p2 + dir2 * w2, u, v0, col);
va->AddVertexTC(p2 - dir2 * w2, u, v1, col);
} else {
va->AddVertexTC(p1 - dir1 * w1, u, v1, col);
va->AddVertexTC(p1 + dir1 * w1, u, v0, col);
va->AddVertexTC(p2, u, v0 + (v1 - v0) * 0.5f, col);
va->AddVertexTC(p2, u, v0 + (v1 - v0) * 1.5f, col);
}
}
开发者ID:304471720,项目名称:spring,代码行数:35,代码来源:GeoSquareProjectile.cpp
示例6: QString
void MainWindow::LoadContest(const QString& path)
{
if (!QDir(path).exists())
{
QMessageBox::critical(this, "无法打开竞赛", QString("%1\n路径不存在或已被移除。").arg(path));
QSettings set("ccr.ini", QSettings::IniFormat);
QStringList list = set.value("RecentContestList").toStringList();
list.removeAll(path);
set.setValue("RecentContestList", list);
UpdateRecentContest(true);
return;
}
QDir dir1(path + "/src"), dir2(path + "/data");
if (!dir1.exists() || !dir2.exists())
if (QMessageBox::question(this, "找不到试题或选手目录", "是否继续打开并创建子目录?") == QMessageBox::No) return;
if (!dir1.exists() && !QDir(path).mkdir("src"))
{
QMessageBox::critical(this, "无法创建子目录", "创建子目录失败!");
return;
}
if (!dir2.exists() && !QDir(path).mkdir("data"))
{
QMessageBox::critical(this, "无法创建子目录", "创建子目录失败!");
return;
}
if (!Global::g_is_contest_closed) CloseContest();
lastContest = path;
Global::g_contest.SetPath(path);
QSettings set("ccr.ini", QSettings::IniFormat);
QStringList list = set.value("RecentContestList").toStringList();
if (!list.count(path)) list.prepend(path);
set.setValue("RecentContestList", list);
set.setValue("LastContest", lastContest);
UpdateRecentContest(false);
ui->label_top->hide();
ui->label_bottom->hide();
ui->listWidget_recent->hide();
close_button->show();
this->setWindowTitle(path + " - CCR Plus 测评器");
ui->action_close->setEnabled(true);
ui->action_configure->setEnabled(true);
ui->action_set_list->setEnabled(true);
ui->action_export->setEnabled(true);
ui->action_refresh->setEnabled(true);
ui->action_judge_selected->setEnabled(true);
ui->action_judge_unjudged->setEnabled(true);
ui->action_judge_all->setEnabled(true);
ui->action_stop->setEnabled(false);
Global::g_is_judge_stoped = false;
Global::g_is_contest_closed = false;
LoadTable();
}
开发者ID:equation314,项目名称:CCR-Plus,代码行数:60,代码来源:mainwindow.cpp
示例7: TEST
TEST( ResourceDependenciesGraph, removingDir )
{
ResourceDependenciesGraph graph;
FilePath file( "/directory1/a.res" );
FilePath res1( "/directory2/b.tmat" );
FilePath res2( "/directory3/c.tmat" );
FilePath dir1( "/directory1" );
FilePath dir2( "/directory2" );
FilePath dir3( "/directory3" );
graph.addDependency( file, res1 );
graph.addDependency( file, res2 );
CPPUNIT_ASSERT_EQUAL( ( uint ) 2, graph.getAffectedResources( file ).size() );
graph.onDirRemoved( dir2 );
CPPUNIT_ASSERT_EQUAL( ( uint ) 1, graph.getAffectedResources( file ).size() );
CPPUNIT_ASSERT_EQUAL( res2.getRelativePath(), graph.getAffectedResources( file ).front().getRelativePath() );
graph.onDirRemoved( dir3 );
CPPUNIT_ASSERT_EQUAL( ( uint ) 0, graph.getAffectedResources( file ).size() );
graph.addDependency( file, res1 );
graph.addDependency( file, res2 );
CPPUNIT_ASSERT_EQUAL( ( uint ) 2, graph.getAffectedResources( file ).size() );
graph.onDirRemoved( dir1 );
CPPUNIT_ASSERT_EQUAL( ( uint ) 0, graph.getAffectedResources( file ).size() );
}
开发者ID:dabroz,项目名称:Tamy,代码行数:29,代码来源:ResourcesDependenciesTreeTests.cpp
示例8: u
void KBookmarkManager::slotNotify( const char *_url )
{
if ( !m_bNotify )
return;
KURL u( _url );
if ( strcmp( u.protocol(), "file" ) != 0 )
return;
QString p = kapp->localkdedir().data();
p += "/share/apps/kfm/bookmarks";
QDir dir2( p );
QDir dir1( u.path() );
QString p1( dir1.canonicalPath() );
QString p2( dir2.canonicalPath() );
if ( p1.isEmpty() )
p1 = u.path();
if ( p2.isEmpty() )
p2 = p.data();
if ( strncmp( p1.data(), p2.data(), p2.length() ) == 0 )
{
QString d = kapp->localkdedir().data();
d += "/share/apps/kfm/bookmarks/";
scan( d );
}
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:28,代码来源:bookmark.cpp
示例9: test01_shRotation
void test01_shRotation() {
/* Generate a random SH expansion, rotate it and
spot-check 100 times against the original evaluated
at appropriately rotated positions */
ref<Random> random = new Random();
int bands = 8;
SHVector vec1(bands);
for (int l=0; l<bands; ++l)
for (int m=-l; m<=l; ++m)
vec1(l, m) = random->nextFloat();
Vector axis(squareToSphere(Point2(random->nextFloat(), random->nextFloat())));
Transform trafo = Transform::rotate(axis, random->nextFloat()*360);
Transform inv = trafo.inverse();
SHRotation rot(vec1.getBands());
SHVector::rotation(trafo, rot);
SHVector vec2(bands);
rot(vec1, vec2);
for (int i=0; i<100; ++i) {
Vector dir1(squareToSphere(Point2(random->nextFloat(), random->nextFloat()))), dir2;
trafo(dir1, dir2);
Float value1 = vec1.eval(dir2);
Float value2 = vec2.eval(dir1);
assertEqualsEpsilon(value1, value2, Epsilon);
}
}
开发者ID:aledoronin,项目名称:3D_Hair_Rendering,代码行数:32,代码来源:test_sh.cpp
示例10: dir
void Request::modifyProduct(const std::vector<std::string> &splitVector) {
std::string id = splitVector[1];
std::string nombre = splitVector[2];
std::string descripcion = splitVector[3];
std::string cant = splitVector[4];
std::stringstream s;
int cantImagenes;
s << cant;
s >> cantImagenes;
/**/
this->getCommunication()->send(utils::OK_MESSAGE);
catalog->updateProduct(id,nombre,descripcion);
std::string pathIcono = catalog->getPathProductIcons(id);
utils::Directory dir (pathIcono);
dir.remove();
dir.make(pathIcono);
receiveImage(pathIcono);
std::string path = catalog->getPathProductImages(id);
utils::Directory dir1 (path);
dir1.remove();
dir1.make(path);
for(unsigned int i = 0; i < cantImagenes; i++){
receiveImage(path);
}
}
开发者ID:horacioMartinez,项目名称:facultad,代码行数:25,代码来源:Request.cpp
示例11: dif
void InMapDraw_QuadDrawer::DrawQuad(int x, int y)
{
int drawQuadsX = imd->drawQuadsX;
CInMapDraw::DrawQuad* dq = &imd->drawQuads[y * drawQuadsX + x];
va->EnlargeArrays(dq->points.size()*12,0,VA_SIZE_TC);
//! draw point markers
for (std::list<CInMapDraw::MapPoint>::iterator pi = dq->points.begin(); pi != dq->points.end(); ++pi) {
if (pi->MaySee(imd)) {
float3 pos = pi->pos;
float3 dif(pos - camera->pos);
dif.ANormalize();
float3 dir1(dif.cross(UpVector));
dir1.ANormalize();
float3 dir2(dif.cross(dir1));
unsigned char col[4];
col[0] = pi->color[0];
col[1] = pi->color[1];
col[2] = pi->color[2];
col[3] = 200;
float size = 6;
float3 pos1 = pos;
pos1.y += 5.0f;
float3 pos2 = pos1;
pos2.y += 100.0f;
va->AddVertexQTC(pos1 - dir1 * size, 0.25f, 0, col);
va->AddVertexQTC(pos1 + dir1 * size, 0.25f, 1, col);
va->AddVertexQTC(pos1 + dir1 * size + dir2 * size, 0.00f, 1, col);
va->AddVertexQTC(pos1 - dir1 * size + dir2 * size, 0.00f, 0, col);
va->AddVertexQTC(pos1 - dir1 * size, 0.75f, 0, col);
va->AddVertexQTC(pos1 + dir1 * size, 0.75f, 1, col);
va->AddVertexQTC(pos2 + dir1 * size, 0.75f, 1, col);
va->AddVertexQTC(pos2 - dir1 * size, 0.75f, 0, col);
va->AddVertexQTC(pos2 - dir1 * size, 0.25f, 0, col);
va->AddVertexQTC(pos2 + dir1 * size, 0.25f, 1, col);
va->AddVertexQTC(pos2 + dir1 * size - dir2 * size, 0.00f, 1, col);
va->AddVertexQTC(pos2 - dir1 * size - dir2 * size, 0.00f, 0, col);
if (pi->label.size() > 0) {
font->SetTextColor(pi->color[0]/255.0f, pi->color[1]/255.0f, pi->color[2]/255.0f, 1.0f); //FIXME (overload!)
font->glWorldPrint(pos2 + UpVector * 6, 26.0f, pi->label);
}
}
}
lineva->EnlargeArrays(dq->lines.size()*2,0,VA_SIZE_C);
//! draw line markers
for (std::list<CInMapDraw::MapLine>::iterator li = dq->lines.begin(); li != dq->lines.end(); ++li) {
if (li->MaySee(imd)) {
lineva->AddVertexQC(li->pos - (li->pos - camera->pos).ANormalize() * 26, li->color);
lineva->AddVertexQC(li->pos2 - (li->pos2 - camera->pos).ANormalize() * 26, li->color);
}
}
}
开发者ID:tranchis,项目名称:spring,代码行数:59,代码来源:InMapDraw.cpp
示例12: TEST
TEST(Path, list)
{
cxx::sys::DirIterator dir1(cxx::sys::Path::curpath());
while(dir1 != cxx::sys::DirIterator()) {
printf("files: %s\n", dir1.name().c_str());
++dir1;
}
}
开发者ID:zigzed,项目名称:common,代码行数:8,代码来源:test_path.cpp
示例13: dif
void InMapDraw_QuadDrawer::DrawQuad (int x,int y)
{
int drawQuadsX = imd->drawQuadsX;
CInMapDraw::DrawQuad* dq=&imd->drawQuads[y*drawQuadsX+x];
for(std::list<CInMapDraw::MapPoint>::iterator pi=dq->points.begin();pi!=dq->points.end();++pi){
float3 pos=pi->pos;
float3 dif(pos-camera->pos);
float camDist=dif.Length();
dif/=camDist;
float3 dir1(dif.cross(UpVector));
dir1.Normalize();
float3 dir2(dif.cross(dir1));
unsigned char col[4];
col[0]=pi->color[0];
col[1]=pi->color[1];
col[2]=pi->color[2];
col[3]=200;//intensity*255;
float size=6;
float3 pos1=pos;
float3 pos2=pos1;
pos2.y+=100;
va->AddVertexTC(pos1-dir1*size, 0.25f,0,col);
va->AddVertexTC(pos1+dir1*size, 0.25f,1,col);
va->AddVertexTC(pos1+dir1*size+dir2*size, 0.00f,1,col);
va->AddVertexTC(pos1-dir1*size+dir2*size, 0.00f,0,col);
va->AddVertexTC(pos1-dir1*size,0.75f,0,col);
va->AddVertexTC(pos1+dir1*size,0.75f,1,col);
va->AddVertexTC(pos2+dir1*size,0.75f,1,col);
va->AddVertexTC(pos2-dir1*size,0.75f,0,col);
va->AddVertexTC(pos2-dir1*size, 0.25f,0,col);
va->AddVertexTC(pos2+dir1*size, 0.25f,1,col);
va->AddVertexTC(pos2+dir1*size-dir2*size, 0.00f,1,col);
va->AddVertexTC(pos2-dir1*size-dir2*size, 0.00f,0,col);
if(pi->label.size()>0){
glPushMatrix();
glTranslatef3(pi->pos+UpVector*105);
glScalef(30,30,30);
glColor4ub(pi->color[0],pi->color[1],pi->color[2],250);
font->glWorldPrint("%s",pi->label.c_str());
glPopMatrix();
glBindTexture(GL_TEXTURE_2D, texture);
}
}
for(std::list<CInMapDraw::MapLine>::iterator li=dq->lines.begin();li!=dq->lines.end();++li){
lineva->AddVertexC(li->pos-(li->pos - camera->pos).Normalize()*26,li->color);
lineva->AddVertexC(li->pos2-(li->pos2 - camera->pos).Normalize()*26,li->color);
}
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:57,代码来源:InMapDraw.cpp
示例14: dir1
void PhysicsSystem::doPhysics(float dt, const std::vector<std::pair<std::string, Ogre::Vector3> >& actors)
{
//set the DebugRenderingMode. To disable it,set it to 0
//eng->setDebugRenderingMode(1);
//set the walkdirection to 0 (no movement) for every actor)
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
{
OEngine::Physic::PhysicActor* act = it->second;
act->setWalkDirection(btVector3(0,0,0));
}
playerMove::playercmd& pm_ref = playerphysics->cmd;
pm_ref.rightmove = 0;
pm_ref.forwardmove = 0;
pm_ref.upmove = 0;
//playerphysics->ps.move_type = PM_NOCLIP;
for (std::vector<std::pair<std::string, Ogre::Vector3> >::const_iterator iter (actors.begin());
iter!=actors.end(); ++iter)
{
//dirty stuff to get the camera orientation. Must be changed!
Ogre::SceneNode *sceneNode = mRender.getScene()->getSceneNode (iter->first);
Ogre::Vector3 dir;
Ogre::Node* yawNode = sceneNode->getChildIterator().getNext();
Ogre::Node* pitchNode = yawNode->getChildIterator().getNext();
Ogre::Quaternion yawQuat = yawNode->getOrientation();
Ogre::Quaternion pitchQuat = pitchNode->getOrientation();
playerphysics->ps.viewangles.x = pitchQuat.getPitch().valueDegrees();
playerphysics->ps.viewangles.y = yawQuat.getYaw().valueDegrees() *-1 + 90;
Ogre::Quaternion quat = yawNode->getOrientation();
Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y);
pm_ref.rightmove = -iter->second.x;
pm_ref.forwardmove = -iter->second.y;
pm_ref.upmove = iter->second.z;
}
mEngine->stepSimulation(dt);
}
开发者ID:DeejStar,项目名称:openmw,代码行数:54,代码来源:physicssystem.cpp
示例15: rx
void ProjectDialog::on_buttonBox_clicked(QAbstractButton *button)
{
QString proj_name, proj_dir;
QDialogButtonBox::StandardButton stdButton = ui->buttonBox->standardButton(button);
if (stdButton != QDialogButtonBox::Cancel) {
proj_name = ui->projectNameEdit->text().simplified();
QRegExp rx("^[a-zA-Z0-9_\\.]+$");
if(!rx.exactMatch(proj_name)) {
xrs_error("Please insert a valid project name");
return;
}
proj_dir = ui->projectFolderEdit->text().simplified();
if (proj_dir=="") {
xrs_error("Please insert a valid folder name");
return;
}
QDir dir(proj_dir);
if (!dir.exists()) {
WarningDialog *cfd = new WarningDialog("Folder does not exist!\nDo you want to create it?");
//xrs_error("Folder does dot exist");
if (!cfd->exec()) return;
else if(!dir.mkpath(".")) {
xrs_error("Cannot create folder!");
return;
}
}
mainWindow->baseProjectFolder = proj_dir;
proj_dir = proj_dir + "/" + proj_name;
QDir dir1(proj_dir);
if (dir1.exists()) {
WarningDialog *efd = new WarningDialog(QString("Folder\n")+proj_dir+"\nalready exists!\nDo you want to overwrite it?");
if (!efd->exec()) return;
}
else if(!dir1.mkpath(".")) {
xrs_error("Cannot create folder!");
return;
}
mainWindow->tmpProjectFolder = proj_dir;
if (newProjectFlag) {
ProjTemplateDialog *proj_templ = new ProjTemplateDialog(mainWindow);
if (proj_templ->exec()) {
mainWindow->projectName = proj_name;
mainWindow->projectFolder = proj_dir;
close();
}
}
else {
mainWindow->tmpProjectName = proj_name;
mainWindow->tmpProjectFolder = proj_dir;
close();
}
}
}
开发者ID:golosio,项目名称:XRayStudio,代码行数:53,代码来源:projectdialog.cpp
示例16: dir1
QString Database::commonPath(QString path1, QString path2)
{
if(!path1.size() || !path2.size()) return "";
QDir dir1(path1), dir2(path2);
if(dir1.isRoot() || dir2.isRoot()) return "";
path1 = dir1.canonicalPath();
while(!dir2.isRoot()) {
if(path1.startsWith(dir2.canonicalPath())) return dir2.canonicalPath();
dir2.cdUp();
}
return "";
}
开发者ID:sushantg11,项目名称:cuberok,代码行数:12,代码来源:database.cpp
示例17: dir1
/**
* Initialize by three points
*
* This points are used:
*
* normal
* | p3
* | /
* | /
* | /
* p1---------------p2
*
* d1 = p2 - p1
* d2 = p3 - p1
* n = d1 x d2
*/
void srs::CTestingPlane::set(const tPoint & p1, const tPoint & p2, const tPoint & p3)
{
// Compute directional vectors
tPoint dir1( p2 - p1 ), dir2( p3 - p1 );
// Get normal vector from cross-product
m_plane = dir1;
m_plane.cross(dir2);
m_plane.normalize();
// Compute last parameter
m_d = - p1.dot( m_plane );
}
开发者ID:Mazet,项目名称:srs_public,代码行数:29,代码来源:TestingPlanes.cpp
示例18: dif
void CSimpleParticleSystem::Draw()
{
inArray=true;
va->EnlargeArrays(numParticles*4,0,VA_SIZE_TC);
if(directional)
{
for(int i=0; i<numParticles; i++)
{
if(particles[i].life<1.0f)
{
float3 dif(particles[i].pos-camera->pos);
dif.ANormalize();
float3 dir1(dif.cross(particles[i].speed));
dir1.ANormalize();
float3 dir2(dif.cross(dir1));
unsigned char color[4];
colorMap->GetColor(color, particles[i].life);
float3 interPos=particles[i].pos+particles[i].speed*gu->timeOffset;
float size = particles[i].size;
va->AddVertexQTC(interPos-dir1*size-dir2*size,texture->xstart,texture->ystart,color);
va->AddVertexQTC(interPos-dir1*size+dir2*size,texture->xend ,texture->ystart,color);
va->AddVertexQTC(interPos+dir1*size+dir2*size,texture->xend ,texture->yend ,color);
va->AddVertexQTC(interPos+dir1*size-dir2*size,texture->xstart,texture->yend ,color);
}
}
}
else
{
unsigned char color[4];
for(int i=0; i<numParticles; i++)
{
Particle* p = &particles[i];
if(p->life<1.0f)
{
colorMap->GetColor(color, p->life);
float3 interPos=p->pos+p->speed*gu->timeOffset;
const float3 cameraRight = camera->right*p->size;
const float3 cameraUp = camera->up*p->size;
va->AddVertexQTC(interPos-cameraRight-cameraUp,texture->xstart,texture->ystart,color);
va->AddVertexQTC(interPos+cameraRight-cameraUp,texture->xend ,texture->ystart,color);
va->AddVertexQTC(interPos+cameraRight+cameraUp,texture->xend ,texture->yend ,color);
va->AddVertexQTC(interPos-cameraRight+cameraUp,texture->xstart,texture->yend ,color);
}
}
}
}
开发者ID:Gepard,项目名称:spring,代码行数:50,代码来源:SimpleParticleSystem.cpp
示例19: dir1
QZip::QZip(const QString &zipFileName,const QString &zipPathName)
{
_zipFileName = zipFileName;
_zipPathName = zipPathName;
QDir dir1(".");
dir1.setCurrent(".");
_zipFileName = dir1.absoluteFilePath(_zipFileName);
QDir dir2(_zipPathName);
if(!dir2.isAbsolute()){
_zipPathName = dir2.absolutePath();
}
}
开发者ID:BackupTheBerlios,项目名称:sim-im,代码行数:14,代码来源:qzip.cpp
示例20: dif
void CBeamLaserProjectile::Draw(void)
{
inArray=true;
float3 dif(pos-camera->pos);
float camDist=dif.Length();
dif/=camDist;
float3 dir=endPos-startPos;
dir.Normalize();
float3 dir1(dif.cross(dir));
dir1.Normalize();
float3 dir2(dif.cross(dir1));
unsigned char col[4];
col[0]=(unsigned char)(color.x*startAlpha);
col[1]=(unsigned char)(color.y*startAlpha);
col[2]=(unsigned char)(color.z*startAlpha);
col[3]=1;//intensity*255;
unsigned char col2[4];
col2[0]=(unsigned char)(color.x*endAlpha);
col2[1]=(unsigned char)(color.y*endAlpha);
col2[2]=(unsigned char)(color.z*endAlpha);
col2[3]=1;//intensity*255;
float size=thickness;
float3 pos1=startPos;
float3 pos2=endPos;
if(camDist<1000){
va->AddVertexTC(pos1-dir1*size, 15.0/16,0, col);
va->AddVertexTC(pos1+dir1*size, 15.0/16,1.0/8,col);
va->AddVertexTC(pos1+dir1*size-dir2*size, 14.0/16,1.0/8,col);
va->AddVertexTC(pos1-dir1*size-dir2*size, 14.0/16,0 ,col);
va->AddVertexTC(pos1-dir1*size,11.0/16,0, col);
va->AddVertexTC(pos1+dir1*size,11.0/16,1.0/8,col);
va->AddVertexTC(pos2+dir1*size,11.0/16,1.0/8,col2);
va->AddVertexTC(pos2-dir1*size,11.0/16,0 ,col2);
va->AddVertexTC(pos2-dir1*size, 15.0/16,0, col2);
va->AddVertexTC(pos2+dir1*size, 15.0/16,1.0/8,col2);
va->AddVertexTC(pos2+dir1*size+dir2*size, 14.0/16,1.0/8,col2);
va->AddVertexTC(pos2-dir1*size+dir2*size, 14.0/16,0 ,col2);
} else {
va->AddVertexTC(pos1-dir1*size,11.0/16,0, col);
va->AddVertexTC(pos1+dir1*size,11.0/16,1.0/8,col);
va->AddVertexTC(pos2+dir1*size,11.0/16,1.0/8,col2);
va->AddVertexTC(pos2-dir1*size,11.0/16,0 ,col2);
}
}
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:50,代码来源:BeamLaserProjectile.cpp
注:本文中的dir1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论