Source code:
Http://code.msdn.microsoft.com/Babylon-3D-engine-f0404ace/sourcecode? Fileid = 21297 & pathid = 1744047981
Http://code.msdn.microsoft.com/Babylon-3D-engine-f0404ace
Development and debugging software environment:
Silverlight_cmd.exe (file version 5.0.64010.0), silverlight5_tools, Microsoft express blend preview for Silverlight, vs. Net 2010. The above software must be installed in English version.
Dxsdk_jun10.exe
Source code:
/Files/furenjun/babylon.rar
Introduction
This sample shows a full 3D Realtime Engine with some advanced features and an integrated collisions system.
Live sample: http://david.blob.core.windows.net/babylon/Babylon.html
Building the sample
You need to installShaderbuildtasksetup. MSIWhich is present in the folder Babylon/buildtask in order to compile shaders.
For vertex shaders, you must name the files *. vs. HLSL and set build action to vertexshader.
For pixel shaders, you must name the files *. PS. HLSL and set build action to pixelshader.
Update: Integration of the New Babylon. Toolkit: http://babylontoolkit.codeplex.com.
Update: New Version integrate the new effect class and the importer using nova (http://www.vertice.fr) for 3dsmax.
Description
The engine provides support:
- Collisions
- Diffuse Channel
- Ambient Channel
- Textures (including light maps)
- Per-pixel & per-vertex shader
- Models/cameras and lights
Sample of the drawing phase:
Copy code
C # Edit | Remove
Void Ondraw ( Object Sender, draweventargs e ){ If (Engine. device = Null ) {Engine. device = E. graphicsdevice;} engine. beginframe (E ); If (Scene! = Null & Scene. activecamera! = Null ) {Scene. Render (); Lock (Moves ){ Foreach (Movedirection move In Moves) {scene. controlmanager. checkkeyboard (move, E. deltatime. totalmilliseconds) ;}} engine. EndFrame ();}
The engine provides a user control to quickly integrate a rendering in yours projects:
Copy code
XAML Edit | Remove
<Babylon: Babylonsurface X:Name="Babylonsurface"/>
To use compiled shaders, Babylon use a class called effect. With this class, you can affect shader's variables by name: copy the code
C # Edit | Remove
VaR eff =NewEffect (engine. device,"Babylon","Engine/shaders/pervertex"); Eff. setconstant ("World", World); Eff. setconstant ("Levels",1. 0f,0. 5f,0,1. 3f); Eff. Apply ();
Effect. apply () affects vertex and pixel shaders to the device. the effect class is autonomous and can be used in your own application as long as you use shaderbuildtask to compile your shaders. you can also get an extension tparameter and use it to set values: copy the code
C # Edit | Remove
Effectparameter positionparameter = effect. getparameter ("Position"); Positionparameter. setvalue (NewVector3 (0,1,0));
To build an effect, you must provide the name of the Assembly where the shaders belong and the path of the shader in the project. Source code files
More information
For more information, please contact davca@microsoft.com or go to http://blogs.msdn.com/ B /eternalcoding