-
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.
Added support for wireframe-only and wireframe-overlay drawing modes …
…to both SpinningLights and Viewer.
- Loading branch information
1 parent
653d270
commit 474777f
Showing
4 changed files
with
115 additions
and
16 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
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,24 @@ | ||
module d4.scene.WireframeMaterial; | ||
|
||
import d4.renderer.IMaterial; | ||
import d4.renderer.IRasterizer; | ||
import d4.renderer.Renderer; | ||
import d4.renderer.WireframeRasterizer; | ||
import d4.shader.SingleColorShader; | ||
|
||
/** | ||
* A simple material for rendering a white unlit wireframe model. | ||
*/ | ||
class WireframeMaterial : IMaterial { | ||
IRasterizer getRasterizer() { | ||
return new WireframeRasterizer!( SingleColorShader )(); | ||
} | ||
|
||
void prepareForRendering( Renderer renderer ) { | ||
// Nothing to do – we just need our rasterizer activated. | ||
} | ||
|
||
bool usesTextures() { | ||
return false; | ||
} | ||
} |
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,18 @@ | ||
module util.EnumUtils; | ||
|
||
/** | ||
* Advances the passed enumeration value by the given number of steps, wrapping | ||
* around if the limit has been reached. | ||
* | ||
* Of course, this requires the enumeration items to be numbered continuously. | ||
* | ||
* Params: | ||
* value = The start value. | ||
* offset = The number of steps to advance the value. Negative values also | ||
* work like expected. | ||
* Returns: | ||
* The advanced value. | ||
*/ | ||
T step( T )( T value, int offset ) { | ||
return cast( T )( ( value + offset ) % ( value.max + 1 ) ); | ||
} |