Skip to content

ratnajagadeesharava/computer-graphics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

physically-based-rendering

All common type aliases are defined in src/util/types.rs and re-exported through src/util/mod.rs.

Available Types

Float

  • Definition: pub type Float = f32;
  • Usage: The primary floating-point type used for all mathematical computations throughout the project
  • Import: use crate::util::Float;

Int

  • Definition: pub type Int = i32;
  • Usage: Integer type for indexing and counts
  • Import: use crate::util::Int;

How to Use

Simply import the type from crate::util:

use crate::util::Float;

fn my_function(x: Float) -> Float {
    x * 2.0
}

Future Considerations

If you need to switch to double precision (f64), simply change the definition in src/util/types.rs:

pub type Float = f64;

All code using Float will automatically use the new precision.

About

implementation of PBRT book in rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •