template<> void TUNDRACORE_API Attribute<uint>::Interpolate(IAttribute* start, IAttribute* end, float t, AttributeChange::Type change) { Attribute<uint>* startUint = dynamic_cast<Attribute<uint>*>(start); Attribute<uint>* endUint = dynamic_cast<Attribute<uint>*>(end); if (startUint && endUint) Set((uint)RoundInt(Lerp((float)startUint->Get(), (float)endUint->Get(), t)), change); }
void NumericControl::UpdateControls() { NumericEdit::UpdateControls(); int i0, i1; slider.GetRange( i0, i1 ); slider.SetValue( i0 + RoundInt( (m_value - m_lowerBound)/(m_upperBound - m_lowerBound)*(i1 - i0) ) ); }
void DrizzleIntegrationInterface::UpdateIntegrationControls() { GUI->Scale_SpinBox.SetValue( RoundInt( m_instance.p_scale ) ); GUI->DropShrink_NumericControl.SetValue( m_instance.p_dropShrink ); GUI->EnableRejection_CheckBox.SetChecked( m_instance.p_enableRejection ); GUI->EnableImageWeighting_CheckBox.SetChecked( m_instance.p_enableImageWeighting ); GUI->EnableSurfaceSplines_CheckBox.SetChecked( m_instance.p_enableSurfaceSplines ); GUI->ClosePreviousImages_CheckBox.SetChecked( m_instance.p_closePreviousImages ); }
virtual void Run() { if ( m_T.m_transformChain.IsEmpty() ) for ( int i = m_start; i < m_end; ++i ) { double f = double( i )/uint24_max; m_T.Transform( f ); m_lut[i] = uint16( RoundInt( f*uint16_max ) ); } else for ( int i = m_start; i < m_end; ++i ) { double f = double( i )/uint24_max; m_T.Transform( f ); for ( HistogramTransformation::transformation_list::const_iterator j = m_T.m_transformChain.Begin(); j != m_T.m_transformChain.End(); ++j ) j->Transform( f ); m_lut[i] = uint16( RoundInt( f*uint16_max ) ); } }
void HistogramTransformation::Make20BitLUT( uint16* lut ) const { if ( lut == 0 ) return; for ( uint32 i = 0; i <= uint20_max; ++i ) { double f = double( i )/uint20_max; Transform( f ); for ( transformation_list::const_iterator j = m_transformChain.Begin(); j != m_transformChain.End(); ++j ) j->Transform( f ); *lut++ = uint16( RoundInt( f*uint16_max ) ); } }
void HistogramTransformation::Make8BitLUT( uint8* lut ) const { if ( lut == 0 ) return; UpdateFlags(); for ( int i = 0; i <= uint8_max; ++i ) { double f = double( i )/uint8_max; Transform( f ); for ( transformation_list::const_iterator j = m_transformChain.Begin(); j != m_transformChain.End(); ++j ) j->Transform( f ); *lut++ = uint8( RoundInt( f*uint8_max ) ); } }
void HistogramTransformation::Apply( Histogram& dstH, const Histogram& srcH ) const { dstH.Allocate(); dstH.m_histogram = 0; dstH.m_peakLevel = 0; if ( srcH.IsEmpty() ) return; for ( int i = 0; i < srcH.m_resolution; ++i ) { double f = double( i )/(srcH.m_resolution - 1); Transform( f ); for ( transformation_list::const_iterator j = m_transformChain.Begin(); j != m_transformChain.End(); ++j ) j->Transform( f ); dstH.m_histogram[RoundInt( f*(dstH.m_resolution - 1) )] += srcH.m_histogram[i]; } dstH.UpdatePeakLevel(); }
void render(particle &ptc){ //if (!Frustum::aabbInFrustum(ptc.hb)) return ptcsrendered++; float size = (float)BLOCKTEXTURE_UNITSIZE / BLOCKTEXTURE_SIZE * ptc.psize; float col = world::getbrightness(RoundInt(ptc.xpos), RoundInt(ptc.ypos), RoundInt(ptc.zpos)) / (float)world::BRIGHTNESSMAX; float col1 = col * 0.5f; float col2 = col * 0.7f; float tcx = ptc.tcX; float tcy = ptc.tcY; float psize = ptc.psize; double xpos = ptc.xpos - player::xpos; double ypos = ptc.ypos - player::ypos - player::height - player::heightExt; double zpos = ptc.zpos - player::zpos; glColor3d(col1, col1, col1); glTexCoord2d(tcx + size * 0.0, tcy + size * 0.0); glVertex3d(xpos - psize, ypos - psize, zpos + psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 0.0); glVertex3d(xpos + psize, ypos - psize, zpos + psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 1.0); glVertex3d(xpos + psize, ypos + psize, zpos + psize); glTexCoord2d(tcx + size * 0.0, tcy + size * 1.0); glVertex3d(xpos - psize, ypos + psize, zpos + psize); glColor3d(col1, col1, col1); glTexCoord2d(tcx + size * 0.0, tcy + size * 0.0); glVertex3d(xpos - psize, ypos + psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 0.0); glVertex3d(xpos + psize, ypos + psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 1.0); glVertex3d(xpos + psize, ypos - psize, zpos - psize); glTexCoord2d(tcx + size * 0.0, tcy + size * 1.0); glVertex3d(xpos - psize, ypos - psize, zpos - psize); glColor3d(col, col, col); glTexCoord2d(tcx + size * 0.0, tcy + size * 0.0); glVertex3d(xpos + psize, ypos + psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 0.0); glVertex3d(xpos - psize, ypos + psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 1.0); glVertex3d(xpos - psize, ypos + psize, zpos + psize); glTexCoord2d(tcx + size * 0.0, tcy + size * 1.0); glVertex3d(xpos + psize, ypos + psize, zpos + psize); glColor3d(col, col, col); glTexCoord2d(tcx + size * 0.0, tcy + size * 0.0); glVertex3d(xpos - psize, ypos - psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 0.0); glVertex3d(xpos + psize, ypos - psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 1.0); glVertex3d(xpos + psize, ypos - psize, zpos + psize); glTexCoord2d(tcx + size * 0.0, tcy + size * 1.0); glVertex3d(xpos - psize, ypos - psize, zpos + psize); glColor3d(col2, col2, col2); glTexCoord2d(tcx + size * 0.0, tcy + size * 0.0); glVertex3d(xpos + psize, ypos + psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 0.0); glVertex3d(xpos + psize, ypos + psize, zpos + psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 1.0); glVertex3d(xpos + psize, ypos - psize, zpos + psize); glTexCoord2d(tcx + size * 0.0, tcy + size * 1.0); glVertex3d(xpos + psize, ypos - psize, zpos - psize); glColor3d(col2, col2, col2); glTexCoord2d(tcx + size * 0.0, tcy + size * 0.0); glVertex3d(xpos - psize, ypos - psize, zpos - psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 0.0); glVertex3d(xpos - psize, ypos - psize, zpos + psize); glTexCoord2d(tcx + size * 1.0, tcy + size * 1.0); glVertex3d(xpos - psize, ypos + psize, zpos + psize); glTexCoord2d(tcx + size * 0.0, tcy + size * 1.0); glVertex3d(xpos - psize, ypos + psize, zpos - psize); }