您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vec3f函数代码示例

51自学网 2021-06-03 09:35:52
  C++
这篇教程C++ vec3f函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中vec3f函数的典型用法代码示例。如果您正苦于以下问题:C++ vec3f函数的具体用法?C++ vec3f怎么用?C++ vec3f使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了vec3f函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getTilesToUpdate

void UpdateRiversTask::getTilesToUpdate(TerrainInfo &terrain, ptr<TerrainQuad> q){    if (q->visible == SceneManager::INVISIBLE) {        return;    }    if (q->isLeaf() == false) {        getTilesToUpdate(terrain, q->children[0]);        getTilesToUpdate(terrain, q->children[1]);        getTilesToUpdate(terrain, q->children[2]);        getTilesToUpdate(terrain, q->children[3]);        return;    }    vec3i v = vec3i(q->level, q->tx, q->ty);    vec3f f = vec3f(q->ox, q->oy, q->l);    terrain.displayedTiles.push_back(make_pair(v, f));}
开发者ID:AzeronX,项目名称:proland-4.0,代码行数:18,


示例2: vec3f

void ParticleSystem::reset(float radius){	vec4f *pos = m_pos->map();	for (size_t i = 0; i < m_size; i++) {		vec3f generated_vec3 = vec3f(sfrand(), sfrand(), sfrand());		generated_vec3 = normalize(generated_vec3) * radius;		pos[i] = vec4f(generated_vec3, 1.0);	}	m_pos->unmap();		vec4f *vel = m_vel->map();	for (size_t i = 0; i < m_size; i++) {				float max_velocity = 0.02f;		vel[i] = vec4f(sfrand()*max_velocity, sfrand()*max_velocity, sfrand()*max_velocity, 0.0f);	}	m_vel->unmap();}
开发者ID:1753592,项目名称:GraphicsSamples,代码行数:18,


示例3: vec3f

/* draw * * Draw the model. Don't forget to apply the transformations necessary * for position, orientation, and scale. */void objecthdl::draw(canvashdl *canvas){	canvas->translate(position);	canvas->rotate(orientation[0], vec3f(1.0, 0.0, 0.0));	canvas->rotate(orientation[1], vec3f(0.0, 1.0, 0.0));	canvas->rotate(orientation[2], vec3f(0.0, 0.0, 1.0));	canvas->scale(vec3f(scale, scale, scale));	for (int i = 0; i < rigid.size(); i++)	{		canvas->uniform["material"] = material[rigid[i].material];		rigid[i].draw(canvas);	}	canvas->scale(vec3f(1.0/scale, 1.0/scale, 1.0/scale));	canvas->rotate(-orientation[2], vec3f(0.0, 0.0, 1.0));	canvas->rotate(-orientation[1], vec3f(0.0, 1.0, 0.0));	canvas->rotate(-orientation[0], vec3f(1.0, 0.0, 0.0));	canvas->translate(-position);}
开发者ID:cornell-cs5620,项目名称:assignment3,代码行数:25,


示例4: getParam1i

  void Renderer::commit()  {    autoEpsilon = getParam1i("autoEpsilon", true);    epsilon = getParam1f("epsilon", 1e-6f);    spp = std::max(1, getParam1i("spp", 1));    const int32 maxDepth = getParam1i("maxDepth", 20);    const float minContribution = getParam1f("minContribution", 0.001f);    errorThreshold = getParam1f("varianceThreshold", 0.f);    maxDepthTexture = (Texture2D*)getParamObject("maxDepthTexture", nullptr);    model = (Model*)getParamObject("model", getParamObject("world"));    if (maxDepthTexture) {      if (maxDepthTexture->type != OSP_TEXTURE_R32F          || !(maxDepthTexture->flags & OSP_TEXTURE_FILTER_NEAREST)) {        static WarnOnce warning("maxDepthTexture provided to the renderer "                                "needs to be of type OSP_TEXTURE_R32F and have "                                "the OSP_TEXTURE_FILTER_NEAREST flag");      }    }    vec3f bgColor3 = getParam3f("bgColor", vec3f(getParam1f("bgColor", 0.f)));    bgColor = getParam4f("bgColor", vec4f(bgColor3, 0.f));    if (getIE()) {      ManagedObject* camera = getParamObject("camera");      if (model) {        const float diameter = model->bounds.empty() ?                               1.0f : length(model->bounds.size());        epsilon *= diameter;      }      ispc::Renderer_set(getIE()          , model ? model->getIE() : nullptr          , camera ? camera->getIE() : nullptr          , autoEpsilon          , epsilon          , spp          , maxDepth          , minContribution          , (ispc::vec4f&)bgColor          , maxDepthTexture ? maxDepthTexture->getIE() : nullptr          );    }  }
开发者ID:ingowald,项目名称:OSPRay,代码行数:44,


示例5: getProducerId

bool ForestOrthoLayer::doCreateTile(int level, int tx, int ty, TileStorage::Slot *data){    if (Logger::DEBUG_LOGGER != NULL) {        ostringstream oss;        oss << "OrthoForest tile " << getProducerId() << " " << level << " " << tx << " " << ty;        Logger::DEBUG_LOGGER->log("ORTHO", oss.str());    }    if (level >= displayLevel) {        ptr<FrameBuffer> fb  = SceneManager::getCurrentFrameBuffer();        TileCache::Tile * t = graphProducer->findTile(level, tx, ty);        assert(t != NULL);        ObjectTileStorage::ObjectSlot *graphData = dynamic_cast<ObjectTileStorage::ObjectSlot*>(t->getData());        GraphPtr g = graphData->data.cast<Graph>();        if (g != NULL) {            vec3d q = getTileCoords(level, tx, ty);            float scale = 2.0f * (1.0f - getTileBorder() * 2.0f / getTileSize()) / q.z;            vec3d tileOffset = vec3d(q.x + q.z / 2.0f, q.y + q.z / 2.0f, scale);            //offsetU->set(vec3f(q.x + q.z / 2.0f, q.y + q.z / 2.0f, scale));            offsetU->set(vec3f(0.0, 0.0, 1.0));            colorU->set(vec4f(color.x, color.y, color.z, color.w));            mesh->setMode(TRIANGLES);            mesh->clear();            ptr<Graph::AreaIterator> ai = g->getAreas();            while (ai->hasNext()) {                AreaPtr a = ai->next();                tess->beginPolygon(mesh);                drawArea(tileOffset, a, *tess);                tess->endPolygon();            }            fb->draw(layerProgram, *mesh);        } else {            if (Logger::DEBUG_LOGGER != NULL) {                ostringstream oss;                oss << "NULL Graph : " << level << " " << tx << " " << ty;                Logger::DEBUG_LOGGER->log("GRAPH", oss.str());            }        }    }    return true;}
开发者ID:AzeronX,项目名称:proland-4.0,代码行数:43,


示例6: vec3f

PositionSlider::PositionSlider(float percent) {    this->percent = percent;    font = fontmanager.grab("FreeSans.ttf", 16);    font.dropShadow(true);    int gap = display.width / 30;    bounds.update(vec2f(gap, display.height - gap*2));    bounds.update(vec2f(display.width - gap, display.height - gap));    slidercol = vec3f(1.0, 1.0, 1.0);    mouseover = -1.0;    mouseover_elapsed = 1.0;    fade_time = 1.0;    alpha = 0.0;}
开发者ID:Br3nda,项目名称:Gource,代码行数:19,


示例7: vec3f

void ZoomCamera::logic(float dt) {    vec3f dp = (dest - pos);    vec3f dpt = dp * dt * speed;    if(lockon) {        dpt = dpt * lockon_time + dp * (1.0-lockon_time);        if(lockon_time>0.0) {            lockon_time = std::max(0.0f, lockon_time-dt*0.5f);        }    }    if(dpt.length2() > dp.length2()) dpt = dp;    pos += dpt;    target = vec3f(pos.x, pos.y, 0.0);}
开发者ID:Br3nda,项目名称:Gource,代码行数:19,


示例8: assert

void polyline_road::xml_read(xmlpp::TextReader &reader, const vec3f &scale){    assert(is_opening_element(reader, "line_rep"));    read_to_open(reader, "points");        std::cout<<"abcd"<<std::endl;    do    {        read_skip_comment(reader);        if(reader.get_node_type() == xmlpp::TextReader::Text ||           reader.get_node_type() == xmlpp::TextReader::SignificantWhitespace)        {	    //std::cout<<"BE CAREFUL, NEED TEST! (hwm_xml_read.cpp)"<<std::endl;	  	    std::string res(reader.get_value());	    std::stringstream s1(res);	    std::string line;	    while(getline(s1, line, '/n')) {	      	      std::istringstream s2(line);	      vec3f pos;	      s2 >> pos[0];	      s2 >> pos[1];	      s2 >> pos[2];	      	      if((std::abs(pos[0] - 0) < 1e-6 && std::abs(pos[1] - 0) < 1e-6 && std::abs(pos[2] - 0) < 1e-6))		continue;	      	      points_.push_back(vec3f(pos*scale));	      	    }        }    }    while(!is_closing_element(reader, "points"));    if(!initialize())        throw xml_error(reader, "Failed to initialize polyine");    read_to_close(reader, "line_rep");}
开发者ID:persimmon2014,项目名称:Roadie-dev,代码行数:42,


示例9: parser

	//----------------------------------------------------------------------	void ReverbArea::loadReverbAreasFromXMLFile( const std::string& filePath, const std::string& file )	{		std::string fullFilePath = filePath + file;		XMLParser parser( fullFilePath.c_str() );		XMLDocument& doc = parser.getDocument();		XMLNode* root = doc.FirstChildElement( "ReverbAreas" );		XMLNode* reverbAreaElement = nullptr;		for( reverbAreaElement = root->FirstChildElement( "ReverbArea" ); reverbAreaElement != nullptr; reverbAreaElement = reverbAreaElement->NextSiblingElement( "ReverbArea" ) )		{			parser.validateXMLAttributes( reverbAreaElement, "name,pos,minDist,maxDist", "preset" );			std::string raName = parser.getXMLAttributeAsString( reverbAreaElement, "name", "" );			vec3f pos = parser.getXMLAttributeAsVec3( reverbAreaElement, "pos", vec3f() );			float minDist = parser.getXMLAttributeAsFloat( reverbAreaElement, "minDist", 0.0f );			float maxDist = parser.getXMLAttributeAsFloat( reverbAreaElement, "maxDist", 0.1f );			std::string preset = parser.getXMLAttributeAsString( reverbAreaElement, "preset", "MONKY_PRESET_OFF" );			ReverbArea* ra = ReverbArea::createOrGetReverbArea( raName, getMonkyReverbPresetFromString( preset ) );			ra->set3DAttributes( pos, minDist, maxDist );		}	}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:21,


示例10: getDirection

vec3f DirectionalLight::shadowAttenuation( const vec3f& P ) const{	vec3f d = getDirection(P);	// loop to get the attenuation	vec3f curP = P;	isect isecP;	vec3f ret = getColor(P);	ray r = ray(curP, d);	while (scene->intersect(r, isecP))	{		//if not transparent return black		if (isecP.getMaterial().kt.iszero()) return vec3f(0, 0, 0);		//use current intersection point as new light source		curP = r.at(isecP.t);		r = ray(curP, d);		ret = prod(ret, isecP.getMaterial().kt);	}	return ret;}
开发者ID:JeffOwOSun,项目名称:Trace,代码行数:20,


示例11: glClearColor

GLLightScreen::GLLightScreen():lightPos(0, 0, 0){	glClearColor(0, 0, 0, 1);	P.frustum(-0.01, 0.01, -0.006, 0.006, 0.01, 1000);	GLShaderPtr vertShader = new GLShader("D:/GitHub/GPEngine/GPGame/Shaders/GLSL/pointlight.vert", ShaderType::VERTEX_SHADER);	GLShaderPtr fragShader = new GLShader("D:/GitHub/GPEngine/GPGame/Shaders/GLSL/pointlight.frag", ShaderType::FRAG_SHADER);	program.attachShader(vertShader);	program.attachShader(fragShader);	program.link();	posHandle = glGetAttribLocation(program, "vPos");	normalHandle = glGetAttribLocation(program, "vNormal");	lightPosHandle = glGetUniformLocation(program, "vLightPos");	mvpHandle = glGetUniformLocation(program, "vMVP");	mHandle = glGetUniformLocation(program, "vMV");	shininessHandle = glGetUniformLocation(program, "shininess");	createCube(vec3f(0, 0, -25), 10);}
开发者ID:gustplus,项目名称:GPengine,代码行数:20,


示例12: main

int main (){  printf ("Results of utility_quat_to_matrix_test:/n");    quatf q = to_quat (degree (90.0f), vec3f (0, 0, 1));    dump ("q", q);  dump ("to_matrix (q)", to_matrix (q));    mat3f m1;  mat4f m2;    to_matrix (q, m1);  to_matrix (q, m2);    dump ("to_matrix (q, m1)", m1);  dump ("to_matrix (q, m2)", m2);  return 0;}
开发者ID:untgames,项目名称:funner,代码行数:20,


示例13: sizeof

void PlanarRectangle::InitBary( const Rectangle & rect, const vec3f & integrationPoint ){	// copy src points here	std::memcpy( &p0, &rect.p0, 4 * sizeof( vec3f ) );	const vec3f bary = ( p0 + p1 + p2 + p3 ) * 0.25f;	vec3f org = Normalize( bary - integrationPoint );	const f32 rayLenSqr = Dot( org, org );	const f32 rayLen = std::sqrt( rayLenSqr );	const vec3f nrm = org / rayLen;	// org is bary in relative coordinates	const Plane P{ org, nrm };	// project each point on the plane P	vec3f *verts = &p0;	for ( int i = 0; i < 4; ++i )	{		vec3f rayDir = Normalize( verts[i] - integrationPoint );		// with 0 as origin since the vertices are in relative coordinates already		verts[i] = P.RayIntersection( vec3f( 0 ), rayDir );	}	const vec3f d0 = p1 - p0;	const vec3f d1 = p3 - p0;	const vec3f d2 = p2 - p3;	const vec3f d3 = p2 - p1;	w = Len( d0 );	h = Len( d1 );	ex = d0 / w;	ey = d1 / h;	ez = nrm; // normal pointing away from origin	area = 0.5f * ( w * h + Len( d2 ) * Len( d3 ) );}
开发者ID:Adrian-Revk,项目名称:radar,代码行数:41,


示例14: vec3f

void Logger::recordSignatureColorPostDraw(MyD3DAssets &assets, const DrawParameters &params, const GPUDrawBuffers &buffers){    if (!capturingColorSignature)    {        return;    }    assets.context->readRenderTarget(postRenderImage);    vec3f diffSum = vec3f::origin;    int diffCount = 0;    for (auto &p : postRenderImage)    {        if (p.value != preRenderImage(p.x, p.y))        {            diffSum += vec3f(p.value.getVec3()) / 255.0f;            diffCount++;        }    }    newSignaturesThisFrame++;    colorMap.record(params.signature, diffCount == 0 ? vec3f::origin : diffSum / (float)diffCount, diffCount);    if (!geoDatabase.hasSignature(params.signature))    {        LocalizedObject object;        object.load(assets, params, buffers, true);        object.center();        if (object.data.signature != params.signature) logErrorFile << "inconsistent signatures" << endl;        Bitmap diffImage = postRenderImage;        for (auto &p : diffImage)        {            if (p.value == preRenderImage(p.x, p.y))            {                p.value = vec4uc(0, 0, 0, 255);            }        }        geoDatabase.record(object, diffImage);    }}
开发者ID:techmatt,项目名称:d3d11-interceptor,代码行数:41,


示例15: HuetoRGB

vec3f HuetoRGB(float h) {    float r, g, b;    h /= ( 2.0 * M_PI * (1.0 / 6.0) );    while(h >= 6.0f) h -= 6.0f;    int i = floor( h );    float f = h - i;    float q = 1 - 1 * f;    float t = 1 - 1 * ( 1 - f );	switch( i ) {        case 0: r = 1; g = t; b = 0; break;        case 1: r = q; g = 1; b = 0; break;        case 2: r = 0; g = 1; b = t; break;        case 3: r = 0; g = q; b = 1; break;        case 4: r = t; g = 0; b = 1; break;        case 5: default:                r = 1; g = 0; b = q; break;    }    return vec3f(r,g,b);}
开发者ID:Dirbaio,项目名称:Gita2,代码行数:21,


示例16: getColor

vec3f PointLight::_shadowAttenuation(const vec3f& P, const ray& r) const{	double distance = (position - P).length();	vec3f d = r.getDirection();	vec3f result = getColor(P);	vec3f curP = r.getPosition();	isect isecP;	ray newr(curP, d);	while (scene->intersect(newr, isecP))	{		//prevent going beyond this light		if ((distance -= isecP.t) < RAY_EPSILON) return result;		//if not transparent return black		if (isecP.getMaterial().kt.iszero()) return vec3f(0, 0, 0);		//use current intersection point as new light source		curP = r.at(isecP.t);		newr = ray(curP, d);		result = prod(result, isecP.getMaterial().kt);	}	return result;}
开发者ID:JeffOwOSun,项目名称:Trace,代码行数:21,


示例17: vec3f

void CComponent_PlayerCollision::Shutdown(void){	m_bPrevInGoo = false;	m_bInGoo = false;	m_pSoundComponent = nullptr;	m_fInitiateWallSlideTimer = 0.0f;	_isWallSliding = false;	m_pAnimationComponent = nullptr;	_CollidingWallRight = false;	_CollidingWallLeft = false;	m_WallJumpPushOutVector = vec3f(0.0f, 0.0f, 0.0f);	m_InputMng = nullptr;	m_pPlayerCollisionVolume = nullptr;	m_pHealthComponent = nullptr;	m_pInputComp = nullptr;	this->CleanRemoveVelocity();	CParticleManager::GetInstance()->DestroyEffect( m_pWallSlideEffect );}
开发者ID:Ethanthecrazy,项目名称:PudgeNSludge,代码行数:21,


示例18: vec3f

void StackGraph::drawTransition(float dt) {    Bounds2D moving_bounds;    moving_bounds.min = selected_bounds.min * in_transition + section_bounds.min * (1.0 - in_transition);    moving_bounds.max = selected_bounds.max * in_transition + section_bounds.max * (1.0 - in_transition);    vec3f moving_colour = vec3f(1.0, 1.0, 1.0);    vec3f moving_colour2 = moving_colour * 0.3;    glBegin(GL_QUADS);        glColor3fv(moving_colour);        glVertex2f(moving_bounds.min.x, moving_bounds.min.y);        glVertex2f(moving_bounds.max.x, moving_bounds.min.y);        glColor3fv(moving_colour2);        glVertex2f(moving_bounds.max.x, moving_bounds.max.y);        glVertex2f(moving_bounds.min.x, moving_bounds.max.y);    glEnd();}
开发者ID:acaudwell,项目名称:ConfHUD,代码行数:21,


示例19: init

	void init(TRIANGLE * t, int n)	{		for(int i = 0; i < n; ++i)		{			vec3f v1(t[i].p[0].x,t[i].p[0].y,t[i].p[0].z);			vec3f v2(t[i].p[1].x,t[i].p[1].y,t[i].p[1].z);			vec3f v3(t[i].p[2].x,t[i].p[2].y,t[i].p[2].z);			Tri tri;			tri.i = insertPoint(v1);			tri.j = insertPoint(v2);			tri.k = insertPoint(v3);			tri.norm = vec3f(t[i].norm.x,t[i].norm.y, t[i].norm.z);			tris.push_back(tri);		}		std::cout << "Inserted " << vecs.size() << " unique points from " << n*3 << "original points/n";		calcNormals();	}
开发者ID:Christoopher,项目名称:FLIP3D,代码行数:22,


示例20: teleport

void teleport(int n, game::dynent *d) { // also used by monsters#if 0 // TODO  int e = -1, tag = ents[n].attr1, beenhere = -1;  for (;;) {    e = world::findentity(TELEDEST, e+1);    if (e==beenhere || e<0) {      con::out("no teleport destination for tag %d", tag);      return;    }    if (beenhere<0) beenhere = e;    if (ents[e].attr2==tag) {      d->o = vec3f(ents[e].x, ents[e].y, ents[e].z);      d->vel = zero;      d->ypr.x = ents[e].attr1;      d->ypr.y = 0.f;      entinmap(d);      sound::playc(sound::TELEPORT);      break;    }  }#endif}
开发者ID:bsegovia,项目名称:mini.q,代码行数:22,


示例21: glGetIntegerv

void ParticleUpsampling::draw(void){    GLuint prevFBO = 0;    // Enum has MANY names based on extension/version    // but they all map to 0x8CA6    glGetIntegerv(0x8CA6, (GLint*)&prevFBO);    CHECK_GL_ERROR();    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    matrix4f rotationMatrix, translationMatrix;    nv::rotationY(rotationMatrix, m_transformer->getRotationVec().y);    nv::translation(translationMatrix, 0.f, 0.f, -5.f);    translationMatrix.set_scale(vec3f(-1.0, 1.0, -1.0));    m_sceneRenderer->setEyeViewMatrix(translationMatrix * rotationMatrix);    m_sceneRenderer->renderFrame();    glBindFramebuffer(GL_FRAMEBUFFER, prevFBO);    glViewport(0, 0, m_width, m_height);}
开发者ID:Ninglin,项目名称:OpenGLSamples,代码行数:22,


示例22: shape_sample_uniform

frame3f shape_sample_uniform(Shape* shape, const vec2f& uv) {    if(is<Sphere>(shape)) {        auto sphere = cast<Sphere>(shape);        // see: http://mathworld.wolfram.com/SpherePointPicking.html        float z = 1 - 2*uv.y;        float rxy = sqrt(1-z*z);        float phi = 2*pif*uv.x;        vec3f pl = vec3f(rxy*cos(phi),rxy*sin(phi),z);        frame3f f;        f.o = sphere->center + pl * sphere->radius;        f.z = normalize(pl);        f = orthonormalize(f);        return f;    }    else if(is<Quad>(shape)) {        auto quad = cast<Quad>(shape);        frame3f f = identity_frame3f;        f.o = (uv.x-0.5f)*quad->width*x3f + (uv.y-0.5f)*quad->height*y3f;        return f;    }    else { not_implemented_error(); return identity_frame3f; }}
开发者ID:cpastuszenski,项目名称:cs77_assignment2,代码行数:22,


示例23: snoise3d_tricerp_file

float snoise3d_tricerp_file(vector3f p){	#define _data(vx, vy, vz) snoise3d_data[((vx) % snoise_size.x) + ((vy) % snoise_size.y)*snoise_size.x + ((vz) % snoise_size.z)*snoise_size.x*snoise_size.y]		int int_px = (int) p.x;	int int_py = (int) p.y;	int int_pz = (int) p.z;		float v000 = _data( int_px,     int_py,     int_pz );	float v100 = _data( int_px + 1, int_py,     int_pz );	float v101 = _data( int_px + 1, int_py,     int_pz + 1 );	float v001 = _data( int_px,     int_py,     int_pz + 1 );		float v010 = _data( int_px,     int_py + 1, int_pz );	float v110 = _data( int_px + 1, int_py + 1, int_pz );	float v111 = _data( int_px + 1, int_py + 1, int_pz + 1 );	float v011 = _data( int_px,     int_py + 1, int_pz + 1 );		vector3f t = vec3f( p.x-int_px, p.y-int_py, p.z-int_pz);		return tricerp(v000, v100, v101, v001, v010, v110, v111, v011, t);}
开发者ID:RealSfera,项目名称:VRender,代码行数:22,


示例24: snoise3d_init_file

void snoise3d_init_file(const char *filename, vector3ui snoise3d_size){	IF_FAILED(filename);		FILE *file = NULL;		snoise_size = snoise3d_size;		// существует файл с шумом ?...	if((file = fopen(filename, "rb")) == NULL) {		// ...файла нет, значит нужно создать		ERROR_MSG("cannot open file %s with noise; creating it/n", filename);				snoise3d_data = (float*) malloc(sizeof(float) * snoise_size.x*snoise_size.y*snoise_size.z);				file = fopen(filename, "w");				for(unsigned k = 0; k < snoise_size.z; k++) {			for(unsigned j = 0; j < snoise_size.y; j++) {				for(unsigned i = 0; i < snoise_size.x; i++) {					snoise3d_data[i + j*snoise_size.x + k*snoise_size.x*snoise_size.y] = 							simplex_noise_3d(vec3f(i, j ,k));				}			}		}		fwrite((void*) snoise3d_data, sizeof(float), snoise_size.x*snoise_size.y*snoise_size.z, file);		fclose(file);	} else {		unsigned size = snoise3d_size.x*snoise3d_size.y*snoise3d_size.z;		// ...файл есть, читаем данные		snoise3d_data = (float*) malloc(sizeof(float) * size);		unsigned read_bytes = fread((void*) snoise3d_data, sizeof(float), size, file);		if(read_bytes*sizeof(float) != size*sizeof(float)) {			ERROR_MSG("cannot read 3d noise data; file = %s/n", filename);		}		fclose(file);	}}
开发者ID:RealSfera,项目名称:VRender,代码行数:38,


示例25: Pawn

RFile::RFile(const std::string & name, const vec3f & colour, const vec2f & pos, int tagid) : Pawn(name,pos,tagid) {    hidden = true;    size = gGourceFileDiameter;    radius = size * 0.5;    setGraphic(gGourceSettings.file_graphic);    speed = 5.0;    nametime = 4.0;    name_interval = nametime;    namecol     = vec3f(1.0, 1.0, 1.0);    file_colour = colour;    last_action = 0.0;    expiring=false;    removing=false;    shadow = true;    distance = 0;    this->fullpath = name;    this->name = name;    path_hash = 0;    setPath();    namelist = glGenLists(1);    font = 0;    setSelected(false);    dir = 0;    if(path.size()) path_hash = stringHash(path);}
开发者ID:Br3nda,项目名称:Gource,代码行数:38,


示例26: MALLOC

dynent *newdynent() {  dynent *d = (dynent*) MALLOC(sizeof(dynent));  d->o = zero;  d->ypr = vec3f(270.f,0.f,0.f);  d->maxspeed = 22.f;  d->outsidemap = false;  d->inwater = false;  d->radius = 0.5f;  d->o.y = d->eyeheight = 1.8f;  d->aboveeye = 0.2f;  d->frags = 0;  d->plag = 0;  d->ping = 0;  d->lastupdate = int(lastmillis());  d->enemy = NULL;  d->monsterstate = 0;  d->name[0] = d->team[0] = 0;  d->blocked = false;  d->lifesequence = 0;  d->state = CS_ALIVE;  spawnstate(d);  return d;}
开发者ID:bsegovia,项目名称:mini.q,代码行数:23,


示例27: main

int main (){  printf ("Results of node_transform_scale_test:/n");    Node::Pointer node (Node::Create ());      printf ("set scale vec3f result: ");  node->SetScale (vec3f (14.4f, 17.1f, -6.66f));  dump_scale (*node);  printf ("/n");  printf ("set scale (sx, sy, sz) result: ");  node->SetScale (0.f, 27.14f, 6.12f);  dump_scale (*node);  printf ("/n");  printf ("reset scale result: ");  node->ResetScale ();  dump_scale (*node);  printf ("/n");    return 0;}
开发者ID:untgames,项目名称:funner,代码行数:23,


示例28: m_mapSize

	MSMap::MSMap( const vec2f& mapOffsetFromPlayerPos, float floorTileX, float floorTileY, float mapWidth, float mapHeight, const std::string& floorTileMaterial )		:	m_mapSize( mapWidth, floorTileY )		,	m_screenSize( mapWidth, mapHeight )		,	m_lastLayerSpawnedOn( 0 )		,	m_rateToDecreaseSpawnRate( 0.5f )		,	m_currentSpawnRate( MAX_SPAWN_RATE )		,	m_spawnTimer( MAX_SPAWN_RATE )		,	m_verticalOffsetBetweenLayers( 50.0f )		,	m_playerSpawn( vec2f( mapWidth * 0.5f, mapHeight * 0.5f ) - vec2f(0.0f, 50.0f ) )		,	m_mapOffsetFromPlayerPos( mapOffsetFromPlayerPos )	{		m_currentObstaclesOnMap.resize( STARTING_NUMBER_LAYERS );		GenerateMapMesh( floorTileX, floorTileY, mapWidth, floorTileMaterial );		m_mapYPos = ( m_screenSize.y - m_mapSize.y ) * 0.5f;		for( int i = 0; i < NUM_PLATFORMS_TO_SPAWN; ++i )		{			m_platformRenderLocations.push_back( vec3f( m_mapSize.x * i, m_mapYPos ) );		}	}
开发者ID:hulcyp,项目名称:GuildhallProjects,代码行数:23,



注:本文中的vec3f函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ vec4函数代码示例
C++ vec3_sub函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。