A Primitive is an arbitrary object which can be part of a scene and rendered by the ray tracer.
Any concrete implementation of a Primitive needs to implement the intersect method, which tests for ray/primitive intersection. A primitive can be any geometric shape, mathematical function, etc.
Every primitive has an unique ID, and a shader. When creating your own primitive, don't forget to call the super() contructor to auto- matically generate the id.
- Implemented by
Constructors
- Primitive([Shader _shader])
-
Creates a new Primitive and assigns an unique id to it. The optional parameter
shadercan be used to set a shader for this primitive. If no shader is assigned, a default AmbientShader will be created.
Properties
- color → Vector4
-
The primary color of the primitive as vector4 (only used for GUI).
read-only - colorString → String
-
The primary color of the primitive as CSS rgba string (only used for GUI).
read-only - hashCode → int
-
Get a hash code for this object.…
read-only, inherited - id → int
-
Unique id of the primitive.
read-only - origin → Point3
-
The origin of the primitive (only used for GUI).
read-only - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.…
inherited
Methods
-
getShader(
Intersection intersect) → Shader -
Returns the shader for a given intersection point.
-
intersect(
Ray ray, num previousBestDistance) → Intersection -
Performs a ray - primitive intersection test. Returns an Intersection object with the associated information.…
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.…
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited