public bool DrawgroupMatch(ModelInstance other) { return( ((DrawGroup1 & other.DrawGroup1) != 0) || ((DrawGroup2 & other.DrawGroup2) != 0) || ((DrawGroup3 & other.DrawGroup3) != 0) || ((DrawGroup4 & other.DrawGroup4) != 0) ); }
public void AddNewInstance(ModelInstance ins) { Instances.Add(ins); if (InstanceBuffer != null) { InstanceBuffer.Dispose(); } InstanceBuffer = new VertexBuffer(GFX.Device, instanceVertexDeclaration, Instances.Count, BufferUsage.WriteOnly); InstanceBuffer.SetData(Instances.Select(x => x.Data).ToArray()); InstanceBufferBinding = new VertexBufferBinding(InstanceBuffer, 0, 1); }
public void DrawSelected() { lock (_lock_ModelLoad_Draw) { if (Selected != null && (HighlightSelectedPiece || WireframeSelectedPiece)) { if (Selected.ModelReference == null) { Selected = null; return; } //GFX.World.ApplyViewToShader(GFX.DbgPrimShader, Selected.Transform); var lod = GFX.World.GetLOD(Selected.Transform); var oldWireframeSetting = GFX.Wireframe; var effect = ((BasicEffect)GFX.DbgPrimWireShader.Effect); if (HighlightSelectedPiece) { throw new NotImplementedException(); //GFX.Wireframe = false; //effect.VertexColorEnabled = true; //foreach (var submesh in Selected.ModelReference.Submeshes) // submesh.Draw(lod, GFX.DbgPrimShader, forceNoBackfaceCulling: true); } if (WireframeSelectedPiece) { throw new NotImplementedException(); //GFX.Wireframe = true; //effect.VertexColorEnabled = false; //foreach (var submesh in Selected.ModelReference.Submeshes) // submesh.Draw(lod, GFX.DbgPrimShader, forceNoBackfaceCulling: true); //GFX.Wireframe = oldWireframeSetting; } effect.VertexColorEnabled = true; } } }
public void AddModelInstance(Model model, string name, Transform location) { lock (_lock_ModelLoad_Draw) { if (!Models.Contains(model)) { Models.Add(model); } var instance = new ModelInstance(name, model, location, -1, -1, -1, -1); if (LightmapAtlasMap.ContainsKey(name)) { instance.Data.atlasScale = new Vector2(LightmapAtlasMap[name].X, LightmapAtlasMap[name].Y); instance.Data.atlasOffset = new Vector2(LightmapAtlasMap[name].Z, LightmapAtlasMap[name].W); } model.AddNewInstance(instance); } }