コード例 #1
0
    public void RenderHierarchy(GraphObjects obj)
    {
        //object renders itself
        obj.Render();

        foreach (GraphObjects child in obj.children)
        {
            //render every child
            RenderHierarchy(child);
        }
    }
コード例 #2
0
    public List <GraphObjects> children; //every graphobject keeps a lsit of its children

    public GraphObjects(Matrix4 transform, Matrix4 toWorld, GraphObjects parent)
    {
        children      = new List <GraphObjects>();
        mainTransform = transform;
        this.toWorld  = toWorld;

        if (parent != null)
        {
            this.parent = parent;
            parent.children.Add(this);
        }
        this.transform = transform;
    }
コード例 #3
0
ファイル: SceneObject.cs プロジェクト: AbelvanBeek/rasterizer
 public SceneObject(Mesh mesh, Shader shader, float specness, Texture texture, Matrix4 transform, Matrix4 toWorld, GraphObjects parent) : base(transform, toWorld, parent)
 {
     this.mesh     = mesh;
     this.shader   = shader;
     this.texture  = texture;
     this.specness = specness;
 }
コード例 #4
0
ファイル: Light.cs プロジェクト: AbelvanBeek/rasterizer
    public Light(int id, Vector3 position, Vector3 intensity, Shader shader, Matrix4 transform, Matrix4 toWorld, GraphObjects parent) : base(transform, toWorld, parent)
    {
        //we actually don't use the matrices because we have a static position right now.

        this.id        = id;
        this.position  = position;
        this.intensity = intensity;
        this.shader    = shader;

        // light adds its position to the shader
        lightLocationID = GL.GetUniformLocation(shader.programID, "lightPos" + id);
        GL.UseProgram(shader.programID);
        GL.Uniform3(lightLocationID, position);

        // light adds its Color/intensity to the shader
        int lightColorID = GL.GetUniformLocation(shader.programID, "lightColor" + id);

        GL.UseProgram(shader.programID);
        GL.Uniform3(lightColorID, intensity);
    }