コード例 #1
0
ファイル: MPWorld.cs プロジェクト: vr3d/Unity5Effects
    void UpdateKernelParams()
    {
        m_texture_needs_update = true;

        m_particle_num = MPAPI.mpGetNumParticles(GetContext());

        MPKernelParams p = MPAPI.mpGetKernelParams(GetContext());

        p.world_center         = transform.position;
        p.world_size           = transform.localScale;
        p.world_div_x          = m_world_div_x;
        p.world_div_y          = m_world_div_y;
        p.world_div_z          = m_world_div_z;
        p.active_region_center = transform.position + m_active_region_center;
        p.active_region_extent = m_active_region_extent;
        p.solver_type          = (int)m_solver;
        p.enable_interaction   = m_enable_interaction ? 1 : 0;
        p.enable_colliders     = m_enable_colliders ? 1 : 0;
        p.enable_forces        = m_enable_forces ? 1 : 0;
        p.id_as_float          = m_id_as_float ? 1 : 0;
        p.timestep             = Time.deltaTime * m_timescale;
        p.damping            = m_damping;
        p.advection          = m_advection;
        p.pressure_stiffness = m_pressure_stiffness;
        p.scaler             = m_coord_scale;
        p.particle_size      = m_particle_size;
        p.max_particles      = m_max_particle_num;
        MPAPI.mpSetKernelParams(GetContext(), ref p);
    }
コード例 #2
0
    void UpdateKernelParams()
    {
        MPKernelParams p = MPAPI.mpGetKernelParams();

        p.WorldCenter        = transform.position;
        p.WorldSize          = transform.localScale;
        p.WorldDiv_x         = divX;
        p.WorldDiv_y         = divY;
        p.WorldDiv_z         = divZ;
        p.enableInteractions = enableInteractions ? 1 : 0;
        p.enableColliders    = enableColliders ? 1 : 0;
        p.enableForces       = enableForces ? 1 : 0;
        p.SolverType         = (int)solverType;
        p.LifeTime           = particleLifeTime;
        p.Timestep           = Time.deltaTime * timeScale;
        p.Decelerate         = deceleration;
        p.PressureStiffness  = pressureStiffness;
        p.WallStiffness      = wallStiffness;
        p.Scaler             = coordScale;
        p.ParticleSize       = particleSize;
        p.MaxParticles       = maxParticleNum;
        MPAPI.mpSetKernelParams(ref p);
    }