Changeset 451 for trunk/src/engine


Ignore:
Timestamp:
07/30/15 19:47:02 (10 years ago)
Author:
epyon
Message:
  • math library started
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/engine/particle_engine.cc

    r439 r451  
    231231        datap->plane_normal = normalize_safe( datap->plane_normal, vec3(0.0f,1.0f,0.0f) );
    232232        datap->bounce       = table->get<float>("bounce", 0.0f );
    233         datap->distance     = -glm::dot( datap->plane_normal, datap->plane_point ) / glm::sqrt(glm::dot( datap->plane_normal, datap->plane_normal ) );
     233        datap->distance     = -glm::dot( datap->plane_normal, datap->plane_point ) / math::sqrt(glm::dot( datap->plane_normal, datap->plane_normal ) );
    234234        return true;
    235235}
     
    411411                                edata.dir          = glm::normalize( element.get<vec3>("direction", vec3(0,1,0) ) );
    412412                               
    413                                 edata.odir = glm::vec3( 0, 0, 1 );
     413                                edata.odir = vec3( 0, 0, 1 );
    414414                                if ( edata.dir != vec3( 0, 1, 0 ) && edata.dir != vec3( 0, -1, 0 ) )
    415415                                        edata.odir = glm::normalize( glm::cross( edata.dir, vec3( 0, 1, 0 ) ) );                edata.cdir = glm::cross( edata.dir, edata.odir );
     
    750750                                        {
    751751                                                float emission_angle = glm::radians( edata.angle );
    752                                                 float cos_theta = r.frange( glm::cos( emission_angle ), 1.0f );
    753                                                 float sin_theta = glm::sqrt(1.0f - cos_theta * cos_theta );
    754                                                 float phi       = r.frange( 0.0f, 2*glm::pi<float>() );
     752                                                float cos_theta = r.frange( math::cos( emission_angle ), 1.0f );
     753                                                float sin_theta = math::sqrt(1.0f - cos_theta * cos_theta );
     754                                                float phi       = r.frange( 0.0f, 2* math::pi<float>() );
    755755                                                pinfo.velocity  = orient *
    756                                                         ( edata.odir * ( glm::cos(phi) * sin_theta ) +
    757                                                         edata.cdir * ( glm::sin(phi)*sin_theta ) +
     756                                                        ( edata.odir * ( math::cos(phi) * sin_theta ) +
     757                                                        edata.cdir * ( math::sin(phi)*sin_theta ) +
    758758                                                        edata.dir  * cos_theta );
    759759                                        }
Note: See TracChangeset for help on using the changeset viewer.