本文整理汇总了C++中TTile类的典型用法代码示例。如果您正苦于以下问题:C++ TTile类的具体用法?C++ TTile怎么用?C++ TTile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: doCompute
void doCompute(TTile &tile, double frame, const TRenderSettings &ri)
{
if (!m_input.isConnected())
return;
m_input->compute(tile, frame, ri);
double v = 1 - m_value->getValue(frame) / 100;
TRop::rgbmScale(tile.getRaster(), tile.getRaster(), 1, 1, 1, v);
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:10,代码来源:stdfx.cpp
示例2: doCompute
void ColumnColorFilterFx::doCompute(TTile &tile, double frame,
const TRenderSettings &ri) {
if (!m_port.isConnected()) return;
if (!TRaster32P(tile.getRaster()) && !TRaster64P(tile.getRaster()))
throw TException("AffineFx unsupported pixel type");
TRasterFxP src = m_port.getFx();
src->compute(tile, frame, ri);
TRop::applyColorScale(tile.getRaster(), m_colorFilter);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:12,代码来源:unaryFx.cpp
示例3: assert
/*------------------------------------------------------------
背景があり、前景が動かない場合、単純にOverする
------------------------------------------------------------*/
void Iwa_MotionBlurCompFx::composeWithNoMotion(
TTile &tile, double frame, const TRenderSettings &settings) {
assert(m_background.isConnected());
m_background->compute(tile, frame, settings);
TTile fore_tile;
m_input->allocateAndCompute(fore_tile, tile.m_pos,
tile.getRaster()->getSize(), tile.getRaster(),
frame, settings);
TRasterP up(fore_tile.getRaster()), down(tile.getRaster());
TRop::over(down, up);
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:17,代码来源:iwa_motionblurfx.cpp
示例4: downloadAll
bool TCacheResource::downloadAll(TTile &tile)
{
if (!checkTile(tile))
return false;
return downloadAll(TPoint(tile.m_pos.x, tile.m_pos.y), tile.getRaster());
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:7,代码来源:tcacheresource.cpp
示例5: download
QRegion TCacheResource::download(TTile &tile)
{
if (!checkTile(tile))
return QRegion();
return download(TPoint(tile.m_pos.x, tile.m_pos.y), tile.getRaster());
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:7,代码来源:tcacheresource.cpp
示例6: upload
bool TCacheResource::upload(const TTile &tile)
{
if (!checkTile(tile))
return false;
return upload(TPoint(tile.m_pos.x, tile.m_pos.y), tile.getRaster());
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:7,代码来源:tcacheresource.cpp
示例7: doCompute
void doCompute(TTile &tile, double frame, const TRenderSettings &ri) {
if (!m_port.isConnected()) {
tile.getRaster()->clear();
return;
}
// Exchange frame with the stored one
TRasterFxP(m_port.getFx())->compute(tile, m_frame, ri);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:9,代码来源:scenefx.cpp
示例8: locker
TTile *TTileL1Cache::getTile(const TTileRef &ref, TTileClient *client)
{
TTile *tile = NULL;
int i;
QMutexLocker locker(&_mutex);
for(i = 0; (i < _locked.size()) && !_locked[i]->compare(ref); i++);
if(i != _locked.size()) {
tile = _locked[i];
tile->addClient(client);
} else {
for(i = 0; (i < _unlocked.size()) && !_unlocked[i]->compare(ref); i++);
if(i != _unlocked.size()) {
tile = _unlocked.takeAt(i);
tile->addClient(client);
_locked.append(tile);
}
}
return tile;
}
开发者ID:idaohang,项目名称:NeronGPS,代码行数:22,代码来源:tilel1cache.cpp
示例9: p_size
void Iwa_TiledParticlesFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri)
{
std::vector<int> lastframe;
std::vector<TLevelP> partLevel;
TPointD p_offset;
TDimension p_size(0, 0);
/*- 参照画像ポートの取得 -*/
std::vector<TRasterFxPort *> part_ports; /*- テクスチャ素材画像のポート -*/
std::map<int, TRasterFxPort *> ctrl_ports; /*- コントロール画像のポート番号/ポート -*/
int portsCount = this->getInputPortCount();
for (int i = 0; i < portsCount; ++i) {
std::string tmpName = this->getInputPortName(i);
QString portName = QString::fromStdString(tmpName);
if (portName.startsWith("T")) {
TRasterFxPort *tmpPart = (TRasterFxPort *)this->getInputPort(tmpName);
if (tmpPart->isConnected())
part_ports.push_back((TRasterFxPort *)this->getInputPort(tmpName));
} else {
portName.replace(QString("Control"), QString(""));
TRasterFxPort *tmpCtrl = (TRasterFxPort *)this->getInputPort(tmpName);
if (tmpCtrl->isConnected())
ctrl_ports[portName.toInt()] = (TRasterFxPort *)this->getInputPort(tmpName);
}
}
/*- テクスチャ素材のバウンディングボックスを足し合わせる ←この工程、いらないかも?-*/
if (!part_ports.empty()) {
TRectD outTileBBox(tile.m_pos, TDimensionD(tile.getRaster()->getLx(), tile.getRaster()->getLy()));
TRectD bbox;
for (unsigned int i = 0; i < (int)part_ports.size(); ++i) {
const TFxTimeRegion &tr = (*part_ports[i])->getTimeRegion();
lastframe.push_back(tr.getLastFrame() + 1);
partLevel.push_back(new TLevel());
partLevel[i]->setName((*part_ports[i])->getAlias(0, ri));
// The particles offset must be calculated without considering the affine's translational
// component
TRenderSettings riZero(ri);
riZero.m_affine.a13 = riZero.m_affine.a23 = 0;
// Calculate the bboxes union
for (int t = 0; t <= tr.getLastFrame(); ++t) {
TRectD inputBox;
(*part_ports[i])->getBBox(t, inputBox, riZero);
bbox += inputBox;
}
}
if (bbox == TConsts::infiniteRectD)
bbox *= outTileBBox;
p_size.lx = (int)bbox.getLx() + 1;
p_size.ly = (int)bbox.getLy() + 1;
p_offset = TPointD(0.5 * (bbox.x0 + bbox.x1), 0.5 * (bbox.y0 + bbox.y1));
} else {
partLevel.push_back(new TLevel());
partLevel[0]->setName("particles");
TDimension vecsize(10, 10);
TOfflineGL *offlineGlContext = new TOfflineGL(vecsize);
offlineGlContext->clear(TPixel32(0, 0, 0, 0));
TStroke *stroke;
stroke = makeEllipticStroke(0.07, TPointD((vecsize.lx - 1) * .5, (vecsize.ly - 1) * .5), 2.0, 2.0);
TVectorImageP vectmp = new TVectorImage();
TPalette *plt = new TPalette();
vectmp->setPalette(plt);
vectmp->addStroke(stroke);
TVectorRenderData rd(AffI, TRect(vecsize), plt, 0, true, true);
offlineGlContext->makeCurrent();
offlineGlContext->draw(vectmp, rd);
partLevel[0]->setFrame(0, TRasterImageP(offlineGlContext->getRaster()->clone()));
p_size.lx = vecsize.lx + 1;
p_size.ly = vecsize.ly + 1;
lastframe.push_back(1);
delete offlineGlContext;
}
Iwa_Particles_Engine myEngine(this, frame);
// Retrieving the dpi multiplier from the accumulated affine (which is isotropic). That is,
// the affine will be applied *before* this effect - and we'll multiply geometrical parameters
// by this dpi mult. in order to compensate.
float dpi = sqrt(fabs(ri.m_affine.det())) * 100;
TTile tileIn;
if (TRaster32P raster32 = tile.getRaster()) {
TFlash *flash = 0;
myEngine.render_particles(flash, &tile, part_ports, ri, p_size, p_offset, ctrl_ports, partLevel,
1, (int)frame, 1, 0, 0, 0, 0, lastframe, getIdentifier());
} else if (TRaster64P raster64 = tile.getRaster()) {
TFlash *flash = 0;
//.........这里部分代码省略.........
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:101,代码来源:iwa_particlesfx.cpp
示例10: tileRas
/*- render_particles から呼ばれる。粒子の数だけ繰り返し -*/
void Particles_Engine::do_render(
TFlash *flash, Particle *part, TTile *tile,
std::vector<TRasterFxPort *> part_ports, std::map<int, TTile *> porttiles,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
int lastframe, std::vector<TLevelP> partLevel,
struct particles_values &values, double opacity_range, int dist_frame,
std::map<std::pair<int, int>, double> &partScales) {
// Retrieve the particle frame - that is, the *column frame* from which we are
// picking
// the particle to be rendered.
int ndx = part->frame % lastframe;
TRasterP tileRas(tile->getRaster());
std::string levelid;
double aim_angle = 0;
if (values.pathaim_val) {
double arctan = atan2(part->vy, part->vx);
aim_angle = arctan * M_180_PI;
}
// Calculate the rotational and scale components we have to apply on the
// particle
TRotation rotM(part->angle + aim_angle);
TScale scaleM(part->scale);
TAffine M(rotM * scaleM);
// Particles deal with dpi affines on their own
TAffine scaleAff(m_parent->handledAffine(ri, m_frame));
double partScale =
scaleAff.a11 * partScales[std::pair<int, int>(part->level, ndx)];
TDimensionD partResolution(0, 0);
TRenderSettings riNew(ri);
// Retrieve the bounding box in the standard reference
TRectD bbox(-5.0, -5.0, 5.0, 5.0), standardRefBBox;
if (part->level <
(int)part_ports.size() && // Not the default levelless cases
part_ports[part->level]->isConnected()) {
TRenderSettings riIdentity(ri);
riIdentity.m_affine = TAffine();
(*part_ports[part->level])->getBBox(ndx, bbox, riIdentity);
// A particle's bbox MUST be finite. Gradients and such which have an
// infinite bbox
// are just NOT rendered.
// NOTE: No fx returns half-planes or similar (ie if any coordinate is
// either
// (std::numeric_limits<double>::max)() or its opposite, then the rect IS
// THE infiniteRectD)
if (bbox == TConsts::infiniteRectD) return;
}
// Now, these are the particle rendering specifications
bbox = bbox.enlarge(3);
standardRefBBox = bbox;
riNew.m_affine = TScale(partScale);
bbox = riNew.m_affine * bbox;
/*- 縮小済みのParticleのサイズ -*/
partResolution = TDimensionD(tceil(bbox.getLx()), tceil(bbox.getLy()));
if (flash) {
if (!partLevel[part->level]->frame(ndx)) {
if (part_ports[0]->isConnected()) {
TTile auxTile;
TRaster32P tmp;
tmp = TRaster32P(p_size);
(*part_ports[0])
->allocateAndCompute(auxTile, p_offset, p_size, tmp, ndx, ri);
partLevel[part->level]->setFrame(ndx,
TRasterImageP(auxTile.getRaster()));
}
}
flash->pushMatrix();
const TAffine aff;
flash->multMatrix(scaleM * aff.place(0, 0, part->x, part->y));
// if(curr_opacity!=1.0 || part->gencol.fadecol || part->fincol.fadecol ||
// part->foutcol.fadecol)
{
TColorFader cf(TPixel32::Red, .5);
flash->draw(partLevel[part->level]->frame(ndx), &cf);
}
// flash->draw(partLevel->frame(ndx), 0);
flash->popMatrix();
} else {
TRasterP ras;
std::string alias;
TRasterImageP rimg;
if (rimg = partLevel[part->level]->frame(ndx)) {
ras = rimg->getRaster();
} else {
//.........这里部分代码省略.........
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:101,代码来源:particlesengine.cpp
示例11: renderer
void Particles_Engine::render_particles(
TFlash *flash, TTile *tile, std::vector<TRasterFxPort *> part_ports,
const TRenderSettings &ri, TDimension &p_size, TPointD &p_offset,
std::map<int, TRasterFxPort *> ctrl_ports, std::vector<TLevelP> partLevel,
float dpi, int curr_frame, int shrink, double startx, double starty,
double endx, double endy, std::vector<int> last_frame, unsigned long fxId) {
int frame, startframe, intpart = 0, level_n = 0;
struct particles_values values;
double dpicorr = dpi * 0.01, fractpart = 0, dpicorr_shrinked = 0,
opacity_range = 0;
bool random_level = false;
level_n = part_ports.size();
bool isPrecomputingEnabled = false;
{
TRenderer renderer(TRenderer::instance());
isPrecomputingEnabled =
(renderer && renderer.isPrecomputingEnabled()) ? true : false;
}
memset(&values, 0, sizeof(values));
/*- 現在のフレームでの各種パラメータを得る -*/
fill_value_struct(values, m_frame);
/*- 不透明度の範囲(透明〜不透明を 0〜1 に正規化)-*/
opacity_range = (values.opacity_val.second - values.opacity_val.first) * 0.01;
/*- 開始フレーム -*/
startframe = (int)values.startpos_val;
if (values.unit_val == ParticlesFx::UNIT_SMALL_INCH)
dpicorr_shrinked = dpicorr / shrink;
else
dpicorr_shrinked = dpi / shrink;
std::map<std::pair<int, int>, double> partScales;
curr_frame = curr_frame / values.step_val;
ParticlesManager *pc = ParticlesManager::instance();
// Retrieve the last rolled frame
ParticlesManager::FrameData *particlesData = pc->data(fxId);
std::list<Particle> myParticles;
TRandom myRandom;
values.random_val = &myRandom;
myRandom = m_parent->randseed_val->getValue();
int totalparticles = 0;
int pcFrame = particlesData->m_frame;
if (pcFrame > curr_frame) {
// Clear stored particlesData
particlesData->clear();
pcFrame = particlesData->m_frame;
} else if (pcFrame >= startframe - 1) {
myParticles = particlesData->m_particles;
myRandom = particlesData->m_random;
totalparticles = particlesData->m_totalParticles;
}
/*- スタートからカレントフレームまでループ -*/
for (frame = startframe - 1; frame <= curr_frame; ++frame) {
int dist_frame = curr_frame - frame;
/*-
* ループ内の現在のフレームでのパラメータを取得。スタートが負ならフレーム=0のときの値を格納
* -*/
fill_value_struct(values, frame < 0 ? 0 : frame * values.step_val);
/*- パラメータの正規化 -*/
normalize_values(values, ri);
/*- maxnum_valは"birth_rate"のパラメータ -*/
intpart = (int)values.maxnum_val;
/*-
* /birth_rateが小数だったとき、各フレームの小数部分を足しこんだ結果の整数部分をintpartに渡す。
* -*/
fractpart = fractpart + values.maxnum_val - intpart;
if ((int)fractpart) {
values.maxnum_val += (int)fractpart;
fractpart = fractpart - (int)fractpart;
}
std::map<int, TTile *> porttiles;
// Perform the roll
/*- RenderSettingsを複製して現在のフレームの計算用にする -*/
TRenderSettings riAux(ri);
riAux.m_affine = TAffine();
riAux.m_bpp = 32;
int r_frame; // Useful in case of negative roll frames
if (frame < 0)
r_frame = 0;
else
r_frame = frame;
/*- 出力画像のバウンディングボックス -*/
TRectD outTileBBox(tile->m_pos, TDimensionD(tile->getRaster()->getLx(),
tile->getRaster()->getLy()));
/*- Controlに刺さっている各ポートについて -*/
for (std::map<int, TRasterFxPort *>::iterator it = ctrl_ports.begin();
it != ctrl_ports.end(); ++it) {
TTile *tmp;
/*- ポートが接続されていて、Fx内で実際に使用されていたら -*/
if ((it->second)->isConnected() && port_is_used(it->first, values)) {
TRectD bbox;
(*(it->second))->getBBox(r_frame, bbox, riAux);
//.........这里部分代码省略.........
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:101,代码来源:particlesengine.cpp
示例12: subCompute
void subCompute(TRasterFxPort &m_input, TTile &tile, double frame,
const TRenderSettings &ri, TPointD p00, TPointD p01,
TPointD p11, TPointD p10, int details, bool wireframe,
TDimension m_offScreenSize, bool isCast) {
TPixel32 bgColor;
TRectD outBBox, inBBox;
outBBox = inBBox = TRectD(tile.m_pos, TDimensionD(tile.getRaster()->getLx(),
tile.getRaster()->getLy()));
m_input->getBBox(frame, inBBox, ri);
if (inBBox == TConsts::infiniteRectD) // e' uno zerario
inBBox = outBBox;
int inBBoxLx = (int)inBBox.getLx() / ri.m_shrinkX;
int inBBoxLy = (int)inBBox.getLy() / ri.m_shrinkY;
if (inBBox.isEmpty()) return;
if (p00 == p01 && p00 == p10 && p00 == p11 &&
!isCast) // significa che non c'e' deformazione
{
m_input->compute(tile, frame, ri);
return;
}
TRaster32P rasIn;
TPointD rasInPos;
if (!wireframe) {
if (ri.m_bpp == 64 || ri.m_bpp == 48) {
TRaster64P aux = TRaster64P(inBBoxLx, inBBoxLy);
rasInPos = TPointD(inBBox.x0 / ri.m_shrinkX, inBBox.y0 / ri.m_shrinkY);
TTile tmp(aux, rasInPos);
m_input->compute(tmp, frame, ri);
rasIn = TRaster32P(inBBoxLx, inBBoxLy);
TRop::convert(rasIn, aux);
} else {
rasInPos = TPointD(inBBox.x0 / ri.m_shrinkX, inBBox.y0 / ri.m_shrinkY);
TTile tmp(TRaster32P(inBBoxLx, inBBoxLy), rasInPos);
m_input->allocateAndCompute(tmp, rasInPos, TDimension(inBBoxLx, inBBoxLy),
TRaster32P(), frame, ri);
rasIn = tmp.getRaster();
}
}
unsigned int texWidth = 2;
unsigned int texHeight = 2;
while (texWidth < (unsigned int)inBBoxLx) texWidth = texWidth << 1;
while (texHeight < (unsigned int)inBBoxLy) texHeight = texHeight << 1;
while (texWidth > 1024 || texHeight > 1024) // avevo usato la costante
// GL_MAX_TEXTURE_SIZE invece di
// 1024, ma non funzionava!
{
inBBoxLx = inBBoxLx >> 1;
inBBoxLy = inBBoxLy >> 1;
texWidth = texWidth >> 1;
texHeight = texHeight >> 1;
}
if (rasIn->getLx() != inBBoxLx || rasIn->getLy() != inBBoxLy) {
TRaster32P rasOut = TRaster32P(inBBoxLx, inBBoxLy);
TRop::resample(rasOut, rasIn,
TScale((double)rasOut->getLx() / rasIn->getLx(),
(double)rasOut->getLy() / rasIn->getLy()));
rasIn = rasOut;
}
int rasterWidth = tile.getRaster()->getLx() + 2;
int rasterHeight = tile.getRaster()->getLy() + 2;
assert(rasterWidth > 0);
assert(rasterHeight > 0);
TRectD clippingRect =
TRectD(tile.m_pos,
TDimensionD(tile.getRaster()->getLx(), tile.getRaster()->getLy()));
#if CREATE_GL_CONTEXT_ONE_TIME
int ret = wglMakeCurrent(m_offScreenGL.m_offDC, m_offScreenGL.m_hglRC);
assert(ret == TRUE);
#else
TOfflineGL offScreenRendering(TDimension(rasterWidth, rasterHeight));
//#ifdef _WIN32
offScreenRendering.makeCurrent();
//#else
//#if defined(LINUX) || defined(MACOSX)
// offScreenRendering.m_offlineGL->makeCurrent();
//#endif
#endif
checkErrorsByGL
// disabilito quello che non mi serve per le texture
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glDisable(GL_DITHER);
glDisable(GL_DEPTH_TEST);
glCullFace(GL_FRONT);
glDisable(GL_STENCIL_TEST);
glDisable(GL_LOGIC_OP);
// creo la texture in base all'immagine originale
//.........这里部分代码省略.........
开发者ID:walkerka,项目名称:opentoonz,代码行数:101,代码来源:pins.cpp
示例13: doCompute
void doCompute(TTile &tile, double frame,
const TRenderSettings &info) override {
bool isWarped = m_warped.isConnected();
if (!isWarped) return;
if (fabs(m_intensity->getValue(frame)) < 0.01) {
m_warped->compute(tile, frame, info);
return;
}
int shrink = (info.m_shrinkX + info.m_shrinkY) / 2;
double scale = sqrt(fabs(info.m_affine.det()));
double gridStep = 1.5 * m_gridStep->getValue(frame);
WarpParams params;
params.m_intensity = m_intensity->getValue(frame) / gridStep;
params.m_warperScale = scale * gridStep;
params.m_sharpen = m_sharpen->getValue();
params.m_shrink = shrink;
double period = m_period->getValue(frame) / info.m_shrinkX;
double count = m_count->getValue(frame);
double cycle = m_cycle->getValue(frame) / info.m_shrinkX;
double scaleX = m_scaleX->getValue(frame) / 100.0;
double scaleY = m_scaleY->getValue(frame) / 100.0;
double angle = -m_angle->getValue(frame);
TPointD center = m_center->getValue(frame) * (1.0 / info.m_shrinkX);
// The warper is calculated on a standard reference, with fixed dpi. This
// makes sure
// that the lattice created for the warp does not depend on camera
// transforms and resolution.
TRenderSettings warperInfo(info);
double warperScaleFactor = 1.0 / params.m_warperScale;
warperInfo.m_affine = TScale(warperScaleFactor) * info.m_affine;
// Retrieve tile's geometry
TRectD tileRect;
{
TRasterP tileRas = tile.getRaster();
tileRect =
TRectD(tile.m_pos, TDimensionD(tileRas->getLx(), tileRas->getLy()));
}
// Build the compute rect
TRectD warpedBox, warpedComputeRect, tileComputeRect;
m_warped->getBBox(frame, warpedBox, info);
getWarpComputeRects(tileComputeRect, warpedComputeRect, warpedBox, tileRect,
params);
if (tileComputeRect.getLx() <= 0 || tileComputeRect.getLy() <= 0) return;
if (warpedComputeRect.getLx() <= 0 || warpedComputeRect.getLy() <= 0)
return;
TRectD warperComputeRect(TScale(warperScaleFactor) * tileComputeRect);
double warperEnlargement = getWarperEnlargement(params);
warperComputeRect = warperComputeRect.enlarge(warperEnlargement);
warperComputeRect.x0 = tfloor(warperComputeRect.x0);
warperComputeRect.y0 = tfloor(warperComputeRect.y0);
warperComputeRect.x1 = tceil(warperComputeRect.x1);
warperComputeRect.y1 = tceil(warperComputeRect.y1);
// Compute the warped tile
TTile tileIn;
m_warped->allocateAndCompute(
tileIn, warpedComputeRect.getP00(),
TDimension(warpedComputeRect.getLx(), warpedComputeRect.getLy()),
tile.getRaster(), frame, info);
TRasterP rasIn = tileIn.getRaster();
// Compute the warper tile
TSpectrum::ColorKey colors[] = {TSpectrum::ColorKey(0, TPixel32::White),
TSpectrum::ColorKey(0.5, TPixel32::Black),
TSpectrum::ColorKey(1, TPixel32::White)};
TSpectrumParamP ripplecolors = TSpectrumParamP(tArrayCount(colors), colors);
// Build the multiradial
warperInfo.m_affine = warperInfo.m_affine * TTranslation(center) *
TRotation(angle) * TScale(scaleX, scaleY);
TAffine aff = warperInfo.m_affine.inv();
TPointD posTrasf = aff * (warperComputeRect.getP00());
TRasterP rasWarper =
rasIn->create(warperComputeRect.getLx(), warperComputeRect.getLy());
multiRadial(rasWarper, posTrasf, ripplecolors, period, count, cycle, aff,
frame);
// TImageWriter::save(TFilePath("C:\\ripple.tif"), rasWarper);
// Warp
TPointD db;
TRect rasComputeRectI(convert(tileComputeRect - tileRect.getP00(), db));
TRasterP tileRas = tile.getRaster()->extract(rasComputeRectI);
TPointD rasInPos(warpedComputeRect.getP00() - tileComputeRect.getP00());
TPointD warperPos(
(TScale(params.m_warperScale) * warperComputeRect.getP00()) -
tileComputeRect.getP00());
warp(tileRas, rasIn, rasWarper, rasInPos, warperPos, params);
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:100,代码来源:ripplefx.cpp
示例14: getAttributes
void Iwa_MotionBlurCompFx::doCompute(TTile &tile, double frame,
const TRenderSettings &settings) {
/*- 接続していない場合は処理しない -*/
if (!m_input.isConnected() && !m_background.isConnected()) {
tile.getRaster()->clear();
return;
}
/*- BGのみ接続の場合 -*/
if (!m_input.isConnected()) {
m_background->compute(tile, frame, settings);
return;
}
/*- 動作パラメータを得る -*/
QList<TPointD> points = getAttributes()->getMotionPoints();
double hardness = m_hardness->getValue(frame);
double shutterStart = m_shutterStart->getValue(frame);
double shutterEnd = m_shutterEnd->getValue(frame);
int traceResolution = m_traceResolution->getValue();
float startValue = (float)m_startValue->getValue(frame);
float startCurve = (float)m_startCurve->getValue(frame);
float endValue = (float)m_endValue->getValue(frame);
float endCurve = (float)m_endCurve->getValue(frame);
/*- 軌跡データが2つ以上無い場合は、処理しない -*/
if (points.size() < 2) {
if (!m_background.isConnected()) m_input->compute(tile, frame, settings);
/*- 背景があり、前景が動かない場合、単純にOverする -*/
else
composeWithNoMotion(tile, frame, settings);
return;
}
/*- 表示の範囲を得る -*/
TRectD bBox =
TRectD(tile.m_pos /*- Render画像上(Pixel単位)の位置 -*/
,
TDimensionD(/*- Render画像上(Pixel単位)のサイズ -*/
tile.getRaster()->getLx(), tile.getRaster()->getLy()));
/*- 上下左右のマージンを得る -*/
double minX = 0.0;
double maxX = 0.0;
double minY = 0.0;
double maxY = 0.0;
for (int p = 0; p < points.size(); p++) {
if (points.at(p).x > maxX) maxX = points.at(p).x;
if (points.at(p).x < minX) minX = points.at(p).x;
if (points.at(p).y > maxY) maxY = points.at(p).y;
if (points.at(p).y < minY) minY = points.at(p).y;
}
int marginLeft = (int)ceil(abs(minX));
int marginRight = (int)ceil(abs(maxX));
int marginTop = (int)ceil(abs(maxY));
int marginBottom = (int)ceil(abs(minY));
/*- 動かない(=フィルタマージンが全て0)場合、入力タイルをそのまま返す -*/
if (marginLeft == 0 && marginRight == 0 && marginTop == 0 &&
marginBottom == 0) {
if (!m_background.isConnected()) m_input->compute(tile, frame, settings);
/*- 背景があり、前景が動かない場合、単純にOverする -*/
else
composeWithNoMotion(tile, frame, settings);
return;
}
/*- マージンは、フィルタの上下左右を反転した寸法になる -*/
TRectD enlargedBBox(bBox.x0 - (double)marginRight,
bBox.y0 - (double)marginTop, bBox.x1 + (double)marginLeft,
bBox.y1 + (double)marginBottom);
// std::cout<<"Margin Left:"<<marginLeft<<" Right:"<<marginRight<<
// " Bottom:"<<marginBottom<<" Top:"<<marginTop<<std::endl;
TDimensionI enlargedDimIn(/*- Pixel単位に四捨五入 -*/
(int)(enlargedBBox.getLx() + 0.5),
(int)(enlargedBBox.getLy() + 0.5));
TTile enlarge_tile;
m_input->allocateAndCompute(enlarge_tile, enlargedBBox.getP00(),
enlargedDimIn, tile.getRaster(), frame, settings);
/*- 背景が必要な場合 -*/
TTile back_Tile;
if (m_background.isConnected()) {
m_background->allocateAndCompute(back_Tile, tile.m_pos,
tile.getRaster()->getSize(),
tile.getRaster(), frame, settings);
}
//-------------------------------------------------------
/*- 計算範囲 -*/
TDimensionI dimOut(tile.getRaster()->getLx(), tile.getRaster()->getLy());
TDimensionI filterDim(marginLeft + marginRight + 1,
marginTop + marginBottom + 1);
/*- pointsTableの解放は各doCompute内でやっている -*/
int pointAmount = points.size();
float4 *pointsTable = new float4[pointAmount];
float dt = (float)(shutterStart + shutterEnd) / (float)traceResolution;
for (int p = 0; p < pointAmount; p++) {
//.........这里部分代码省略.........
开发者ID:SaierMe,项目名称:opentoonz,代码行数:101,代码来源:iwa_motionblurfx.cpp
示例15: doCompute
void doCompute(TTile &tile, double frame,
const TRenderSettings &ri) override {
Status status = getFxStatus(m_light, m_lighted);
if (status & NoPortsConnected)
// If no port, just do nothing :)
return;
// Calculate source
if (status & Port1Connected) m_lighted->compute(tile, frame, ri);
// Calculate light
if (status & Port0Connected) {
// Init light infos
TDimension tileSize(tile.getRaster()->getSize());
TRectD tileRect(tile.m_pos, TDimensionD(tileSize.lx, tileSize.ly));
double scale = sqrt(fabs(ri.m_affine.det()));
double blur = m_value->getValue(frame) * scale;
// Build the light interesting rect
TRectD lightRect, blurOutRect;
m_light->getBBox(frame, lightRect, ri);
buildLightRects(tileRect, lightRect, blurOutRect, blur);
if ((lightRect.getLx() <= 0) || (lightRect.getLy() <= 0)) return;
if ((blurOutRect.getLx() <= 0) || (blurOutRect.getLy() <= 0)) return;
// Calculate the light tile
TTile lightTile;
TDimension lightSize(tround(lightRect.getLx()),
tround(lightRect.getLy()));
m_light->allocateAndCompute(lightTile, lightRect.getP00(), lightSize,
tile.getRaster(), frame, ri);
// Init glow parameters
TPixel32 color = m_color->getValue(frame);
double brightness = m_brightness->getValue(frame) / 100.0;
double fade = m_fade->getValue(frame) / 100.0;
// Now, apply the glow
// First, deal with the fade
{
TRasterP light = lightTile.getRaster();
TRaster32P light32 = light;
TRaster64P light64 = light;
if (light32)
::fade(light32, fade, color);
else if (light64)
::fade(light64, fade, toPixel64(color));
else
assert(false);
}
// Then, build the blur
TRasterP blurOut;
if (blur > 0) {
// Build a temporary output to the blur
{
TRasterP light(lightTile.getRaster());
blurOut = light->create(tround(blurOutRect.getLx()),
tround(blurOutRect.getLy()));
// Apply the blur. Please note that SSE2 should not be used for now -
// I've seen it
// doing strange things to the blur...
TPointD displacement(lightRect.getP00() - blurOutRect.getP00());
TRop::blur(blurOut, light, blur, tround(displacement.x),
tround(displacement.y), false);
}
} else
blurOut = lightTile.getRaster();
// Apply the rgbm scale
TRop::rgbmScale(blurOut, blurOut, 1, 1, 1, brightness);
// Apply the add
{
TRectD interestingRect(tileRect * blurOutRect);
TRect interestingTileRect(tround(interestingRect.x0 - tileRect.x0),
tround(interestingRect.y0 - tileRect.y0),
tround(interestingRect.x1 - tileRect.x0) - 1,
tround(interestingRect.y1 - tileRect.y0) - 1);
TRect interestingBlurRect(
tround(interestingRect.x0 - blurOutRect.x0),
tround(interestingRect.y0 - blurOutRect.y0),
tround(interestingRect.x1 - blurOutRect.x0) - 1,
tround(interestingRect.y1 - blurOutRect.y0) - 1);
if ((interestingTileRect.getLx() <= 0) ||
(interestingTileRect.getLy() <= 0))
return;
if ((interestingBlurRect.getLx() <= 0) ||
(interestingBlurRect.getLy() <= 0))
return;
//.........这里部分代码省略.........
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:101,代码来源:glowfx.cpp
示例16: canUpload
bool TCacheResource::canUpload(const TTile &tile) const
{
int tileType;
return checkTile(tile) && checkRasterType(tile.getRaster(), tileType);
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:5,代码来源:tcacheresource.cpp
示例17: composeBackgroundExposure_CPU
/*------------------------------------------------------------
背景を露光値にして通常合成
------------------------------------------------------------*/
void Iwa_MotionBlurCompFx::composeBackgroundExposure_CPU(
float4 *out_tile_p, TDimensionI &enlargedDimIn, int marginRight,
int marginTop, TTile &back_tile, TDimensionI &dimOut, float hardness) {
/*- ホストのメモリ確保 -*/
TRasterGR8P background_host_ras(sizeof(float4) * dimOut.lx, dimOut.ly);
background_host_ras->lock();
float4 *background_host = (float4 *)background_host_ras->getRawData();
bool bgIsPremultiplied;
/*- 背景画像を0〜1に正規化してホストメモリに読み込む -*/
TRaster32P backRas32 = (TRaster32P)back_tile.getRaster();
TRaster64P backRas64 = (TRaster64P)back_tile.getRaster();
if (backRas32)
bgIsPremultiplied = setSourceRaster<TRaster32P, TPixel32>(
backRas32, background_host, dimOut);
else if (backRas64)
bgIsPremultiplied = setSourceRaster<TRaster64P, TPixel64>(
backRas64, background_host, dimOut);
float4 *bg_p = background_host;
float4 *out_p;
for (int j = 0; j < dimOut.ly; j++) {
out_p = out_tile_p + ((marginTop + j) * enlargedDimIn.lx + marginRight);
for (int i = 0; i < dimOut.lx; i++, bg_p++, out_p++) {
/*- 上レイヤが完全に不透明ならcontinue -*/
if ((*out_p).w >= 1.0f) continue;
/*- 下レイヤが完全に透明でもcontinue -*/
if ((*bg_p).w < 0.0001f) continue;
float3 bgExposure = {(*bg_p).x, (*bg_p).y, (*bg_p).z};
/*- 通常のLevelなど、Premultiplyされている素材に対し、depremultiplyを行う
DigiBookなどには行わない -*/
if (bgIsPremultiplied) {
// demultiply
bgExposure.x /= (*bg_p).w;
bgExposure.y /= (*bg_p).w;
bgExposure.z /= (*bg_p).w;
}
/*- ExposureをRGB値にする -*/
bgExposure.x = powf(10, (bgExposure.x - 0.5f) * hardness);
bgExposure.y = powf(10, (bgExposure.y - 0.5f) * hardness);
bgExposure.z = powf(10, (bgExposure.z - 0.5f) * hardness);
// multiply
bgExposure.x *= (*bg_p).w;
bgExposure.y *= (*bg_p).w;
bgExposure.z *= (*bg_p).w;
/*- 手前とOver合成 -*/
(*out_p).x = (*out_p).x + bgExposure.x * (1.0f - (*out_p).w);
(*out_p).y = (*out_p).y + bgExposure.y * (1.0f - (*out_p).w);
(*out_p).z = (*out_p).z + bgExposure.z * (1.0f - (*out_p).w);
/*- アルファ値もOver合成 -*/
(*out_p).w = (*out_p).w + (*bg_p).w * (1.0f - (*out_p).w);
}
}
background_host_ras->unlock();
}
开发者ID:SaierMe,项目名称:opentoonz,代码行数:66,代码来源:iwa_motionblurfx.cpp
示例18: doCompute
void doCompute(TTile &tile, double frame, const TRenderSettings &info)
{
bool isWarped = m_warped.isConnected();
if (!isWarped)
return;
if (fabs(m_intensity->getValue(frame)) < 0.01) {
m_warped->compute(tile, frame, info);
return;
}
int shrink = (info.m_shrinkX + info.m_shrinkY) / 2;
double scale = sqrt(fabs(info.m_affine.det()));
double gridStep = 1.5 * m_gridStep->getValue(frame);
WarpParams params;
params.m_intensity = m_intensity->getValue(frame) / gridStep;
params.m_warperScale = scale * gridStep;
params.m_sharpen = m_sharpen->getValue();
params.m_shrink = shrink;
double evolution = m_evol->getValue(frame);
double size = 100.0 / info.m_shrinkX;
TPointD pos(m_posx->getValue(frame), m_posy->getValue(frame));
//The warper is calculated on a standard reference, with fixed dpi. This makes sure
//that the lattice created for the warp does not depend on camera transforms and resolution.
TRenderSettings warperInfo(info);
double warperScaleFactor = 1.0 / params.m_warperScale;
warperInfo.m_affine = TScale(warperScaleFactor) * info.m_affine;
//Retrieve tile's geometry
TRectD tileRect;
{
TRasterP tileRas = tile.getRaster();
tileRect = TRectD(tile.m_pos, TDimensionD(tileRas->getLx(), tileRas->getLy()));
}
//Build the compute rect
TRectD warpedBox, warpedComputeRect, tileComputeRect;
m_warped->getBBox(frame, warpedBox, info);
getWarpComputeRects(tileComputeRect, warpedComputeRect, warpedBox, tileRect, params);
if (tileComputeRect.getLx() <= 0 || tileComputeRect.getLy() <= 0)
return;
if (warpedComputeRect.getLx() <= 0 || warpedComputeRect.getLy() <= 0)
return;
TRectD warperComputeRect(TScale(warperScaleFactor) * tileComputeRect);
double warperEnlargement = getWarperEnlargement(params);
warperComputeRect = warperComputeRect.enlarge(warperEnlargement);
warperComputeRect.x0 = tfloor(warperComputeRect.x0);
warperComputeRect.y0 = tfloor(warperComputeRect.y0);
warperComputeRect.x1 = tceil(warperComputeRect.x1);
warperComputeRect.y1 = tceil(warperComputeRect.y1);
//Compute the warped tile
TTile tileIn;
m_warped->allocateAndCompute(tileIn, warpedComputeRect.getP00(),
TDimension(warpedComputeRect.getLx(), warpedComputeRect.getLy()),
tile.getRaster(), frame, info);
TRasterP rasIn = tileIn.getRaster();
//Compute the warper tile
TSpectrum::ColorKey colors[] = {
TSpectrum::ColorKey(0, TPixel32::White),
TSpectrum::ColorKey(1, TPixel32::Black)};
TSpectrumParamP cloudscolors = TSpectrumParamP(tArrayCount(colors), colors);
//Build the warper
warperInfo.m_affine = warperInfo.m_affine;
TAffine aff = warperInfo.m_affine.inv();
TTile warperTile;
TRasterP rasWarper = rasIn->create(warperComputeRect.getLx(), warperComputeRect.getLy());
warperTile.m_pos = warperComputeRect.getP00();
warperTile.setRaster(rasWarper);
{
TRenderSettings info2(warperInfo);
//Now, separate the part of the affine the Fx can handle from the rest.
TAffine fxHandledAffine = handledAffine(warperInfo, frame);
info2.m_affine = fxHandledAffine;
TAffine aff = warperInfo.m_affine * fxHandledAffine.inv();
aff.a13 /= warperInfo.m_shrinkX;
aff.a23 /= warperInfo.m_shrinkY;
TRectD rectIn = aff.inv() * warperComputeRect;
//rectIn = rectIn.enlarge(getResampleFilterRadius(info)); //Needed to counter the resample filter
TRect rectInI(tfloor(rectIn.x0), tfloor(rectIn.y0), tceil(rectIn.x1) - 1, tceil(rectIn.y1) - 1);
// rasIn e' un raster dello stesso tipo di tile.getRaster()
TTile auxtile(warperTile.getRaster()->create(rectInI.getLx(), rectInI.getLy()), convert(rectInI.getP00()));
//.........这里部分代码省略.........
开发者ID:JosefMeixner,项目名称:opentoonz,代码行数:101,代码来源:randomwavefx.cpp
示例19: doCompute_CPU
void Iwa_MotionBlurCompFx::doCompute_CPU(
TTile &tile, double frame, const TRenderSettings &settings,
float4 *pointsTable, int pointAmount, double hardness, double shutterStart,
double shutterEnd, int traceResolution, float startValue, float startCurve,
float endValue, float endCurve, int marginLeft, int marginRight,
int marginTop, int marginBottom, TDimensionI &enlargedDimIn,
TTile &enlarge_tile, TDimensionI &dimOut, TDimensionI &filterDim,
TTile &back_tile) {
/*- 処理を行うメモリ -*/
float4 *in_tile_p; /*- マージンあり -*/
float4 *out_tile_p; /*- マージンあり -*/
/*- フィルタ -*/
float *
|
请发表评论