bool PointStarVlist::BeginDrawState (const QVector ¢er, const Vector & velocity, const Vector & torque, bool roll, bool yawpitch, int whichTexture) { UpdateGraphics(); static bool StarStreaks=XMLSupport::parse_bool(vs_config->getVariable("graphics","star_streaks","false")); GFXColorMaterial(AMBIENT|DIFFUSE); bool ret=false; if (StarStreaks) { Matrix rollMatrix; static float velstreakscale= XMLSupport::parse_float (vs_config->getVariable ("graphics","velocity_star_streak_scale","5")); static float minstreak= XMLSupport::parse_float (vs_config->getVariable ("graphics","velocity_star_streak_min","1")); static float fov_smoothing=XMLSupport::parse_float(vs_config->getVariable("graphics","warp.fovlink.smoothing",".4")); float fov_smoot = pow(double(fov_smoothing),GetElapsedTime()); Vector vel (-velocity*velstreakscale); float speed = vel.Magnitude(); if ((smoothstreak>=minstreak||vel.MagnitudeSquared()>=minstreak*minstreak)&&(speed>1.0e-7)) { ret=true; vel*=1./speed; speed = fov_smoot*speed + (1-fov_smoot)*smoothstreak; if (speed<minstreak) speed=minstreak; static float streakcap = XMLSupport::parse_float (vs_config->getVariable ("graphics","velocity_star_streak_max","100")); if (speed>streakcap) { speed=streakcap; } vel=vel*speed; smoothstreak=speed; GFXColorVertex * v = vlist->BeginMutate(0)->colors; int numvertices = vlist->GetNumVertices(); static float torquestreakscale= XMLSupport::parse_float (vs_config->getVariable ("graphics","torque_star_streak_scale","1")); for (int j=0; j<numvertices-1; j+=2) { int i=j; // if (SlowStarStreaks) // i=((rand()%numvertices)/2)*2; Vector vpoint (v[i+1].x,v[i+1].y,v[i+1].z); Vector recenter =(vpoint-center.Cast()); if (roll) { RotateAxisAngle(rollMatrix,torque,torque.Magnitude()*torquestreakscale*.003); vpoint = Transform(rollMatrix,recenter)+center.Cast(); } v[i].x=vpoint.i-vel.i; v[i].y=vpoint.j-vel.j; v[i].z=vpoint.k-vel.k; // static float NumSlowStarStreaks=XMLSupport::parse_float(vs_config->getVariable("graphics","num_star_streaks",".05")); // if (SlowStarStreaks&&j<NumSlowStarStreaks*numvertices) // break; } vlist->EndMutate(); } } if (ret) { vlist->LoadDrawState(); vlist->BeginDrawState(); } else { nonstretchvlist->LoadDrawState(); nonstretchvlist->BeginDrawState(); } return ret; }
ibMtx4 ibMtx4::RotateAxisAngle( ibVec4 axis, const f32 angle ) { return RotateAxisAngle(ibVec3(axis.x, axis.y, axis.z), angle); }
float3x4 float3x4::RotateAxisAngle(const float3 &axisDirection, float angleRadians, const float3 &pointOnAxis) { return float3x4::Translate(pointOnAxis) * RotateAxisAngle(axisDirection, angleRadians) * float3x4::Translate(-pointOnAxis); }