这篇教程C++ vec2i函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vec2i函数的典型用法代码示例。如果您正苦于以下问题:C++ vec2i函数的具体用法?C++ vec2i怎么用?C++ vec2i使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vec2i函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: print_stroked vec2i print_stroked( const drawer out, vec2i pos, const formatted_string& str, const ralign_flags c, const rgba stroke_color, const unsigned wrapping_width, const ltrbi clipper, const bool use_kerning ) { thread_local drafter draft; thread_local printer print; draft.wrap_width = wrapping_width; draft.kerning = use_kerning; draft.draw(str); auto coloured_str = str; for (auto& col : coloured_str) { col.set_color(stroke_color); } thread_local formatted_utf32_string prev; prev = draft.cached_str; draft.cached_str = coloured_str; if (c.test(ralign::CX)) { pos.x -= draft.get_bbox().x / 2; } if (c.test(ralign::CY)) { pos.y -= draft.get_bbox().y / 2; } if (c.test(ralign::RB)) { pos -= draft.get_bbox(); } if (c.test(ralign::LB)) { pos.y -= draft.get_bbox().y; } if (c.test(ralign::RT)) { pos.x -= draft.get_bbox().x; } print.draw_text(out, pos + vec2i(-1, 0), draft, clipper); print.draw_text(out, pos + vec2i(1, 0), draft, clipper); print.draw_text(out, pos + vec2i(0, -1), draft, clipper); print.draw_text(out, pos + vec2i(0, 1), draft, clipper); draft.cached_str = prev; print.draw_text(out, pos, draft, clipper); return draft.get_bbox() + vec2i(2, 2); }
开发者ID:TeamHypersomnia,项目名称:Augmentations,代码行数:60,
示例2: vec2ivoid Player::HitAbove(){ const Tile & B = Level->GetBlockAt(GridLocationExt - vec2i(0,1)); if (B.BlockID == 15) { Level->SetBlockAt(GridLocationExt-vec2i(0,1),Tile(0,false)); }}
开发者ID:Termites,项目名称:BasicPlatformer,代码行数:8,
示例3: GetWindowSizestatic vec2i GetWindowSize() { if (UseHardwareScaling()) { return vec2i(kAndroidMaxScreenWidth, kAndroidMaxScreenHeight); } else { return vec2i(std::numeric_limits<int>::max(), std::numeric_limits<int>::max()); }}
开发者ID:Haris07,项目名称:zooshi,代码行数:8,
示例4: _tesselate_mesh_once/// Tesselate Mesh one time/// @param mesh The Mesh to tesselate/// @return The tesselated MeshMesh* _tesselate_mesh_once(Mesh* mesh) { auto tesselation = new Mesh(); // Set up the hashtable for adjacency auto adj = EdgeHashTable(mesh->triangle, mesh->quad); // Add vertices to the tessellation tesselation->pos = mesh->pos; // tesselation->norm = mesh->norm; // tesselation->texcoord = mesh->texcoord; // Add edge vertices to the tessellation int evo = tesselation->pos.size(); for(auto e : adj.edges) { tesselation->pos.push_back(mesh->pos[e.x]*0.5+mesh->pos[e.y]*0.5); // if(not tesselation->norm.empty()) tesselation->norm.push_back(normalize(mesh->norm[e.x]*0.5+mesh->norm[e.y]*0.5)); // if(not tesselation->texcoord.empty()) tesselation->texcoord.push_back(mesh->texcoord[e.x]*0.5+mesh->texcoord[e.y]*0.5); } // Add face vertices to the tessellation int fvo = tesselation->pos.size(); for(auto f : mesh->quad) { tesselation->pos.push_back(mesh->pos[f.x]*0.25+mesh->pos[f.y]*0.25+mesh->pos[f.z]*0.25+mesh->pos[f.w]*0.25); // if(not tesselation->texcoord.empty()) tesselation->texcoord.push_back(mesh->texcoord[f.x]*0.25+mesh->texcoord[f.y]*0.25+mesh->texcoord[f.z]*0.25+mesh->texcoord[f.w]*0.25); } // Add triangles to the tessellation for(auto f : mesh->triangle) { auto ve = vec3i(adj.edge(f.x, f.y),adj.edge(f.y, f.z),adj.edge(f.z, f.x))+vec3i(evo,evo,evo); tesselation->triangle.push_back(vec3i(f.x,ve.x,ve.z)); tesselation->triangle.push_back(vec3i(f.y,ve.y,ve.x)); tesselation->triangle.push_back(vec3i(f.z,ve.z,ve.y)); tesselation->triangle.push_back(ve); } // Add quads to the tessellation for(int fid = 0; fid < mesh->quad.size(); fid ++) { auto f = mesh->quad[fid]; auto ve = vec4i(adj.edge(f.x, f.y),adj.edge(f.y, f.z),adj.edge(f.z, f.w),adj.edge(f.w, f.x))+vec4i(evo,evo,evo,evo); auto vf = fid+fvo; tesselation->quad.push_back(vec4i(f.x,ve.x,vf,ve.w)); tesselation->quad.push_back(vec4i(f.y,ve.y,vf,ve.x)); tesselation->quad.push_back(vec4i(f.z,ve.z,vf,ve.y)); tesselation->quad.push_back(vec4i(f.w,ve.w,vf,ve.z)); } // Add lines to the tessellation if(mesh->_tesselation_lines.size() > 0) { for(auto l : mesh->_tesselation_lines) { int ve = adj.edge(l.x, l.y)+evo; tesselation->_tesselation_lines.push_back(vec2i(l.x,ve)); tesselation->_tesselation_lines.push_back(vec2i(ve,l.y)); } } return tesselation;}
开发者ID:cpastuszenski,项目名称:cs77_assignment2,代码行数:60,
示例5: vec2i// staticvoid InputImpl::init() { mousePos = vec2i(0, 0); mouseWheelPos = vec2i(0, 0); relativeMouse = false; for(int i = 0; i < Keyboard::KeyCount; i++) keyPresses[i] = false; for(int i = 0; i < Mouse::ButtonCount; i++) mouseButtonPresses[i] = false;}
开发者ID:Dirbaio,项目名称:VBE,代码行数:11,
示例6: imvoid tile_picker::scroll_event(int newx, image *screen){ int yo=y,ya=pich(),xw=picw(),c=get_current(),xo; image im(vec2i(xw, ya)); last_sel=newx; screen->bar(x,y,x+l-1,y+h-1,wm->black()); for (int i=newx; i<newx+th*wid; i++) { xo=x+((i-newx)%wid)*xw; yo=y+((i-newx)/wid)*ya; int blank=0; if (i<t) { switch (type) { case SPEC_FORETILE : { if (foretiles[i]<0) blank=1; else { im.clear(); the_game->get_fg(i)->im->PutImage(&im,vec2i(0,0)); if (rev) { screen->bar(xo,yo,xo+xw-1,yo+ya-1,wm->bright_color()); scale_put_trans(&im,screen,xo,yo,xw,ya); } else scale_put(&im,screen,xo,yo,xw,ya); } } break; case SPEC_BACKTILE : { if (backtiles[i]<0) blank=1; else scale_put(the_game->get_bg(i)->im,screen,xo,yo,xw,ya); } break; case SPEC_CHARACTER : { figures[i]->get_sequence(stopped)->get_figure(0)->forward->PutImage(&im,vec2i(0,0)); scale_put(&im,screen,xo,yo,xw,ya); } break; } } else blank=1; if (i==c) screen->rectangle(xo,yo,xo+xw-1,yo+ya-1,wm->bright_color()); }}
开发者ID:DeejStar,项目名称:abuse-SDL2,代码行数:54,
示例7: EntityBasePlayer::Player(const vec2f & Location) : EntityBase(Location){ CurrentSprite = R->LoadSprite("fario",vec2i(17,17),vec2i(0,0)); AnimationList = R->LoadAnimationSet("Fario"); PlayAnimation("idle"); SpriteOffset=vec2i(8,17); JumpSound = R->LoadSound("MarioJump"); LandSound = R->LoadSound("FarioLandB"); //BrickDestroyed = R.LoadSound("BrickDestroyed"); AirControl = 0.4; Accel = 0.25; Height=1;}
开发者ID:Termites,项目名称:BasicPlatformer,代码行数:14,
示例8: glyphBuffervoid Service::drawWidgets() { core::BufferAllocator glyphBuffer(sizeof(rendering::text::Glyph)*128,&services::tasking()->threadContext().frameAllocator(),core::BufferAllocator::GrowOnOverflow); events::Draw drawEvent; drawEvent.layerId = 0; drawEvent.renderer = renderer_; drawEvent.glyphExtractionBuffer = &glyphBuffer; drawEvent.position = vec2i(0,0); drawEvent.size = vec2i(rootSize_.x,rootSize_.y); Widget widget; widget.addComponent(root_); widget.draw(drawEvent); renderer_->prepareRendering();}
开发者ID:hyp,项目名称:Arpheg,代码行数:15,
示例9: if/*! /fn SqlGameTable::getPlayerGameTime( uint32_t _nTableID, uint32_t &_nGameTime ) */bool SqlGameTable::getPlayerGameTime( uint32_t _nTableID, uint8_t _nPlayerNum, uint32_t &_nGameTime ){ TVecChar vecData; const char* cszFieldName = 0; if (_nPlayerNum == 0) { cszFieldName = "Player0GameTime"; } else if (_nPlayerNum == 1) { cszFieldName = "Player1GameTime"; } else { return false; } if( !SelectToStr( cszFieldName, "TableID", CMyStr( _nTableID ).c_str(), &vecData ) ) { return false; } _nGameTime = vec2i( &vecData ); return true;}
开发者ID:hukka-mail-ru,项目名称:chess,代码行数:30,
示例10: boxVerticesToScreenVerticesstatic inline void boxVerticesToScreenVertices(vec4f vertices[8],const vec4f& screenCenterMul,vec2i screenCenter){#ifdef ARPHEG_ARCH_X86 __m128 screenSpaceMul = _mm_load_ps((float*)&screenCenterMul.x); __m128 screenCenterOffset = _mm_setr_ps(float(screenCenter.x),float(screenCenter.y),0,0); __m128 nearClip = _mm_setzero_ps(); for(uint32 i = 0;i<8;++i){ __m128 hv = _mm_load_ps((float*)(vertices + i)); __m128 w = _mm_shuffle_ps(hv,hv,_MM_SHUFFLE(3,3,3,3)); //get the w component __m128 z = _mm_shuffle_ps(hv,hv,_MM_SHUFFLE(2,2,2,2)); hv = _mm_div_ps(hv,w); //Project XYZW to clip space (divide by w) hv = _mm_mul_ps(hv,screenSpaceMul); //XY to screen space [-width/2,-height/2 -> width/2,height/2] hv = _mm_add_ps(hv,screenCenterOffset);//XY to screen space [0,0 -> width,height] __m128 mNoNearClip = _mm_cmpge_ps(z, nearClip ); //Set to all-0 if near-clipped hv = _mm_and_ps(hv, mNoNearClip); _mm_store_ps((float*)(vertices + i),hv); }#else //TODO ScreenSpaceVertex* screenVerts= (ScreenSpaceVertex*)vertices; for(uint32 i =0;i<8;++i){ vertices[i] = vertices[i] * (1.0f/vertices[i].w) ; auto v = vertices[i] * screenCenterMul; screenVerts[i].pos = vec2i(int32(v.x),int32(v.y))+screenCenter; }#endif}
开发者ID:hyp,项目名称:Arpheg,代码行数:31,
示例11: vec2ivoid LDEgui_elements::addCombobox( LDEgui_combobox *arg ){ combobox.push_back( arg ); LDEuint pointer = combobox.size()-1; combobox[pointer]->button.font = font_elements; combobox[pointer]->button.texture_rel = texture_combobox; combobox[pointer]->button.texture_coi = texture_combobox_hover; combobox[pointer]->button.texture_pre = texture_combobox_pressed; combobox[pointer]->button.name = "?"; combobox[pointer]->font_item = font_elements; combobox[pointer]->texture_item = texture_button_rel; combobox[pointer]->texture_item_hover = texture_button_coi; combobox[pointer]->texture_item_pressed = texture_button_pre; combobox[pointer]->size = vec2i( 80, 16 ); combobox[pointer]->button.uv_up = 8; combobox[pointer]->button.uv_down = 8; combobox[pointer]->button.uv_left = 9; combobox[pointer]->button.uv_right = 14; combobox[pointer]->menu_item = menu_item;}
开发者ID:HappyLDE,项目名称:Faya-Editor,代码行数:26,
示例12: vec2ibool Texture::load(const std::string &filePath) { //load image sf::Image image; if (!image.loadFromFile(filePath)) { std::cout << "#ERROR " << filePath << " didn't load" << std::endl; return false; } size = vec2i(image.getSize().x,image.getSize().y); //get handle GLuint tex_handle; glGenTextures(1, &tex_handle); handle = tex_handle; //bind handle and set to image bind(); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, image.getSize().x, image.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr() ); setFilter(GL_NEAREST); setWrap(GL_REPEAT); return true;}
开发者ID:Dirbaio,项目名称:Gita2,代码行数:26,
示例13: captureDepthBuffer void D3D11RenderTarget::captureDepthBuffer(DepthImage32& result, const mat4f& perspectiveTransform) { captureDepthBuffer(result); const mat4f inv = perspectiveTransform.getInverse(); //result.setInvalidValue(std::numeric_limits<float>::infinity()); //the default is -INF for (unsigned int y = 0; y < result.getHeight(); y++) { for (unsigned int x = 0; x < result.getWidth(); x++) { float &v = result(x, y); if (v >= 1.0f) v = result.getInvalidValue(); else { //float dx = math::linearMap(0.0f, result.getWidth() - 1.0f, -1.0f, 1.0f, (float)x); //float dy = math::linearMap(0.0f, result.getHeight() - 1.0f, -1.0f, 1.0f, (float)y); //v = (inv * vec3f(dx, dy, v)).z; vec2f p = D3D11GraphicsDevice::pixelToNDC(vec2i(x, y), result.getWidth(), result.getHeight()); v = (inv * vec3f(p.x, p.y, v)).z; } } } }
开发者ID:billbliss3,项目名称:Opt,代码行数:25,
示例14: vec2ivoid Vizzer::drawText(ApplicationData &app, vector<string> &text){ int y = 0; for (auto &entry : text) { font.drawString(app.graphics, entry, vec2i(10, 5 + y++ * 25), 24.0f, RGBColor::Red); }}
开发者ID:caomw,项目名称:FREAK-bundler,代码行数:8,
示例15: vec2ibool EditorHandler::mousePassiveMotion(int x, int y){ if (editors.empty()) { return false; } lastPos = vec2i(x, y); return false;}
开发者ID:AzeronX,项目名称:proland-4.0,代码行数:8,
示例16: cursorOnItvoid LDEgui_drawable::draw( vec2i cursor, LDEfloat frametime ){ coi = cursorOnIt( cursor ); //glEnable(GL_SCISSOR_TEST); //LDEscissor(pos.x, pos.y, size.x, size.y); scene( vec2i(pos.x+x,pos.y+y), size, test_coi && coi ? 1 : 0, frametime ); //glDisable(GL_SCISSOR_TEST);}
开发者ID:HappyLDE,项目名称:Faya-Editor,代码行数:9,
示例17: FrameBuffer LocalFrameBuffer::LocalFrameBuffer(const vec2i &size, ColorBufferFormat colorBufferFormat, const uint32 channels, void *colorBufferToUse) : FrameBuffer(size, colorBufferFormat, channels) , tileErrorRegion(hasVarianceBuffer ? getNumTiles() : vec2i(0)) { Assert(size.x > 0); Assert(size.y > 0); if (colorBufferToUse) colorBuffer = colorBufferToUse; else { switch (colorBufferFormat) { case OSP_FB_NONE: colorBuffer = nullptr; break; case OSP_FB_RGBA8: case OSP_FB_SRGBA: colorBuffer = (uint32*)alignedMalloc(sizeof(uint32)*size.x*size.y); break; case OSP_FB_RGBA32F: colorBuffer = (vec4f*)alignedMalloc(sizeof(vec4f)*size.x*size.y); break; } } depthBuffer = hasDepthBuffer ? alignedMalloc<float>(size.x*size.y) : nullptr; accumBuffer = hasAccumBuffer ? alignedMalloc<vec4f>(size.x*size.y) : nullptr; const size_t bytes = sizeof(int32)*getTotalTiles(); tileAccumID = (int32*)alignedMalloc(bytes); memset(tileAccumID, 0, bytes); varianceBuffer = hasVarianceBuffer ? alignedMalloc<vec4f>(size.x*size.y) : nullptr; normalBuffer = hasNormalBuffer ? alignedMalloc<vec3f>(size.x*size.y) : nullptr; albedoBuffer = hasAlbedoBuffer ? alignedMalloc<vec3f>(size.x*size.y) : nullptr; ispcEquivalent = ispc::LocalFrameBuffer_create(this,size.x,size.y, colorBufferFormat, colorBuffer, depthBuffer, accumBuffer, varianceBuffer, normalBuffer, albedoBuffer, tileAccumID); }
开发者ID:ingowald,项目名称:OSPRay,代码行数:56,
示例18: EntityBaseTileEntity::TileEntity(const vec2i&Location) : EntityBase(vec2i()){ TileLocation = Location; this->Location = TileLocation*16; this->GridLocation = Location; this->GridLocationExt = Location; Physic = PHYS_None;}
开发者ID:Termites,项目名称:BasicPlatformer,代码行数:10,
示例19: memsetvoid LocalFrameBuffer::clear(const uint32 fbChannelFlags){ if (fbChannelFlags & OSP_FB_ACCUM) { // it is only necessary to reset the accumID, // LocalFrameBuffer_accumulateTile takes care of clearing the // accumulation buffers memset(tileAccumID, 0, tiles*sizeof(int32)); // always also clear error buffer (if present) if (hasVarianceBuffer) { for (int i = 0; i < tiles; i++) tileErrorBuffer[i] = inf; errorRegion.clear(); // initially create one region covering the complete image errorRegion.push_back(box2i(vec2i(0), vec2i(tilesx, divRoundUp(size.y, TILE_SIZE)))); } }}
开发者ID:BlueBrain,项目名称:OSPRay,代码行数:19,
示例20: assert vec2i Material::getParam(const char *name, vec2i defaultVal) { ParamMap::iterator it = params.find(name); if (it != params.end()) { assert( it->second->type == Param::INT_2 && "Param type mismatch" ); return vec2i(it->second->i[0], it->second->i[1]); } return defaultVal; }
开发者ID:Acidburn0zzz,项目名称:OSPRay,代码行数:10,
示例21: vec2ibool SqlGameTable::getBet( uint32_t _nTableID, uint32_t& bet ){ TVecChar vecData; if( !SelectToStr( "Bet", "TableID", CMyStr( _nTableID ).c_str(), &vecData ) ) return false; bet = vec2i( &vecData ); return true;}
开发者ID:hukka-mail-ru,项目名称:chess,代码行数:10,
示例22: initvoid init(){ _log::init(); srand(time(0)); glfwSetErrorCallback(_glfwError); glfwInit(); window::createWindow(vec2i(1024, 600), "123"); render::initRender(); glEnable(GL_LINE_SMOOTH);}
开发者ID:pelmenka,项目名称:131,代码行数:11,
示例23: unloadChunkvoid cWorld::unloadAll(){ for (int y = 0; y < LIMIT_MAP; y++) { for (int x = 0; x < LIMIT_MAP; x++) { if (map[x][y].isLoaded) { unloadChunk(vec2i(x, y)); } } }}
开发者ID:Kos94ok,项目名称:CivEngine,代码行数:12,
注:本文中的vec2i函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vec3函数代码示例 C++ vec2d函数代码示例 |