当前位置: 首页>>代码示例>>C++>>正文


C++ ivec2类代码示例

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


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

示例1: ivec4

    explicit ivec4(const ivec2& v, GLint z, GLint w)
    {
	    mVec[0] = v.x();
	    mVec[1] = v.y();
	    mVec[2] = z;
	    mVec[3] = w;
    }
开发者ID:cody82,项目名称:simquadcopter,代码行数:7,代码来源:ivec4.hpp

示例2: resize

void
ClipExample::
resize(ivec2 new_size, ivec2 old_size)
{
  float_orthogonal_projection_params proj_params(0, new_size.x(), new_size.y(), 0);
  m_layer->simulation_matrix(WRATHLayer::projection_matrix, float4x4(proj_params));
  glViewport(0, 0, new_size.x(), new_size.y());

  WRATHDefaultRectAttributePacker::Rect::handle rect;  
  
  rect=WRATHNew WRATHDefaultRectAttributePacker::Rect(new_size.x(), new_size.y());
  rect->m_brush_stretch=vec2(m_images[0]->size())/vec2(new_size);
  m_background_widget->set_parameters(rect); 

  rect->m_brush_stretch=vec2(m_images[1]->size())/vec2(new_size);
  m_background_widget2->set_parameters(rect);

  
  for(unsigned int i=0, endi=m_widgets.size(); i<endi; ++i)
    {
      vec2 pos;
      pos=m_widgets[i]->position();
      pos.x()*=static_cast<float>(new_size.x())/static_cast<float>(old_size.x());
      pos.y()*=static_cast<float>(new_size.y())/static_cast<float>(old_size.y());
      m_widgets[i]->position(pos);
    }
}
开发者ID:nomovok-opensource,项目名称:wrath,代码行数:27,代码来源:wavy_clip2.cpp

示例3:

	ai::distance_t ai::path::heuristic_distance_from(const ivec2 & cell) const {
		const icoord_t dx = std::abs(goal_.x() - cell.x());
		const icoord_t dy = std::abs(goal_.y() - cell.y());
		
		return (boost::math::constants::root_two<distance_t>() - 2.0f)
			* std::min(dx, dy) + dx + dy;
	}
开发者ID:Nexuapex,项目名称:Harmony,代码行数:7,代码来源:ai_path.cpp

示例4: create_pixel_data

void
WRATHTextureFontFreeType_Coverage::glyph_mipmap_level::
create_pixel_data(ivec2 sz)
{
  m_pixels.resize( sz.x()*sz.y(), 0);
  m_size=sz;
  
  for(int yy=0; yy<m_raw_size.y() and yy<sz.y(); ++yy)
    {
      for(int xx=0; xx<m_raw_size.x() and xx<sz.x(); ++xx)
        {
          int location, loctionbitmap;
          uint8_t v;
    
          location= xx + yy*sz.x();
          loctionbitmap=xx + 
            (m_raw_size.y()-1-yy)*m_raw_pitch;
          
          WRATHassert(loctionbitmap<static_cast<int>(m_raw_pixels_from_freetype.size()));

          v=m_raw_pixels_from_freetype[loctionbitmap];
          m_pixels[location]=v;
        }
    }
}
开发者ID:nomovok-opensource,项目名称:wrath,代码行数:25,代码来源:WRATHTextureFontFreeType_Coverage.cpp

示例5: on_create_texture_page

void
WRATHTextureFontFreeType_Coverage::
on_create_texture_page(ivec2 texture_size,
                       std::vector<float> &custom_data)
{
  custom_data.resize(2);
  custom_data[0]=1.0f/static_cast<float>(std::max(1, texture_size.x()) );
  custom_data[1]=1.0f/static_cast<float>(std::max(1, texture_size.y()) );
}
开发者ID:nomovok-opensource,项目名称:wrath,代码行数:9,代码来源:WRATHTextureFontFreeType_Coverage.cpp

示例6: new_offset

	ivec2 gx::atlas_renderer::next_offset(const ivec2 & offset, const ivec2 & atlas_size, gl::size_t tile_size) const {
		// Advance in the x direction.
		ivec2 new_offset(offset.x() + tile_size, offset.y());
		
		// If needed, go down to a new row.
		if ((new_offset.x() + tile_size) > atlas_size.x()) {
			new_offset.set_x(0);
			new_offset.set_y(offset.y() + tile_size);
		}
		
		return new_offset;
	}
开发者ID:Nexuapex,项目名称:Harmony,代码行数:12,代码来源:gx_atlas_renderer.cpp

示例7:

	gx::sprite::sprite(const std::string & name, const std::string & suffix,
		ivec2 size)
		: name_(name), suffix_(suffix), size_(size)
	{
		// Useful temporaries.
		const gl::float_t w = static_cast<gl::float_t>(size.x()) / 2.0f;
		const gl::float_t h = static_cast<gl::float_t>(size.y()) / 2.0f;
		
		// The vertices of this sprite.
		vertices_[0][0] = -w; vertices_[0][1] = -h; // Top left.
		vertices_[1][0] = -w; vertices_[1][1] = +h; // Bottom left.
		vertices_[2][0] = +w; vertices_[2][1] = +h; // Bottom right.
		vertices_[3][0] = +w; vertices_[3][1] = -h; // Top right.
	}
开发者ID:Nexuapex,项目名称:Harmony,代码行数:14,代码来源:gx_sprite.cpp

示例8: tmpp

void esvg::Document::generateAnImage(ivec2 _size, draw::Image& _output)
{
	generateAnImage(_size.x(), _size.y());
	_output.resize(_size);
	draw::Color tmpp(0,0,0,0);
	_output.setFillColor(tmpp);
	_output.clear();
	if(NULL != m_renderedElement) {
		uint8_t* pointerOnData = m_renderedElement->getDataPointer();
		int32_t  sizeData = m_renderedElement->getDataSize();
		uint8_t* tmpOut = (uint8_t*)_output.getTextureDataPointer();
		memcpy(tmpOut, pointerOnData, sizeData);
	}
}
开发者ID:chagge,项目名称:esvg,代码行数:14,代码来源:esvg.cpp

示例9: CurvePairGenerator

/////////////////////////////////////////////
// fastuidraw::detail::CurvePairGenerator methods
fastuidraw::detail::CurvePairGenerator::
CurvePairGenerator(FT_Outline outline, ivec2 bitmap_sz, ivec2 bitmap_offset,
                   GlyphRenderDataCurvePair &output)
{
  geometry_data_filter::handle filter;

  filter = FASTUIDRAWnew MakeEvenFilter();
  geometry_data gmt(NULL, m_pts, filter);

  /*
    usually we set the inflate factor to be 4,
    from that:
     - we want all end points of curves to be even integers
     - some points in the outline from FreeType are given implicitely
    as an _average_ or 2 points
    However, we generate quadratics from cubics which
    generates end points with a divide by _64_. But that
    is an insane inflate factor that will likely cause
    overflows. So, we ignore the unlikely possibility that
    a generated end point from breaking up cubics into
    quadratics would lie on a texel boundary.
    */
  int outline_scale_factor(4), bias(-1);
  CoordinateConverter coordinate_converter(outline_scale_factor, bitmap_sz, bitmap_offset, bias);

  CollapsingContourEmitter *contour_emitter;
  TaggedOutlineData *outline_data;
  float curvature_collapse(0.05f);

  contour_emitter = FASTUIDRAWnew CollapsingContourEmitter(curvature_collapse, outline, coordinate_converter);
  outline_data = FASTUIDRAWnew TaggedOutlineData(contour_emitter, gmt);

  m_contour_emitter = contour_emitter;
  m_outline_data = outline_data;

  if(bitmap_sz.x() != 0 && bitmap_sz.y() != 0)
    {
      output.resize_active_curve_pair(bitmap_sz + ivec2(1, 1));
    }
  else
    {
      output.resize_active_curve_pair(ivec2(0, 0));
    }
}
开发者ID:cjcappel,项目名称:fastuidraw,代码行数:46,代码来源:freetype_curvepair_util.cpp

示例10: printPart

void ewol::compositing::Sprite::printSprite(const ivec2& _spriteID, const vec3& _size) {
    if(    _spriteID.x()<0
            || _spriteID.y()<0
            || _spriteID.x() >= m_nbSprite.x()
            || _spriteID.y() >= m_nbSprite.y()) {
        return;
    }
    printPart(vec2(_size.x(),_size.y()),
              vec2((float)(_spriteID.x()  )*m_unitarySpriteSize.x(), (float)(_spriteID.y()  )*m_unitarySpriteSize.y()),
              vec2((float)(_spriteID.x()+1)*m_unitarySpriteSize.x(), (float)(_spriteID.y()+1)*m_unitarySpriteSize.y()));
}
开发者ID:atria-soft,项目名称:ewol,代码行数:11,代码来源:Sprite.cpp

示例11:

bool operator==(ivec2 const& u1, ivec2 const& u2)
{
    return u1.x()==u2.x() && u1.y()==u2.y();
}
开发者ID:maximebrunengo,项目名称:graphic_engine_simulation,代码行数:4,代码来源:ivec2.cpp

示例12: print

				/**
				 * @brief add a compleate of the image to display with the requested size
				 * @param[in] _size size of the output image
				 */
				void print(const ivec2& _size) {
					print(vec2(_size.x(),_size.y()));
				};
开发者ID:atria-soft,项目名称:ewol,代码行数:7,代码来源:Image.hpp

示例13:

	unsigned gx::atlas_renderer::tile_count_for_possible_size(const ivec2 & size, gl::size_t tile_size) const {
		return (size.x() / tile_size) * (size.y() / tile_size);
	}
开发者ID:Nexuapex,项目名称:Harmony,代码行数:3,代码来源:gx_atlas_renderer.cpp

示例14: lock

void ewol::resource::Texture::setImageSize(ivec2 _newSize) {
	std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
	_newSize.setValue( nextP2(_newSize.x()), nextP2(_newSize.y()) );
	m_data.resize(_newSize);
}
开发者ID:biddyweb,项目名称:ewol,代码行数:5,代码来源:Texture.cpp

示例15: set_viewport

	void gl::set_viewport(ivec2 size, ivec2 offset) {
		glViewport(offset.ux(), offset.uy(), size.x(), size.y());
	}
开发者ID:Nexuapex,项目名称:Harmony,代码行数:3,代码来源:gl_viewport.cpp


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