本文整理汇总了C++中ivec2类的典型用法代码示例。如果您正苦于以下问题:C++ ivec2类的具体用法?C++ ivec2怎么用?C++ ivec2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ivec2类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: max
inline ivec2 max(const ivec2& a, const ivec2& b)
{
return ivec2( a.x() > b.x() ? a.x() : b.x(),
a.y() > b.y() ? a.y() : b.y());
}
开发者ID:binhpt,项目名称:vltest,代码行数:5,代码来源:Vector2.hpp
示例17: min
inline ivec2 min(const ivec2& a, const ivec2& b)
{
return ivec2( a.x() < b.x() ? a.x() : b.x(),
a.y() < b.y() ? a.y() : b.y());
}
开发者ID:binhpt,项目名称:vltest,代码行数:5,代码来源:Vector2.hpp
示例18: init_and_bind_fbo
enum return_code
WRATHShapeGPUDistanceFieldCreator::ScratchPadFBO::
init_and_bind_fbo(ivec2 pdims, bool)
{
int max_dim(WRATHglGet<int>(GL_MAX_TEXTURE_SIZE));
if(pdims.x()>max_dim or pdims.y()>max_dim or pdims.x()<=0 or pdims.y()<=0)
{
return routine_fail;
}
if(pdims.x()>m_max_dim.x() or pdims.y()>m_max_dim.y())
{
//delete old fbo and image stff:
gl_resource_deleter R;
R.m_fbo=0; //setting this as 0 makes it so that R does not delete the FBO.
R.m_texture=m_texture;
R.m_depth=m_depth;
R.m_stencil=m_stencil;
R.m_depth_is_renderbuffer=m_depth_is_renderbuffer;
R();
m_max_dim=pdims;
//and create a new one:
if(m_fbo==0)
{
glGenFramebuffers(1, &m_fbo);
if(m_fbo==0)
{
/*
epiccally bad, cannot make an fbo,
we fake it by reading/drawing to/from the screen!
*/
WRATHwarning("Cannot create FBO: GL implementation out of spec, faking via drawing to screen");
m_current_dim=pdims;
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
glViewport(0, 0, m_current_dim.x(), m_current_dim.y());
return routine_success;
}
}
glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
#ifdef FBO_COLOR_USE_RENDERBUFFER
{
glGenRenderbuffers(1, &m_texture);
WRATHassert(m_texture!=0);
glBindRenderbuffer(GL_RENDERBUFFER, m_texture);
glRenderbufferStorage(GL_RENDERBUFFER, m_format,
m_max_dim.x(), m_max_dim.y());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, m_texture);
}
#else
{
glGenTextures(1, &m_texture);
WRATHassert(m_texture!=0);
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//TODO: under GL3 if m_format is an integer format
//then the 7'th argument should also reflect that,
//for example GL_RGB8I --> GL_RGB_INTEGER, etc.
glTexImage2D(GL_TEXTURE_2D, 0,
m_format,
m_max_dim.x(), m_max_dim.y(), 0,
m_format, GL_UNSIGNED_BYTE, NULL);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, m_texture, 0);
}
#endif
/*
TODO: for GLES2, if depth_stencil texture is supported,
then use that
*/
#if defined(WRATH_GLES_VERSION) && WRATH_GLES_VERSION==2
{
m_depth_is_renderbuffer=true;
m_depth=0;
glGenRenderbuffers(1, &m_stencil);
WRATHassert(m_stencil!=0);
glBindRenderbuffer(GL_RENDERBUFFER, m_stencil);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8,
m_max_dim.x(), m_max_dim.y());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, m_stencil);
}
#else
{
m_depth_is_renderbuffer=false;
//.........这里部分代码省略.........
开发者ID:nomovok-opensource,项目名称:wrath,代码行数:101,代码来源:WRATHShapeDistanceFieldGPUutil.cpp
示例19: object
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const std::string& _filename, ivec2 _size, ivec2 _sizeRegister) {
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size << " sizeRegister=" << _sizeRegister);
if (_filename == "") {
ememory::SharedPtr<ewol::resource::TextureFile> object(new ewol::resource::TextureFile());
if (object == nullptr) {
EWOL_ERROR("allocation error of a resource : ??TEX??");
return nullptr;
}
object->init();
getManager().localAdd(object);
return object;
}
if (_size.x() == 0) {
_size.setX(-1);
//EWOL_ERROR("Error Request the image size.x() =0 ???");
}
if (_size.y() == 0) {
_size.setY(-1);
//EWOL_ERROR("Error Request the image size.y() =0 ???");
}
std::string tmpFilename = _filename;
if (etk::end_with(_filename, ".svg") == false) {
_size = ewol::resource::TextureFile::sizeAuto;
}
if (_size.x()>0 && _size.y()>0) {
EWOL_VERBOSE(" == > specific size : " << _size);
#if defined(__TARGET_OS__Android) \
|| defined(__TARGET_OS__MacOs) \
|| defined(__TARGET_OS__IOs)
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
#endif
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) {
tmpFilename += ":";
tmpFilename += etk::to_string(_size.x());
tmpFilename += "x";
tmpFilename += etk::to_string(_size.y());
}
}
}
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
ememory::SharedPtr<ewol::resource::TextureFile> object = nullptr;
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename);
if (object2 != nullptr) {
object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2);
if (object == nullptr) {
EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)");
return nullptr;
}
}
if (object != nullptr) {
return object;
}
EWOL_INFO("CREATE: TextureFile: '" << tmpFilename << "' size=" << _size);
// need to crate a new one ...
object = ememory::SharedPtr<ewol::resource::TextureFile>(new ewol::resource::TextureFile());
if (object == nullptr) {
EWOL_ERROR("allocation error of a resource : " << _filename);
return nullptr;
}
object->init(tmpFilename, _filename, _size);
getManager().localAdd(object);
return object;
}
开发者ID:atria-soft,项目名称:ewol,代码行数:65,代码来源:Image.cpp
示例20: setUniform
void setUniform(const ivec2& value) { setUniform2i(1, value.ptr()); }
开发者ID:TomasHurban,项目名称:DP_Hairs_simulation_and_visualization,代码行数:1,代码来源:Uniform.hpp
注:本文中的ivec2类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论