void update_acc(pset* s) { int i, j; double d, inten1, inten2; int size = s->nb; #pragma omp parallel for private(i) schedule(static) for (i = 0; i < size; ++i) { s->acc[i] = 0 ; s->acc[i+size] = 0; s->acc[i+2*size] = 0; } #pragma omp parallel for private(i) schedule(static) for (i = 0; i < size; ++i) { for (j = i+1; j < size; ++j) { d = distance(s->pos[i], s->pos[i+ size], s->pos[i+ 2*size], s->pos[j], s->pos[j+ size], s->pos[j+ 2*size]); inten1 = intensity(s->m[j], d); s->acc[i]+= inten1 *(s->pos[j] - s->pos[i]); s->acc[i+size]+= inten1 *(s->pos[j+size] - s->pos[i+size]); s->acc[i+2*size]+= inten1 *(s->pos[j+2*size] - s->pos[i+2*size]); inten2 = intensity(s->m[i], d); s->acc[j]-= inten2 *(s->pos[j] - s->pos[i]); s->acc[j+size]-= inten2 *(s->pos[j+size] - s->pos[i+size]); s->acc[j+2*size]-= inten2 *(s->pos[j+2*size] - s->pos[i+2*size]); } } }
void Logo::Redraw (Coord, Coord, Coord, Coord) { if (rainbow > 0) { if (colors == nil) { colors = new Color* [rainbow]; for (int c = 0; c < rainbow; ++c) { float hue = float(c) / float(rainbow-1); colors[c] = new Color( intensity(hue, red_profile, profile_count), intensity(hue, green_profile, profile_count), intensity(hue, blue_profile, profile_count) ); colors[c]->Reference(); } } float h = float(ymax+1)/rainbow; const Color* oldfg = output->GetFgColor(); for (int c = 0; c < rainbow; ++c) { output->SetColors(colors[c], nil); output->FillRect(canvas, 0, Coord(c * h), xmax, Coord((c+1) * h)); } output->SetColors(oldfg, nil); } else { output->ClearRect(canvas, 0, 0, xmax, ymax); } if (bitmap == nil) { DrawPolygon(); } else { DrawBitmap(); } }
bool gvVisionTask_black::gvTask_inspect( Hobject image_src, Hobject *outRegion_defects ) { // Local iconic variables Hobject TMP_Region, Region1, RegionErosion1,ImageReduced; Hobject Image_meanSmall, Image_meanLarge, RegionDynThresh; Hobject ConnectedRegions, RegionFillUp, RegionErosion, ConnectedRegions1; Hobject SelectedRegions, RegionDilation1, RegionDilation; Hobject RegionDifference, obj_selected; // Local control variables HTuple Meancenter, Deviation, Meanouter, Deviation1; HTuple Index, Number; // reduce_domain(image_src, gvTask_GetROI()->gvROI_GetROI(), &ImageReduced); reduce_domain(image_src, gvTask_GetROI()->gvROI_GetROI(), &ImageReduced); threshold(ImageReduced, &Region1, 100, 255); fill_up(Region1, &Region1); erosion_circle(Region1, &RegionErosion1, 20); mean_image(ImageReduced, &Image_meanSmall, 2, 2); mean_image(ImageReduced, &Image_meanLarge, 20, 20); dyn_threshold(Image_meanSmall, Image_meanLarge, &RegionDynThresh, 5, "dark"); connection(RegionDynThresh, &ConnectedRegions); fill_up(ConnectedRegions, &RegionFillUp); erosion_circle(RegionFillUp, &RegionErosion, 1.5); connection(RegionErosion, &ConnectedRegions1); select_shape(ConnectedRegions1, &SelectedRegions, "area", "and", m_minBlackSpotArea, 5000); dilation_circle(SelectedRegions, &RegionDilation1, 2.5); intensity(RegionDilation1, Image_meanSmall, &Meancenter, &Deviation); dilation_circle(SelectedRegions, &RegionDilation, 5); difference(RegionDilation, SelectedRegions, &RegionDifference); intensity(RegionDifference, Image_meanSmall, &Meanouter, &Deviation1); gen_empty_obj(&(*outRegion_defects)); for (Index=0; Index<=(Meancenter.Num())-1; Index+=1) { select_obj(SelectedRegions, &obj_selected, Index+1); if (0 != ((HTuple(Meancenter[Index])-HTuple(Meanouter[Index]))<-30)) { concat_obj((*outRegion_defects), obj_selected, &(*outRegion_defects)); } } count_obj((*outRegion_defects), &Number); if(Number>m_maxBlackSpotCnt||Number<m_minBlackSpotCnt ) { return FALSE; } return TRUE; }
void fill_color(int a, int b, int c,int col) { int h,w; double color,z; for(h = 0; h<HEIGHT; h++) { for(w=0; w<WIDTH; w++) { if(temp[h][w].flag) { z = temp[h][w].z; if (fabs(z - (double)cz) < fabs(zbuf[h][w] - (double)cz)) { zbuf[h][w] = z; find_vectors_sphere(h,w,a,b,c); color = intensity(); frame_buffer[h][w] = color; color_buffer[h][w] = col; } } temp[h][w].flag = 0; } } }
void CueStack::postRun(MasterTimer* timer) { qDebug() << Q_FUNC_INFO; Q_ASSERT(timer != NULL); Q_ASSERT(m_fader != NULL); // Bounce all intensity channels to MasterTimer's fader for zeroing QHashIterator <FadeChannel,FadeChannel> it(m_fader->channels()); while (it.hasNext() == true) { it.next(); FadeChannel fc = it.value(); if (fc.group(doc()) == QLCChannel::Intensity) { fc.setStart(fc.current(intensity())); fc.setTarget(0); fc.setElapsed(0); fc.setReady(false); fc.setFadeTime(fadeOutSpeed()); timer->fader()->add(fc); } } m_currentIndex = -1; delete m_fader; m_fader = NULL; emit currentCueChanged(m_currentIndex); emit stopped(); }
KViewEffects::KViewEffects( QObject* parent, const char* name, const QStringList & ) : Plugin( parent, name ) , m_gamma( 0.5 ), m_lastgamma( -1.0 ) , m_opacity( 50 ), m_lastopacity( -1 ) , m_intensity( 50 ), m_lastintensity( -1 ) , m_color( white ) , m_image( 0 ) { QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false ); m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() ); delete viewerList; if( m_pViewer ) { KAction * gammaaction = new KAction( i18n( "&Gamma Correction..." ), 0, 0, this, SLOT( gamma() ), actionCollection(), "plugin_effects_gamma" ); KAction * blendaction = new KAction( i18n( "&Blend Color..." ), 0, 0, this, SLOT( blend() ), actionCollection(), "plugin_effects_blend" ); KAction * intensityaction = new KAction( i18n( "Change &Intensity (Brightness)..." ), 0, 0, this, SLOT( intensity() ), actionCollection(), "plugin_effects_intensity" ); gammaaction->setEnabled( m_pViewer->canvas()->image() != 0 ); blendaction->setEnabled( m_pViewer->canvas()->image() != 0 ); intensityaction->setEnabled( m_pViewer->canvas()->image() != 0 ); connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), gammaaction, SLOT( setEnabled( bool ) ) ); connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), blendaction, SLOT( setEnabled( bool ) ) ); connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), intensityaction, SLOT( setEnabled( bool ) ) ); } else
void EFXFixture::stop(MasterTimer* timer, QList<Universe *> universes) { Q_UNUSED(universes); if (fadeIntensity() > 0 && m_started == true) { Fixture* fxi = doc()->fixture(head().fxi); Q_ASSERT(fxi != NULL); if (fxi->masterIntensityChannel(head().head) != QLCChannel::invalid()) { FadeChannel fc; fc.setFixture(doc(), head().fxi); fc.setChannel(fxi->masterIntensityChannel(head().head)); if (m_parent->overrideFadeOutSpeed() != Function::defaultSpeed()) fc.setFadeTime(m_parent->overrideFadeOutSpeed()); else fc.setFadeTime(m_parent->fadeOutSpeed()); fc.setStart(uchar(floor((float(fadeIntensity()) * intensity()) + 0.5))); fc.setCurrent(fc.start()); fc.setTarget(0); // Give zero-fading to MasterTimer because EFX will stop after this call timer->faderAdd(fc); // Remove the previously up-faded channel from EFX's internal fader to allow // MasterTimer's fader take HTP precedence. m_parent->m_fader->remove(fc); } } m_started = false; }
void GLWidget::paintGL() { // Clear color and depth buffer glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Set modelview-projection matrix program->setUniformValue("projection", projection); // Set camera matrix program->setUniformValue("camera", camera); // Set Light properties QVector3D position(10, 0, pos); QVector3D intensity(0.2, 0.4, 0.2); program->setUniformValue("lightPosition", position); program->setUniformValue("lightIntensity", intensity); // Set model matrix model.setToIdentity(); QQuaternion rotation = QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 1), count); model.rotate(rotation); program->setUniformValue("model", model); object->render(); }
void panTaskColor::OnButton1Click( wxCommandEvent& event ) { Hobject image_src,region_loc,ImageReduced, Red, Green, Blue; HTuple Mean_red, Deviation, Mean_green,Mean_blue; image_src = c_pgvVisionImage->gvIMG_GetImage(); reduce_domain(image_src, c_pgvTask->gvTask_GetROI()->gvROI_GetROI(), &ImageReduced); decompose3(ImageReduced, &Red, &Green, &Blue); intensity(ImageReduced, Red, &Mean_red, &Deviation); intensity(ImageReduced, Green, &Mean_green, &Deviation); intensity(ImageReduced, Blue, &Mean_blue, &Deviation); m_actualblue->SetValue(Mean_blue[0].L()); m_actualred->SetValue(Mean_red[0].L()); m_actualgreen->SetValue(Mean_green[0].L()); }
void SceneObject::addEnergyDensity(const int triId , const vec3f& thr) { float energyDens = intensity(thr) / areaValues[triId]; float value = energyDens * energyDens; totalEnergy += value; energyDensity[triId] += value; }
void VCSlider::emitSubmasterValue() { Q_ASSERT(sliderMode() == Submaster); emit submasterValueChanged(SCALE(float(m_levelValue), float(0), float(UCHAR_MAX), float(0), float(1)) * intensity()); }
/* * maximum - Returns the adress of the pixel with the highest intensity in src */ static pixel *maximum(int dim, pixel *src) { int ii, jj; pixel *maxi = src; int darkness = 0; for(jj = dim-1; jj >= 0; jj--) for(ii = 0; ii <= dim-1; ii++) if (intensity (src[RIDX(ii, jj, dim)]) > darkness) { darkness = intensity (src[RIDX(ii, jj, dim)]); maxi = &(src[RIDX(ii, jj, dim)]); } return maxi; }
static pixel *maximum_2(int dim, pixel *src) { int jj; pixel *maxi = src; int darkness = 0; int tot = dim * dim; for(jj = 0; jj < tot; jj++) { if (intensity (src[jj]) > darkness) { darkness = intensity (src[jj]); maxi = &(src[jj]); } } return maxi; }
void QAbstractLight::setIntensity(float value) { Q_D(QAbstractLight); if (intensity() != value) { d->m_shaderData->setProperty("intensity", value); emit intensityChanged(value); } }
void CueStack::preRun() { qDebug() << Q_FUNC_INFO; Q_ASSERT(m_fader == NULL); m_fader = new GenericFader(doc()); m_fader->adjustIntensity(intensity()); m_elapsed = 0; emit started(); }
void VCSlider::setValue(int value, bool setDMX, bool updateFeedback) { if (m_value == value) return; Tardis::instance()->enqueueAction(VCSliderSetValue, id(), m_value, value); m_value = value; switch(sliderMode()) { case Level: if (m_monitorEnabled == true && m_isOverriding == false && setDMX) { m_priority = DMXSource::Override; m_doc->masterTimer()->requestNewPriority(this); m_isOverriding = true; emit isOverridingChanged(); } if (clickAndGoType() == CnGPreset) updateClickAndGoResource(); break; case Submaster: emit submasterValueChanged(SCALE(qreal(m_value), qreal(0), qreal(UCHAR_MAX), qreal(0), qreal(1.0)) * intensity()); break; case GrandMaster: m_doc->inputOutputMap()->setGrandMasterValue(value); break; case Adjust: m_adjustChangeCounter++; break; } emit valueChanged(value); if (setDMX) m_levelValueChanged = true; Q_UNUSED(updateFeedback) /* TODO if (updateFeedback) { int fbv = 0; if (invertedAppearance() == true) fbv = levelHighLimit() - m_value; else fbv = m_value; fbv = (int)SCALE(float(fbv), float(levelLowLimit()), float(levelHighLimit()), float(0), float(UCHAR_MAX)); sendFeedback(fbv); } */ }
QVariant SmellSensor::generateEmpty(QString typeName, SensorType type, btScalar radiusOfSmell) { QVariantMap data = Sensor::generateEmpty(typeName, type).toMap(); BrainIn intensity(0, radiusOfSmell); intensity.connectRandomly(); data.insert("intensityInput", intensity.serialize()); data.insert("radiusOfSmell", (double) radiusOfSmell); return data; }
void LightPoint::update_radius() { XMVECTOR v = colorv(); float r = XMVectorGetX(v); float g = XMVectorGetY(v); float b = XMVectorGetZ(v); float max = std::fmaxf(std::fmaxf(r, g), b); m_radius = (-m_linear + std::sqrtf(m_linear * m_linear - 4 * m_quadratic * (m_constant - 256.0f * intensity() * max))) / (2 * m_quadratic); }
/// Sets the integral intensity of the peak by adjusting the height. void IPeakFunction::setIntensity(const double newIntensity) { double currentHeight = height(); double currentIntensity = intensity(); if (currentIntensity == 0.0) { // Try to set a different height first. setHeight(2.0); currentHeight = height(); currentIntensity = intensity(); // If the current intensity is still 0, there's nothing left to do. if (currentIntensity == 0.0) { throw std::invalid_argument( "Cannot set new intensity, not enough information available."); } } setHeight(newIntensity / currentIntensity * currentHeight); }
virtual double fastCompare(const KisInterestPoint* ip) const { const HarrisPoint* ip2 = dynamic_cast<const HarrisPoint*>(ip); Q_ASSERT(ip2); double score = 0.0; if (intensity() > ip2->intensity()) { score += ip2->intensity() / intensity(); } else { score += intensity() / ip2->intensity(); } if (high() > ip2->high()) { score += ip2->high() / high(); } else { score += high() / ip2->high(); } if (low() > ip2->low()) { score += ip2->low() / low(); } else { score += low() / ip2->low(); } return score * (1. / 3.); }
void drawPoly_zbuffer(void) { int x0, y0, x1, y1, i, j, k, p0, p1; double z0, z1, color, z; int minx, maxx, miny, maxy; for(i = 0;i<no_planes;i++) { find_vectors(i); color = intensity(); for(j=0;j<4;j++) { p0 =planes[i][j]; p1 =planes[i][(j+1)%4]; x0 = vertex[p0][0]; x1 = vertex[p1][0]; y0 = vertex[p0][1]; y1 = vertex[p1][1]; z0 = tmp_ver[p0][2]; z1 = tmp_ver[p1][2]; drawSlopeIndpLine(x0, y0, z0, x1, y1, z1); drawSlopeIndpLine(x0+1, y0+1, z0+1, x1-1, y1-1, z1-1); drawSlopeIndpLine(x0-1, y0-1, z0-1, x1+1, y1+1, z1+1); }// end of each line minx = find_min(vertex[planes[i][0]][0], vertex[planes[i][1]][0], vertex[planes[i][2]][0],vertex[planes[i][3]][0]); maxx = find_max(vertex[planes[i][0]][0], vertex[planes[i][1]][0], vertex[planes[i][2]][0],vertex[planes[i][3]][0]); miny = find_min(vertex[planes[i][0]][1], vertex[planes[i][1]][1], vertex[planes[i][2]][1],vertex[planes[i][3]][1]); maxy = find_max(vertex[planes[i][0]][1], vertex[planes[i][1]][1], vertex[planes[i][2]][1],vertex[planes[i][3]][1]); for(k=maxy;k>=miny;k--) { for(j=minx; j<=maxx;j++) { if(temp[k+H][j+W].flag) { z = temp[k+H][j+W].z; if (fabs(z - (double)cz) < fabs(zbuf[k+H][j+W] - (double)cz)) { zbuf[k+H][j+W] = z; frame_buffer[k+H][j+W] = color; color_buffer[k+H][j+W] = i; } } temp[k+H][j+W].flag = 0; } } }//end of each planes }
void ImageUtils::convertBumpToNormal(fipImage &toConvert, float strength) { if (toConvert.getBitsPerPixel() < 24) toConvert.convertTo24Bits(); const int w = toConvert.getWidth(); const int h = toConvert.getHeight(); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { RGBQUAD topLeft, top, topRight, left, right, bottomLeft, bottom, bottomRight; RGBQUAD current; toConvert.getPixelColor(glm::clamp(x - 1, 0, w - 1), glm::clamp(y - 1, 0, h - 1), &topLeft); toConvert.getPixelColor(x, glm::clamp(y - 1, 0, h - 1), &top); toConvert.getPixelColor(glm::clamp(x + 1, 0, w - 1), glm::clamp(y - 1, 0, h - 1), &topRight); toConvert.getPixelColor(glm::clamp(x - 1, 0, w - 1), y, &left); toConvert.getPixelColor(glm::clamp(x + 1, 0, w - 1), y, &right); toConvert.getPixelColor(glm::clamp(x - 1, 0, w - 1), glm::clamp(y + 1, 0, h - 1), &bottomLeft); toConvert.getPixelColor(x, glm::clamp(y + 1, 0, h - 1), &bottom); toConvert.getPixelColor(glm::clamp(x + 1, 0, w - 1), glm::clamp(y + 1, 0, h - 1), &bottomRight); toConvert.getPixelColor(x, y, ¤t); const float tl = intensity(topLeft); const float t = intensity(top); const float tr = intensity(topRight); const float l = intensity(left); const float r = intensity(right); const float bl = intensity(bottomLeft); const float b = intensity(bottom); const float br = intensity(bottomRight); glm::vec3 normal((tr + 2.0f * r + br) - (tl + 2.0f * l + bl), (bl + 2.0f * b + br) - (tl + 2.0f * t + tr), 1.0f / strength); normal = (glm::normalize(normal) + 1.0f) * 0.5f * 255.0f; current.rgbRed = BYTE(normal.r); current.rgbGreen = BYTE(normal.g); current.rgbBlue = BYTE(normal.b); toConvert.setPixelColor(x, y, ¤t); } } }
int main(void) { unsigned char i; /* a counter */ init_new_game(); /* initialize dots ... */ while (true) /* do forever... the following */ { start_one_vectrex_round(); /* start vectrex round */ intensity(MAX_BRIGHTNESS); /* set intensity of vector beam... */ for (i=0; i < SHOTS; i++) /* and process all dots */ { do_shot(¤t_shots[i]); /* with this function ... */ } } }
PointLight::PointLight() { QString color("{ 'var' : 'lightColor', 'name' : 'Color', 'type' : 'color', 'value' : '#ffffff', 'glslFragmentConstant' : true }"); QString intensity("{ 'var' : 'uniformLightIntensity', 'name' : 'Intensity', 'type' : 'float', 'min' : 0.0, 'max' : 1.0, 'value' : 1.0, 'glslFragmentConstant' : true }"); QString castShadows("{ 'var' : 'castShadows', 'name' : 'Casts Shadows', 'type' : 'bool', 'value' : true }"); QStringList atts; atts << color << intensity << castShadows; addAttributes(atts); Attribute position = attributeByName("Position"); position->setProperty("glslFragmentConstant", "lightPos"); //renameAttributeVar("position", "lightPos"); }
AmbientLight::AmbientLight() { QString color("{ 'var' : 'lightColor', 'name' : 'Color', 'type' : 'color', 'value' : '#eeeeff', 'glslFragmentConstant' : true }"); QString intensity("{ 'var' : 'lightIntensity', 'name' : 'Intensity', 'type' : 'float', 'min' : 0.0, 'max' : 1.0, 'value' : 0.2, 'glslFragmentConstant' : true }"); QStringList atts; atts << color << intensity; addAttributes(atts); Attribute position = attributeByName("Position"); removeAttribute(position); //QString glslFragmentBegin(); //QString glslFragmentEnd(); }
void openniCallback(const sensor_msgs::PointCloud2::ConstPtr& cloud) { pcl17::PointCloud<pcl17::PointXYZRGB>::Ptr scene (new pcl17::PointCloud<pcl17::PointXYZRGB> ()); pcl17::fromROSMsg(*cloud, *scene); pcl17::PointCloud<pcl17::PointXYZI>::Ptr intensity (new pcl17::PointCloud<pcl17::PointXYZI> ()); PointCloudXYZRGBtoXYZI(*scene, *intensity); std::stringstream ss; ss << "/home/pablo/Desktop/pcd/" << counter << "_XYZRGB.pcd"; pcl17::io::savePCDFileASCII (ss.str(), *scene); ss.str(""); ss << "/home/pablo/Desktop/pcd/" << counter << "_XYZI.pcd"; std::cout << "Attempting to save intensity at " << ss.str() << std::endl; pcl17::io::savePCDFileASCII (ss.str(), *intensity); counter = counter + 1; }
/* * Our main function we start of here... * we should make sure that we never return from here, or vectrex will * be surely bothered! */ int main(void) { unsigned char anim_state; /* our animation state counter */ signed char pacman_x; /* where is the pacman? */ signed char pacman_y; pacman_x = 0; pacman_y = 0; anim_state = 0; setup(); /* setup our program */ while (true) /* never to return... */ { start_one_vectrex_round(); /* start 'de round */ intensity(MAX_BRIGHTNESS); /* set some brightness */ set_scale(MOVE_SCALE); /* set scale factor */ print_str(-128,100, "JOYTICK 1 TO MOVE PACMAN!"); /* a message! */ move_to(pacman_x, pacman_y); /* position pacman */ set_scale(PACMAN_SCALE); /* set scale factor for the sprite */ draw_vector_list(pacman[anim_state]); /* draw the current pacman */ anim_state++; /* next time the next animation */ if (anim_state == MAX_ANIM) /* could do a % MAXANIM, but this is */ anim_state = 0; /* more optimized */ if (!read_ram(Vec_Music_Flag)) /* music finished? */ play_song(SCRAMBLE_MUSIC); /* if so ... restart */ if (joystick1_x>0) /* check the joystick and */ { /* update position */ pacman_x++; } else if (joystick1_x<0) { pacman_x--; } if (joystick1_y>0) { pacman_y++; } else if (joystick1_y<0) { pacman_y--; } if (pacman_x>=100) pacman_x = 100; /* make sure pacman is not */ if (pacman_x<=-100) pacman_x = -100; /* out of bounds */ if (pacman_y>=100) pacman_y = 100; if (pacman_y<=-100) pacman_y = -100; joy_digital(); /* call once per round, to insure */ } /* while (true) */ /* joystick information is up to date */ }
/// Calculate histogram data for the given bin boundaries. /// @param out :: Output bin values (size == nBins) - integrals of the function /// inside each bin. /// @param left :: The left-most bin boundary. /// @param right :: A pointer to an array of successive right bin boundaries /// (size = nBins). /// @param nBins :: Number of bins. void Gaussian::histogram1D(double *out, double left, const double *right, const size_t nBins) const { double amplitude = intensity(); const double peakCentre = getParameter("PeakCentre"); const double sigma2 = getParameter("Sigma") * sqrt(2.0); auto cumulFun = [sigma2, peakCentre](double x) { return 0.5 * erf((x - peakCentre) / sigma2); }; double cLeft = cumulFun(left); for (size_t i = 0; i < nBins; ++i) { double cRight = cumulFun(right[i]); out[i] = amplitude * (cRight - cLeft); cLeft = cRight; } }
float sample_val(int note, unsigned int phase) { float f; // f = freq(note+12); switch(note) { case 0: f = NOTE_0; break; case 1: f = NOTE_1; break; case 2: f = NOTE_2; break; case 3: f = NOTE_3; break; case 4: f = NOTE_4; break; case 5: f = NOTE_5; break; case 6: f = NOTE_6; break; case 7: f = NOTE_7; break; case 8: f = NOTE_8; break; case 9: f = NOTE_9; break; case 10: f = NOTE_10; break; case 11: f = NOTE_11; break; } return (synth(phase, f) * intensity(note, 0) + synth(phase, f*2) * intensity(note, 1) + synth(phase, f*4) * intensity(note, 2) + synth(phase, f*8) * intensity(note, 3) + synth(phase, f*16) * intensity(note, 4) + synth(phase, f*32) * intensity(note, 5)); }
SpotLight::SpotLight() { QString color("{ 'var' : 'lightColor', 'name' : 'Color', 'type' : 'color', 'value' : '#ffffff', 'glslFragmentConstant' : true }"); QString intensity("{ 'var' : 'uniformLightIntensity', 'name' : 'Intensity', 'type' : 'float', 'min' : 0.0, 'max' : 1000.0, 'value' : 10.0, 'glslFragmentConstant' : true }"); QString coneAngle("{ 'var' : 'coneAngle', 'name' : 'Cone Angle', 'type' : 'float', 'min' : 1.0, 'max' : 150.0, 'value' : 60.0, 'glslFragmentConstant' : true }"); QString castShadows("{ 'var' : 'castShadows', 'name' : 'Casts Shadows', 'type' : 'bool', 'value' : true }"); //QString shadowBias("{ 'var' : 'shadowBias', 'name' : 'Shadow Bias', 'type' : 'float', 'min' : -100.0, 'max' : 100.0, 'value' : 0.1 }"); //QString spotDir("{ 'var' : 'spotDir', 'name' : 'Spot Direction', 'type' : 'vector3', 'getter' : 'spotDir', 'glslFragmentConstant' : true }"); QString shadowResolution("{ 'var' : 'shadowResolution', 'name' : 'Shadow Resolution', 'type' : 'int', 'min' : 32, 'max' : 4096, 'value' : 1024 }"); QStringList atts; atts << color << intensity << coneAngle << castShadows << shadowResolution;// << shadowBias;// << spotDir; addAttributes(atts); Attribute position = attributeByName("Position"); position->setProperty("glslFragmentConstant", "lightPos"); }