本文整理汇总了C++中spNativeTexture类的典型用法代码示例。如果您正苦于以下问题:C++ spNativeTexture类的具体用法?C++ spNativeTexture怎么用?C++ spNativeTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了spNativeTexture类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void Mem2Native::push(spMemoryTexture src, spNativeTexture dest)
{
src->addRef();
dest->addRef();
_messages.send(0, src.get(), dest.get());
//_messages.post(0, src.get(), dest.get());
}
开发者ID:gotonis,项目名称:danmake,代码行数:7,代码来源:Mem2Native.cpp
示例2: operator
bool operator()(const spNativeTexture& t1, const spNativeTexture& t2) const
{
if (t1->getFormat() < _tf)
return true;
if (t1->getWidth() < _w)
return true;
return t1->getHeight() < _h;
}
开发者ID:hicks0074,项目名称:oxygine-framework,代码行数:8,代码来源:PostProcess.cpp
示例3: RectF
AnimationFrame::AnimationFrame(spNativeTexture t)
{
_row = _column = 0;
_resAnim = 0;
_diffuse.base = t;
_diffuse.premultiplied = true;
_srcRect = RectF(0, 0, 1, 1);
_destRect = RectF(0, 0, (float)t->getWidth(), (float)t->getHeight());
_frameSize = Vector2((float)t->getWidth(), (float)t->getHeight());
}
开发者ID:Yahor10,项目名称:oxygine-framework,代码行数:10,代码来源:AnimationFrame.cpp
示例4: isGood
bool RenderTargetsManager::isGood(const spNativeTexture& t, int w, int h, TextureFormat tf) const
{
if (!t)
return false;
if (!t->getHandle())
return false;
if (t->getFormat() == tf &&
t->getWidth() >= w && t->getHeight() >= h &&
t->getWidth() <= (w + ALIGN_SIZE) && t->getHeight() <= (h + ALIGN_SIZE))
return true;
return false;
}
开发者ID:hicks0074,项目名称:oxygine-framework,代码行数:14,代码来源:PostProcess.cpp
示例5: setTexture
void STDRenderer::setTexture(spNativeTexture base, spNativeTexture alpha, bool basePremultiplied)
{
if (base == 0 || base->getHandle() == 0)
base = white;
unsigned int shaderFlags = _shaderFlags;
if (basePremultiplied)
shaderFlags &= ~UberShaderProgram::ALPHA_PREMULTIPLY;
else
shaderFlags |= UberShaderProgram::ALPHA_PREMULTIPLY;
if (alpha)
shaderFlags |= UberShaderProgram::SEPARATE_ALPHA;
else
shaderFlags &= ~UberShaderProgram::SEPARATE_ALPHA;
//##ifdef OX_DEBUG
#if 0
if (_base != base) { OX_ASSERT(_alpha != alpha); }
else { OX_ASSERT(_alpha == alpha); }
#endif //OX_DEBUG
//no reason to check changed alpha because it is in pair with base
if (_base != base || /*_alpha != alpha || */_shaderFlags != shaderFlags)
{
drawBatch();
}
_shaderFlags = shaderFlags;
_base = base;
_alpha = alpha;
}
开发者ID:poplax,项目名称:oxygine-framework,代码行数:34,代码来源:STDRenderer.cpp
示例6: pass
void pass(spNativeTexture srcTexture, const Rect& srcRect, spNativeTexture destTexture, const Rect& destRect, const Color& color)
{
IVideoDriver* driver = IVideoDriver::instance;
const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(driver->getVertexDeclaration(vertexPCT2::FORMAT));
driver->setRenderTarget(destTexture);
driver->clear(0);
driver->setViewport(destRect);
driver->setTexture(0, srcTexture);
vertexPCT2 v[4];
RectF dst = srcRect.cast<RectF>() / Vector2((float)srcTexture->getWidth(), (float)srcTexture->getHeight());
fillQuadT(v,
dst,
RectF(-1, -1, 2, 2),
AffineTransform::getIdentity(), color.rgba());
driver->draw(IVideoDriver::PT_TRIANGLE_STRIP, decl, v, sizeof(v));
driver->setTexture(0, 0);
}
开发者ID:hicks0074,项目名称:oxygine-framework,代码行数:26,代码来源:PostProcess.cpp
示例7: oxglActiveTexture
void VideoDriverGLES20::setTexture(int sampler, spNativeTexture t)
{
oxglActiveTexture(GL_TEXTURE0 + sampler);
if (t)
glBindTexture(GL_TEXTURE_2D, (GLuint)((size_t)t->getHandle()));
else
glBindTexture(GL_TEXTURE_2D, 0);
CHECKGL();
}
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:9,代码来源:VideoDriverGLES20.cpp
示例8: v
MaskedRenderer::MaskedRenderer(spNativeTexture mask, const RectF &srcRect, const RectF &destRect, const transform &t, bool channelR) :_mask(mask)
{
_clipUV = ClipUV(
t.transform(destRect.getLeftTop()),
t.transform(destRect.getRightTop()),
t.transform(destRect.getLeftBottom()),
srcRect.getLeftTop(),
srcRect.getRightTop(),
srcRect.getLeftBottom());
_clipMask = srcRect;
Vector2 v(1.0f / mask->getWidth(), 1.0f / mask->getHeight());
_clipMask.expand(v, v);
_shaderFlags |= UberShaderProgram::MASK;
if (channelR)
_shaderFlags |= UberShaderProgram::MASK_R_CHANNEL;
}
开发者ID:luiseduardohdbackup,项目名称:oxygine-framework,代码行数:18,代码来源:MaskedRenderer.cpp
示例9: setRenderTarget
void VideoDriverGL::setRenderTarget(spNativeTexture rt)
{
if (!rt)
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
return;
}
NativeTextureGLES *gl = safeCast<NativeTextureGLES*>(rt.get());
glBindFramebuffer(GL_FRAMEBUFFER, gl->getFboID());
}
开发者ID:cnsoft,项目名称:oxygine-framework,代码行数:11,代码来源:VideoDriverGL.cpp
示例10: cmp
static bool cmp(const spNativeTexture& t2, const spNativeTexture& t1)
{
if (t1->getFormat() > t2->getFormat())
return true;
if (t1->getWidth() > t2->getWidth())
return true;
return t1->getHeight() > t2->getHeight();
}
开发者ID:hicks0074,项目名称:oxygine-framework,代码行数:8,代码来源:PostProcess.cpp
示例11: init
void ResAnim::init(spNativeTexture texture, const Point& originalSize, int columns, int rows, float scaleFactor)
{
_scaleFactor = scaleFactor;
if (!texture)
return;
int frame_width = originalSize.x / columns;
int frame_height = originalSize.y / rows;
animationFrames frames;
int frames_count = rows * columns;
frames.reserve(frames_count);
Vector2 frameSize((float)frame_width, (float)frame_height);
for (int y = 0; y < rows; ++y)
{
for (int x = 0; x < columns; ++x)
{
Rect src;
src.pos = Point(x * frame_width, y * frame_height);
src.size = Point(frame_width, frame_height);
float iw = 1.0f / texture->getWidth();
float ih = 1.0f / texture->getHeight();
RectF srcRect(src.pos.x * iw, src.pos.y * ih, src.size.x * iw, src.size.y * ih);
RectF destRect(Vector2(0, 0), frameSize * scaleFactor);
AnimationFrame frame;
Diffuse df;
df.base = texture;
frame.init(this, df, srcRect, destRect, destRect.size);
frames.push_back(frame);
}
}
init(frames, columns, scaleFactor);
}
开发者ID:Jesus05,项目名称:oxygine-framework,代码行数:37,代码来源:ResAnim.cpp
示例12: setRenderTarget
void VideoDriverGL::setRenderTarget(spNativeTexture rt)
{
if (!rt)
{
glBindFramebuffer(GL_FRAMEBUFFER, _prevFBO);
CHECKGL();
return;
}
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_prevFBO);
NativeTextureGLES *gl = safeCast<NativeTextureGLES*>(rt.get());
glBindFramebuffer(GL_FRAMEBUFFER, gl->getFboID());
CHECKGL();
}
开发者ID:luiseduardohdbackup,项目名称:oxygine-framework,代码行数:15,代码来源:VideoDriverGL.cpp
示例13: TextureLine
TextureLine(spNativeTexture t)
{
setVerticalMode(Box9Sprite::TILING_FULL);
setHorizontalMode(Box9Sprite::TILING_FULL);
Sprite::setResAnim(DebugActor::resSystem->getResAnim("checker"));
AnimationFrame f;
Vector2 s = fitSize(itemSize, Vector2((float)t->getWidth(), (float)t->getHeight()));
setSize(s);
Diffuse df;
df.base = t;
f.init(0, df, RectF(0, 0, 1.0f, 1.0f), RectF(0, 0, s.x, s.y), s);
spSprite image = initActor(new Sprite,
arg_blend = blend_disabled,
arg_resAnim = f);
addChild(image);
spColorRectSprite rect = initActor(new ColorRectSprite,
arg_color = Color(Color::White, 255),
arg_attachTo = this);
rect->addTween(Sprite::TweenColor(Color(Color::White, 0)), 4000, -1, true);
char path[255];
path::normalize(t->getName().c_str(), path);
char txt[255];
safe_sprintf(txt, "%s\n<div c=\"FF0000\">%s</div>-<div c=\"0000ff\">%dx%d</div>\nid: %d",
path,
textureFormat2String(t->getFormat()),
t->getWidth(), t->getHeight(), t->getObjectID());
spTextField text = initActor(new TextField,
arg_color = Color::Black,
arg_w = (float)itemSize.x,
arg_vAlign = TextStyle::VALIGN_TOP,
arg_hAlign = TextStyle::HALIGN_LEFT,
arg_multiline = true,
arg_attachTo = rect,
arg_htmlText = txt
);
text->setBreakLongWords(true);
rect->setSize(text->getTextRect().size.cast<Vector2>() + Vector2(2, 2));
rect->setY((itemSize.y - rect->getHeight()) / 2.0f);
}
开发者ID:ivlevAstef,项目名称:PrototypeCarGame,代码行数:50,代码来源:TexturesInspector.cpp
示例14: load_texture_internal
void load_texture_internal(const std::string &file, spNativeTexture nt, LoadResourcesContext *load_context)
{
ImageData im;
spMemoryTexture mt = new MemoryTexture;
LOGD("loading atlas: %s", file.c_str());
file::buffer bf;
file::read(file.c_str(), bf);
LOGD("atlas file loaded: %s", file.c_str());
mt->init(bf, Renderer::getPremultipliedAlphaRender(), nt->getFormat());
//mt->init(2048, 2048, TF_R8G8B8A8);
im = mt->lock();
LOGD("atlas size: %d %d", im.w, im.h);
//Object::dumpCreatedObjects();
load_context->createTexture(mt, nt);
}
开发者ID:luiseduardohdbackup,项目名称:oxygine-framework,代码行数:17,代码来源:ResAtlas.cpp
示例15: load_texture_internal
void load_texture_internal(const std::string& file, spNativeTexture nt, bool linearFilter, bool clamp2edge, LoadResourcesContext* load_context)
{
ImageData im;
spMemoryTexture mt = new MemoryTexture;
LOGD("loading atlas: %s", file.c_str());
file::buffer bf;
file::read(file.c_str(), bf);
LOGD("atlas file loaded: %s", file.c_str());
mt->init(bf, true, nt->getFormat());
im = mt->lock();
LOGD("atlas size: %d %d", im.w, im.h);
CreateTextureTask opt;
opt.src = mt;
opt.dest = nt;
opt.linearFilter = linearFilter;
opt.clamp2edge = clamp2edge;
load_context->createTexture(opt);
}
开发者ID:HaoDongGuo,项目名称:oxygine-framework,代码行数:20,代码来源:ResAtlas.cpp
示例16: alignTextureSize
spNativeTexture RenderTargetsManager::get(spNativeTexture current, int w, int h, TextureFormat tf)
{
w = alignTextureSize(w);
h = alignTextureSize(h);
if (isGood(current, w, h, tf))
{
current->setUserData((void*)(size_t)getTimeMS());
return current;
}
spNativeTexture result;
free::iterator it = lower_bound(_free.begin(), _free.end(), result, NTP(w, h, tf));
if (it != _free.end())
{
spNativeTexture& t = *it;
if (isGood(t, w, h, tf))
{
result = t;
_free.erase(it);
}
}
if (!result)
{
//if texture wasn't found create it
result = IVideoDriver::instance->createTexture();
result->init(w, h, tf, true);
}
result->setUserData((void*)(size_t)getTimeMS());
_rts.push_back(result);
//print();
return result;
}
开发者ID:hicks0074,项目名称:oxygine-framework,代码行数:38,代码来源:PostProcess.cpp
示例17: isNeedProceed
bool MTLoadingResourcesContext::isNeedProceed(spNativeTexture t)
{
return t->getHandle() == 0;
}
开发者ID:pscamman,项目名称:oxygine-framework,代码行数:4,代码来源:CreateResourceContext.cpp
示例18: createTexture
void RestoreResourcesContext::createTexture(spMemoryTexture src, spNativeTexture dest)
{
dest->init(src->lock(), false);
}
开发者ID:huangyt,项目名称:oxygine-framework,代码行数:4,代码来源:CreateResourceContext.cpp
示例19: isNeedProceed
bool isNeedProceed(spNativeTexture t)
{
return t->getHandle() == 0;
}
开发者ID:radonthetyrant,项目名称:oxygine-framework,代码行数:4,代码来源:Multithreading.cpp
注:本文中的spNativeTexture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论