Рефераты. Автоматизированное редактирование частиц в компьютерной графике

double ParticleSystem::getRedBegin() const

{

return data.pRedBegin;

}

double ParticleSystem::getGreenBegin() const

{

return data.pGreenBegin;

}

double ParticleSystem::getBlueBegin() const

{

return data.pBlueBegin;

}

double ParticleSystem::getAlphaBegin() const

{

return data.pAlphaBegin;

}

void ParticleSystem::setRedBegin(double red)

{

data.pRedBegin = red;

}

void ParticleSystem::setGreenBegin(double green)

{

data.pGreenBegin = green;

}

void ParticleSystem::setBlueBegin(double blue)

{

data.pBlueBegin = blue;

}

void ParticleSystem::setAlphaBegin(double alpha)

{

data.pAlphaBegin = alpha;

}

double ParticleSystem::getRedEnd() const

{

return data.pRedEnd;

}

double ParticleSystem::getGreenEnd() const

{

return data.pGreenEnd;

}

double ParticleSystem::getBlueEnd() const

{

return data.pBlueEnd;

}

double ParticleSystem::getAlphaEnd() const

{

return data.pAlphaEnd;

}

void ParticleSystem::setRedEnd(double red)

{

data.pRedEnd = red;

}

void ParticleSystem::setGreenEnd(double green)

{

data.pGreenEnd = green;

}

void ParticleSystem::setBlueEnd(double blue)

{

data.pBlueEnd = blue;

}

void ParticleSystem::setAlphaEnd(double alpha)

{

data.pAlphaEnd = alpha;

}

double ParticleSystem::getRotateAngle() const

{

return data.pAngleRotate;

}

void ParticleSystem::setRotateAngle(double angle)

{

data.pAngleRotate = angle;

}

double ParticleSystem::getKFScaleBeginW() const

{

return data.pKFScaleBeginW;

}

double ParticleSystem::getKFScaleBeginH() const

{

return data.pKFScaleBeginH;

}

void ParticleSystem::setKFScaleBeginW(double scale)

{

data.pKFScaleBeginW = scale;

}

void ParticleSystem::setKFScaleBeginH(double scale)

{

data.pKFScaleBeginH = scale;

}

double ParticleSystem::getKFScaleEndW() const

{

return data.pKFScaleEndW;

}

double ParticleSystem::getKFScaleEndH() const

{

return data.pKFScaleEndH;

}

void ParticleSystem::setKFScaleEndW(double scale)

{

data.pKFScaleEndW = scale;

}

void ParticleSystem::setKFScaleEndH(double scale)

{

data.pKFScaleEndH = scale;

}

double ParticleSystem::getKFDispersionX() const

{

return data.pKFDispersionX;

}

double ParticleSystem::getKFDispersionY() const

{

return data.pKFDispersionY;

}

void ParticleSystem::setKFDispersionX(double disp)

{

data.pKFDispersionX = disp;

}

void ParticleSystem::setKFDispersionY(double disp)

{

data.pKFDispersionY = disp;

}

wxString ParticleSystem::getParticleTexFileName() const

{

return data.particleTexFileName;

}

void ParticleSystem::copyDataFromParticleSystem(ParticleSystem* sys_from)

{

if(!sys_from)

return;

data.pLifeTime = sys_from->data.pLifeTime;

data.pMaxCount = sys_from->data.pMaxCount;

data.pCountOnStart = sys_from->data.pCountOnStart;

data.pGravityX = sys_from->data.pGravityX;

data.pGravityY = sys_from->data.pGravityY;

//p.speed, dispersion page

data.pMoveSpeedX = sys_from->data.pMoveSpeedX;

data.pMoveSpeedY = sys_from->data.pMoveSpeedY;

data.pKFDispersionX = sys_from->data.pKFDispersionX;

data.pKFDispersionY = sys_from->data.pKFDispersionY;

//p.scale page

data.pKFScaleBeginW = sys_from->data.pKFScaleBeginW;

data.pKFScaleBeginH = sys_from->data.pKFScaleBeginH;

data.pKFScaleEndW = sys_from->data.pKFScaleEndW;

data.pKFScaleEndH = sys_from->data.pKFScaleEndH;

//p.color page

data.pRedBegin = sys_from->data.pRedBegin;

data.pGreenBegin = sys_from->data.pGreenBegin;

data.pBlueBegin = sys_from->data.pBlueBegin;

data.pAlphaBegin = sys_from->data.pAlphaBegin;

data.pRedEnd = sys_from->data.pRedEnd;

data.pGreenEnd = sys_from->data.pGreenEnd;

data.pBlueEnd = sys_from->data.pBlueEnd;

data.pAlphaEnd = sys_from->data.pAlphaEnd;

//rotate

data.pAngleRotate = sys_from->data.pAngleRotate;

//start in, stop in page

data.startDelay = sys_from->data.startDelay;

data.stopDelay = sys_from->data.stopDelay;

data.pAppearDelay = sys_from->data.pAppearDelay;

//PS settings page

data.pAppearBoxSize = sys_from->data.pAppearBoxSize;

data.speedChangeX = sys_from->data.speedChangeX;

data.speedChangeY = sys_from->data.speedChangeY;

setX(sys_from->data.initialX);

setY(sys_from->data.initialY);

if(sys_from->data.particleTexFileName == "")

setDefaultParticleTex();

else

setParticleTex(sys_from->data.particleTexFileName);

}

bool ParticleSystem::isRun() const

{

return isRunb;

}

bool ParticleSystem::isFinished() const

{

return isFinishedb;

}

void ParticleSystem::start()

{

isRunb = true;

isFinishedb = false;

restart();

}

void ParticleSystem::stop()

{

isRunb = false;

}

void ParticleSystem::stopExtra()

{

isRunb = false;

finish();

}

void ParticleSystem::finish()

{

isFinishedb = true;

currentX = data.initialX;

currentY = data.initialY;

}

void ParticleSystem::restart()

{

startInTime = data.startDelay;

stopInTime = data.stopDelay;

timeForNextParticle = data.pAppearDelay;

int count = data.pCountOnStart;

for (int i=0; i<EXPL_MAX; i++)

{

if (count > 0)

{

initParticleAtIndex(i);

count--;

}

else

{

pTM[i] = 0;

}

}

}

void ParticleSystem::initParticleAtIndex(int i)

{

assert(i >= 0 && i < EXPL_MAX);

pTM[i] = data.pLifeTime;

pX[i] = fmod(rand(), data.pAppearBoxSize.width);

pY[i] = fmod(rand(), data.pAppearBoxSize.height);

double speedDeltaX = fmod(rand(), data.pKFDispersionX * 2 + 1) - data.pKFDispersionX;

pDx[i] = data.pMoveSpeedX + speedDeltaX;

double speedDeltaY = fmod(rand(), data.pKFDispersionY * 2 + 1) - data.pKFDispersionY;

pDy[i] = data.pMoveSpeedY + speedDeltaY;

}

void ParticleSystem::drawBound()

{

double appear_w = data.pAppearBoxSize.width;

double appear_h = data.pAppearBoxSize.height;

//draw bound itself

glColor4d(boundColor.Red()/255.0, boundColor.Green()/255.0, boundColor.Blue()/255.0, boundColor.Alpha()/255.0);

glBegin(GL_POLYGON);

glVertex2d(currentX - BOUND_DIMENSION, currentY - BOUND_DIMENSION);

glVertex2d(currentX + appear_w + BOUND_DIMENSION, currentY - BOUND_DIMENSION);

glVertex2d(currentX + appear_w + BOUND_DIMENSION, currentY + appear_h + BOUND_DIMENSION);

glVertex2d(currentX - BOUND_DIMENSION, currentY + appear_h + BOUND_DIMENSION);

glEnd();

//draw inner part of bound

glColor4d(boundedRectColor.Red()/255.0, boundedRectColor.Green()/255.0, boundedRectColor.Blue()/255.0,

boundedRectColor.Alpha()/255.0);

glBegin(GL_POLYGON);

Страницы: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14



2012 © Все права защищены
При использовании материалов активная ссылка на источник обязательна.