-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f35e32e
commit 8b63f25
Showing
2 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
articles/getting_to_know/howto/graphics/files/basiceffectlighting.cs
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,31 @@ | ||
basicEffect.LightingEnabled = true; | ||
if (basicEffect.LightingEnabled) | ||
{ | ||
basicEffect.DirectionalLight0.Enabled = true; // enable each light individually | ||
if (basicEffect.DirectionalLight0.Enabled) | ||
{ | ||
// x direction | ||
basicEffect.DirectionalLight0.DiffuseColor = new Vector3(1, 0, 0); // range is 0 to 1 | ||
basicEffect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(-1, 0, 0)); | ||
// points from the light to the origin of the scene | ||
basicEffect.DirectionalLight0.SpecularColor = Vector3.One; | ||
} | ||
|
||
basicEffect.DirectionalLight1.Enabled = true; | ||
if (basicEffect.DirectionalLight1.Enabled) | ||
{ | ||
// y direction | ||
basicEffect.DirectionalLight1.DiffuseColor = new Vector3(0, 0.75f, 0); | ||
basicEffect.DirectionalLight1.Direction = Vector3.Normalize(new Vector3(0, -1, 0)); | ||
basicEffect.DirectionalLight1.SpecularColor = Vector3.One; | ||
} | ||
|
||
basicEffect.DirectionalLight2.Enabled = true; | ||
if (basicEffect.DirectionalLight2.Enabled) | ||
{ | ||
// z direction | ||
basicEffect.DirectionalLight2.DiffuseColor = new Vector3(0, 0, 0.5f); | ||
basicEffect.DirectionalLight2.Direction = Vector3.Normalize(new Vector3(0, 0, -1)); | ||
basicEffect.DirectionalLight2.SpecularColor = Vector3.One; | ||
} | ||
} |
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