public void LoadGraph(string file) { FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read); BinaryReader r = new BinaryReader(fs); Help.IOHelp.r = r; int cc = r.ReadInt32(); for (int i = 0; i < cc; i++) { Cam3D nc = new Cam3D(); nc.Read( ); Cams.Add(nc); } int lc = r.ReadInt32(); for (int i = 0; i < lc; i++) { Light3D nl = new FusionEngine.Lighting.Light3D(); nl.Read( ); Lights.Add(nl); } Entity3D re = new Entity3D(); Root = re; re.Read( ); fs.Close( ); }
public override void Present(Cam3D c) { // GL.MatrixMode(MatrixMode.Projection); GL.LoadMatrix(ref c.ProjMat); SetMats(c); Bind( ); PreRender( ); Render( ); PostRender( ); Release( ); // foreach (var s in Sub) { s.Present(c); } }
public virtual void RenderNodeDepth(Node3D node, Cam3D c) { if (node.CastDepth) { node.PresentDepth(c); } foreach (Node3D snode in node.Sub) { RenderNodeDepth(snode, c); } }
public override void PresentDepth(Cam3D c) { SetMats(c); Bind( ); PreRender( ); RenderDepth( ); PostRender( ); Release( ); foreach (Node3D s in Sub) { s.PresentDepth(c); } }
public void SetMats(Cam3D c) { Effect.FXG.Proj = c.ProjMat; Effect.FXG.Cam = c; // GL.MatrixMode(MatrixMode.Modelview); Matrix4 mm = Matrix4.Identity; // mm = c.CamWorld; //mm = mm * Matrix4.Invert(Matrix4.CreateTranslation(c.WorldPos)); mm = World; //var wp = LocalPos; //mm = mm*Matrix4.CreateTranslation(wp); //GL.LoadMatrix(ref mm); Effect.FXG.Local = mm; Effect.FXG.PrevLocal = PrevWorld; }
public virtual void Add(Cam3D c) { Cams.Add(c); }