T const * const operator -> () const { QSE_ASSERT( m_bValid ); return GetT(); }
T const & operator * () const { QSE_ASSERT( m_bValid ); return *GetT(); }
T & operator * () { QSE_ASSERT( m_bValid ); return *GetT(); }
m2::AnyRectD GetCurrentRect(ScreenBase const & screen) const override { // Current position = target position - amplutide * e ^ (elapsed / duration). // We calculate current position not based on start position, but based on target position. return m2::AnyRectD(m_targetCenter - m_direction * exp(-kKineticFadeoff * GetT()), m_angle, m_localRect); }
void CCameraFilterPass<S>::Draw() const { if (m_shader) const_cast<S&>(*m_shader).DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru)); }
void OpacityAnimation::Advance(double elapsedSeconds) { TBase::Advance(elapsedSeconds); m_opacity = InterpolateDouble(m_startOpacity, m_endOpacity, GetT()); }
/////////////////////////////////////////////////////////////////////////////// // GetHangulCharCluster // // The return value is the number of chars eaten; clusterSize is the number of // chars generated. In the large majority of cases, they will be equal. // eastl_size_t Typesetter::GetHangulCharCluster(eastl_size_t i, eastl_size_t iCharEnd, Char* pCharCluster, eastl_size_t& clusterSize, int& clusterType) { EA_ASSERT((i < iCharEnd) && (iCharEnd <= mLineLayout.mCharArray.size())); bool bCompose = false; // To do: Make this configurable, perhaps part of LayoutSettings. eastl_size_t charCount = 0; if(!bCompose) // If we leave the characters as-is and don't convert Jamo to composed syllables... { clusterType = kHangulClusterTypeUnicode; pCharCluster[0] = mLineLayout.mCharArray[i]; clusterSize = 1; charCount = 1; } else { clusterSize = 0; clusterType = kHangulClusterTypeJamo; // This might change below. for(const Char* p = &mLineLayout.mCharArray[i], *pEnd = &mLineLayout.mCharArray[iCharEnd]; (p < pEnd) && (clusterSize < kMaxHangulCharClusterSize); ++p, ++charCount) { const Char c = *p; const bool bIsAnyHangul = (IsS(c) || IsJ(c) || IsTone(c)); if(clusterSize != 0) // If this is not the first char in the cluster... { const Char cPrev = p[-1]; // If the current character cannot combine with the previous character... // To consider: This should be a table lookup instead of a bunch of comparisons. if(!bIsAnyHangul || ( IsT(cPrev) && IsL(c)) || ( IsV(cPrev) && IsL(c)) || ( IsT(cPrev) && IsV(c)) || (!IsL(cPrev) && IsS(c)) || IsTone(cPrev)) { // We have a completed syllable. break; } } if(!bIsAnyHangul) // If not any kind of Hangul (syllable, jamo, tone)... { // We have non-Hangul Unicode (e.g. Latin or simply a space chars). pCharCluster[clusterSize++] = c; ++charCount; clusterType = kHangulClusterTypeUnicode; break; } else if(IsS(c)) // If the char is a Hangul syllable... { // We break the Hangul syllable down to its Jamo components. // We'll put them back together again in the next step of // the shaping pipeline. pCharCluster[clusterSize++] = GetL(c); pCharCluster[clusterSize++] = GetV(c); if(HasT(c)) pCharCluster[clusterSize++] = GetT(c); } else if((clusterSize == 0) && IsTone(c)) // If char is an initial Hangul tone... { // We have a standalone tone. pCharCluster[clusterSize++] = c; ++charCount; clusterType = kHangulClusterTypeTone; break; } else pCharCluster[clusterSize++] = c; // Else we are working with individual Jamo symbols... } } EA_ASSERT_MESSAGE(clusterType != kHangulClusterTypeNone, "Typesetter::GetHangulCharCluster: Unknown cluster type."); EA_ASSERT((charCount > 0) && (clusterSize > 0)); return charCount; }
GFXSphereVertexList::GFXSphereVertexList( float radius, int detail, bool Insideout, bool reverse_normals ) { this->radius = radius; radius = 100000.0f; static vector< GFXVertexList* >vlists[4]; int which = (Insideout ? 1 : 0)+(reverse_normals ? 2 : 0); while ( detail >= static_cast<int>(vlists[which].size()) ) vlists[which].insert( vlists[which].end(), 1+detail-vlists[which].size(), NULL ); if (vlists[which][detail] == 0) { int slices; int stacks = slices = detail; if (stacks > 12) { stacks -= 4; slices -= 4; } else { stacks -= 2; slices -= 2; } float rho_max = 3.1415926536f; float rho_min = 0.0f; float theta_min = 0.0f; float theta_max = 2.0f*3.1415926536f; float drho, dtheta; float x, y, z, tx, ty; float s, t, ds, dt; int i, j, imin, imax; float nsign = Insideout ? -1.0 : 1.0; float normalscale = reverse_normals ? -1.0 : 1.0; int fir = 0; //Insideout?1:0; int sec = 1; //Insideout?0:1; /* Code below adapted from gluSphere */ drho = (rho_max-rho_min)/(float) stacks; dtheta = (theta_max-theta_min)/(float) slices; ds = 1.0f/slices; dt = 1.0f/stacks; t = 1.0f; /* because loop now runs from 0 */ imin = 0; imax = stacks; int numQuadstrips = stacks; //numQuadstrips = 0; int *QSOffsets = new int[numQuadstrips]; //draw intermediate stacks as quad strips int numvertex = stacks*(slices+1)*2; GFXVertex *vertexlist = new GFXVertex[numvertex]; GFXVertex *vl = vertexlist; enum POLYTYPE *modes = new enum POLYTYPE[numQuadstrips]; /* SetOrientation(Vector(1,0,0), * Vector(0,0,-1), * Vector(0,1,0));//that's the way prop*/ //taken care of in loading float rhol[2]; float thetal[2]; #define g_rho( i ) ((rhol[((i))&1])) #define g_theta( i ) ((thetal[((i))&1])) g_rho( 0 ) = rho_min; for (i = imin; i < imax; i++) { GFXVertex *vertexlist = vl+(i*(slices+1)*2); g_rho( i+1 ) = (i+1)*drho+rho_min; //FIXME These macros are horrible s = 0.0; g_theta( 0 ) = 0; for (j = 0; j <= slices; j++) { g_theta( j+1 ) = (j+1)*dtheta; tx = -sin( g_theta( j ) ); ty = cos( g_theta( j ) ); z = sin( g_rho( i ) ); x = tx*z; y = ty*z; z = nsign*cos( g_rho( i ) ); //normal vertexlist[j*2+fir].i = x*normalscale; vertexlist[j*2+fir].k = -y*normalscale; vertexlist[j*2+fir].j = z*normalscale; //tangent vertexlist[j*2+fir].tx = -ty*normalscale; vertexlist[j*2+fir].tz = -tx*normalscale; vertexlist[j*2+fir].ty = 0; vertexlist[j*2+fir].tw = nsign*normalscale; #define GetS( theta, theta_min, theta_max ) ( 1-(theta-theta_min)/(theta_max-theta_min) ) #define GetT( rho, rho_min, rho_max ) ( 1-(rho-rho_min)/(rho_max-rho_min) ) //texcoords vertexlist[j*2+fir].s = GetS( g_theta( j ), theta_min, theta_max ); //1-s; vertexlist[j*2+fir].t = GetT( g_rho( i ), rho_min, rho_max ); //t; //position vertexlist[j*2+fir].x = x*radius; vertexlist[j*2+fir].z = -y*radius; vertexlist[j*2+fir].y = z*radius; z = sin( g_rho( i+1 ) ); x = tx*z; y = ty*z; z = nsign*cos( g_rho( i+1 ) ); //normal vertexlist[j*2+sec].i = x*normalscale; vertexlist[j*2+sec].k = -y*normalscale; vertexlist[j*2+sec].j = z*normalscale; //tangent vertexlist[j*2+sec].tx = -ty*normalscale; vertexlist[j*2+sec].tz = -tx*normalscale; vertexlist[j*2+sec].ty = 0; vertexlist[j*2+sec].tw = nsign*normalscale; //texcoords vertexlist[j*2+sec].s = GetS( g_theta( j ), theta_min, theta_max ); //1-s; vertexlist[j*2+sec].t = GetT( g_rho( i+1 ), rho_min, rho_max ); //t - dt; //position vertexlist[j*2+sec].x = x*radius; vertexlist[j*2+sec].z = -y*radius; vertexlist[j*2+sec].y = z*radius; s += ds; } t -= dt; QSOffsets[i] = (slices+1)*2; modes[i] = GFXQUADSTRIP; } #undef g_rho #undef g_theta vlists[which][detail] = new GFXVertexList( modes, numvertex, vertexlist, numQuadstrips, QSOffsets ); } sphere = vlists[which][detail]; numVertices = sphere->numVertices; numlists = sphere->numlists; data.vertices = sphere->data.vertices; index.i = sphere->index.i; display_list = sphere->display_list; vbo_data = sphere->vbo_data; mode = sphere->mode; offsets = sphere->offsets; }