本文整理汇总了C++中TConfig::RowWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ TConfig::RowWidth方法的具体用法?C++ TConfig::RowWidth怎么用?C++ TConfig::RowWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TConfig
的用法示例。
在下文中一共展示了TConfig::RowWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render(uint frameTimeMS, double canvasWidth, double canvasHeight, const TConfig& config)
{
uint bottom = config.top + config.height;
const double scaleMin = 0.5;
const double scaleMax = 1.7;
const double rotationMaximum = 0.5;// 0 - 1=90 deg.
const double rotationSpeedX = 0.15;
const double rotationSpeedY = 0.09;
const double opacityMin = 0.3;
const double opacityMax = 0.65;
const double twinkleSpeed = 0.09;
const double twinkleThreshold = 0.93;
// these two will adjust the twinkle effect. it affects opacity of the square, and the color. both of these are 0-1.
const double maxTwinkleOpacity = 0.5;
const double twinkleBrightness = 0.5;
if(config.xflip)
{
squareFieldXFlip(canvasWidth / 2);
}
else
{
canvasSave();
}
// when modulating envelopes, how much does x/y dimension affect the
// envelope progression?
// values 0-20 will be plasma-like; higher can start to look more sharp / twinkly
double dimensionMult = 20;
int previousRowWidth = -1;
int rowWidth = -1;
for(uint y = config.top; y < bottom; y += config.blockSizeY)
{
uint iy = (y - config.top) / config.blockSizeY;
previousRowWidth = rowWidth;
rowWidth = config.RowWidth(y, config.top, bottom, canvasWidth, canvasHeight);
if(previousRowWidth == -1)
previousRowWidth = rowWidth;
uint right = config.left + rowWidth;
for(uint x = config.left; x < rowWidth; x += config.blockSizeX)
{
uint ix = (x - config.left) / config.blockSizeX;
//squareFieldRenderSquare(0.5, 0.5, 0.5, 0.5, 0xff00ff, 0.5, 8);
bool isOdd = ((ix & 1) == (iy & 1));// checkerboard
if(!config.oddFillEnabled && isOdd)
continue;
if(!config.evenFillEnabled && !isOdd)
continue;
const TheModColorMixingTable<ColorMixingSteps>& fillColorTable(isOdd ? config.oddColorTable : config.evenColorTable);
double xalphaVary = (config.opacityXEnv.height((dimensionMult * x) + frameTimeMS) + 1) / 2;
double yalphaVary = (config.opacityYEnv.height((dimensionMult * y) + frameTimeMS) + 1) / 2;
double userAlpha = config.Opacity(x, y, config.top, bottom, config.left, right, previousRowWidth, rowWidth, ix, iy);
double aa = 1.0;// anti-alias damping
if(((x - config.left) + config.blockSizeX) > rowWidth)
{
// "big" anti-alias this block.
aa = double(rowWidth - (x - config.left)) / config.blockSizeX;
}
double alpha = xalphaVary * yalphaVary * aa;
// now scale alpha to opacityMin / Max
double opacity = opacityMin + (alpha * (opacityMax - opacityMin));
double blockScale = (scaleMin + ((scaleMax - scaleMin) * alpha * userAlpha));
double thisBlockSizeX = blockScale * config.blockSizeX;
// this is actually incorrect; for a true grid use blockSizeX / Y, but this gives a cool effect that things are sorta wavy / bulgy
double xtrans = (double)x + ((double)thisBlockSizeX / 2);
double ytrans = (double)y + ((double)config.blockSizeY / 2);
double twinkleFactor = CachedRandEnvelope(ix, iy, twinkleSpeed).factor(frameTimeMS);
TheModColor fillStyle;
double finalOpacity;
if(twinkleFactor < twinkleThreshold)
{
finalOpacity = opacity * userAlpha;
fillStyle = fillColorTable.c1;
}
else
{
// scale it to 0-1
twinkleFactor = (twinkleFactor - twinkleThreshold) / (1.0 - twinkleThreshold);
double twinkleOpacity = twinkleFactor * maxTwinkleOpacity;
finalOpacity = (1.0 - (opacity * userAlpha)) * twinkleOpacity;
//.........这里部分代码省略.........