-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor color into separate class, breaks Codon (exaloop/codon#554)
- Loading branch information
Showing
8 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .ray import Ray | ||
from .vec3 import Color, Point3, Vec3 | ||
from .vec3 import Point3, Vec3 | ||
from .color import Color | ||
from .interval import Interval | ||
from .aabb import AABB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from .vec3 import Vec3 | ||
|
||
|
||
class Color(Vec3): | ||
r: float | ||
g: float | ||
b: float | ||
|
||
def __init__(self, r: float = 0, g: float = 0, b: float = 0): | ||
super().__init__(r, g, b) | ||
self.r = r | ||
self.g = g | ||
self.b = b | ||
|
||
@staticmethod | ||
def gray(intensity: float): | ||
return Color(intensity, intensity, intensity) | ||
|
||
|
||
black = Color(0, 0, 0) | ||
white = Color(1, 1, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,6 @@ def random_on_hemisphere(normal: Vec3): | |
|
||
|
||
Point3 = Vec3 | ||
Color = Vec3 | ||
|
||
|
||
if __name__ == "__main__": | ||
|