private SceneObject GetCatesianGridObj(CatesianGrid grid, List <GridBlockProperty> gridProperties, string fileName) { CatesianGridRenderer renderer = CatesianGridRenderer.Create( -grid.DataSource.Position, grid, this.scientificCanvas.ColorPalette.Sampler); //string caseFileName = System.IO.Path.GetFileName(fileName); renderer.WorldPosition = -grid.DataSource.Position; renderer.Initialize(); SceneObject gridObj = renderer.WrapToSceneObject( new ModelScaleScript(), new DumpCatesianGridTreeNodeScript()); { BoundingBoxRenderer boxRenderer = renderer.GetBoundingBoxRenderer(); SceneObject boxObj = boxRenderer.WrapToSceneObject( new ModelScaleScript()); gridObj.Children.Add(boxObj); } foreach (GridBlockProperty gbp in gridProperties) { var script = new ScientificModelScript(gridObj, gbp, this.scientificCanvas.ColorPalette); gridObj.Scripts.Add(script); } return(gridObj); }
public static CatesianGridRenderer Create(vec3 originalWorldPosition, CatesianGrid grid, Texture codedColorSampler) { var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\HexahedronGrid.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\HexahedronGrid.frag"), ShaderType.FragmentShader); var map = new AttributeMap(); map.Add("in_Position", CatesianGrid.strPosition); map.Add("in_uv", CatesianGrid.strColor); var renderer = new CatesianGridRenderer(originalWorldPosition, grid, shaderCodes, map, codedColorSampler); renderer.ModelSize = (grid.DataSource.SourceActiveBounds.MaxPosition - grid.DataSource.SourceActiveBounds.MinPosition).Abs(); renderer.WorldPosition = -grid.DataSource.Position; return renderer; }
public static CatesianGridRenderer Create(vec3 originalWorldPosition, CatesianGrid grid, Texture codedColorSampler) { var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\HexahedronGrid.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\HexahedronGrid.frag"), ShaderType.FragmentShader); var map = new AttributeMap(); map.Add("in_Position", CatesianGrid.strPosition); map.Add("in_uv", CatesianGrid.strColor); var renderer = new CatesianGridRenderer(originalWorldPosition, grid, shaderCodes, map, codedColorSampler); renderer.ModelSize = (grid.DataSource.SourceActiveBounds.MaxPosition - grid.DataSource.SourceActiveBounds.MinPosition).Abs(); renderer.WorldPosition = -grid.DataSource.Position; return(renderer); }
public static CatesianGridRenderer Create(vec3 originalWorldPosition, CatesianGrid grid, Texture codedColorSampler) { var shaderCodes = new ShaderCode[2]; shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\HexahedronGrid.vert"), ShaderType.VertexShader); shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\HexahedronGrid.frag"), ShaderType.FragmentShader); var map = new PropertyNameMap(); map.Add("in_Position", CatesianGrid.strPosition); map.Add("in_uv", CatesianGrid.strColor); var renderer = new CatesianGridRenderer(originalWorldPosition, grid, shaderCodes, map, codedColorSampler); renderer.lengths = grid.DataSource.SourceActiveBounds.Max - grid.DataSource.SourceActiveBounds.Min; renderer.ModelMatrix = glm.translate(mat4.identity(), -grid.DataSource.Position); return(renderer); }