Renderer of PointCloud
Inheritance: CSharpGL.Renderer
コード例 #1
0
 // you can replace PointCloudModel with IBufferable in the method's parameter.
 public static RandomPointsRenderer Create(RandomPointsModel model)
 {
     var shaderCodes = new ShaderCode[2];
     shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\RandomPoints.vert"), ShaderType.VertexShader);
     shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\RandomPoints.frag"), ShaderType.FragmentShader);
     var map = new CSharpGL.AttributeMap();
     map.Add("in_Position", RandomPointsModel.position);
     var renderer = new RandomPointsRenderer(model, shaderCodes, map);
     renderer.ModelSize = model.Lengths;
     //renderer.stateList.Add(new PointSizeState(10));
     return renderer;
 }
コード例 #2
0
        // you can replace PointCloudModel with IBufferable in the method's parameter.
        public static RandomPointsRenderer Create(RandomPointsModel model)
        {
            var shaderCodes = new ShaderCode[2];

            shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\RandomPoints.vert"), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\RandomPoints.frag"), ShaderType.FragmentShader);
            var map = new CSharpGL.AttributeMap();

            map.Add("in_Position", RandomPointsModel.position);
            var renderer = new RandomPointsRenderer(model, shaderCodes, map);

            renderer.Lengths = model.Lengths;
            //renderer.switchList.Add(new PointSizeSwitch(10));
            return(renderer);
        }
コード例 #3
0
        public static ConditionalRenderer Create()
        {
            var result = new ConditionalRenderer();

            {
                var wallRenderer = SimpleRenderer.Create(new Cube(new vec3(unitLengths.x * 2, unitLengths.y * 2, 0.1f) * new vec3(xside, yside, zside)));
                wallRenderer.WorldPosition = new vec3(0, 0, 6);
                var boxRenderer = SimpleRenderer.Create(new Cube(new vec3(unitLengths.x * 2, unitLengths.y * 2, 0.1f) * new vec3(xside, yside, zside)));
                boxRenderer.WorldPosition = new vec3(0, 0, 6);
                var query = new Query();
                result.coupleList.Add(new Tuple <SimpleRenderer, RendererBase, Query>(boxRenderer, wallRenderer, query));
            }
            for (int x = 0; x < xside; x++)
            {
                for (int y = 0; y < yside; y++)
                {
                    for (int z = 0; z < zside; z++)
                    {
                        var model = new RandomPointsModel(unitLengths, pointCount);
                        RandomPointsRenderer renderer = RandomPointsRenderer.Create(model);
                        renderer.PointColor = Color.FromArgb(
                            (int)((float)(x + 1) / (float)xside * 255),
                            (int)((float)(y + 1) / (float)yside * 255),
                            (int)((float)(z + 1) / (float)zside * 255));
                        renderer.WorldPosition =
                            (new vec3(x, y, z) * unitLengths * scaleFactor)
                            - (new vec3(xside - 1, yside - 1, zside - 1) * unitLengths * scaleFactor * 0.5f);
                        var cubeRenderer = SimpleRenderer.Create(new Cube(unitLengths));
                        cubeRenderer.WorldPosition = renderer.WorldPosition;
                        var query = new Query();
                        result.coupleList.Add(new Tuple <SimpleRenderer, RendererBase, Query>(cubeRenderer, renderer, query));
                    }
                }
            }

            result.ModelSize = new vec3(xside + 1, yside + 1, zside + 1) * unitLengths * scaleFactor;

            return(result);
        }