Skip to content
This repository was archived by the owner on Apr 28, 2021. It is now read-only.
This repository was archived by the owner on Apr 28, 2021. It is now read-only.

setting one RenderObject not visible halts animation of another #235

@goretkin

Description

@goretkin

This doesn't happen if both shapes are transformed by the same signal.

glvisualize_visibility

using GeometryTypes
using GLVisualize, GLAbstraction, Reactive, GLWindow, GLFW, Colors

using StaticArrays

width = 100.0

# vertices need to be GeometryTypes.Vec{2,T}}
function polygon_mesh(vertices, z=0)
  # mesh with fixed z
  fs = polygon2faces(map(Point, vertices))
  vs = map(x->Point{3}(x[1],x[2],z), vertices)
  return GLNormalMesh(vertices=vs, faces=fs)
end

function plot(ro, model_matrix=eye(SMatrix{4,4}), color=RGBA(1.0, 1.0, 1.0, 1.0))
  vis = visualize(ro, model=model_matrix, color=color)
  _view(vis, window, camera = :orthographic_pixel)
  return vis
end

cone_points = [Vec(0.0, 0.0), Vec(3*width, 2*width), Vec(3*width, -2*width)]

box_points = width/2 * [[-1, -1], [-1, 1],  [1, 1], [1, -1]]
box_points = [Vec(p...) for p in box_points]

window = glscreen()
window.color = RGBA(0.04f0, 0.02f0, 0.05f0, 1f0)

timesignal = loop(linspace(0f0,1f0,360), 60)
rotation_angle  = const_lift(*, timesignal, 2f0*pi)

txgl__world__box = Signal(eye(SMatrix{4,4,Float32})) # tx__world__robot
foreach(x->push!(txgl__world__box, rotationmatrix_z(x)), rotation_angle)

txgl__box__cone = Signal(translationmatrix(Vec(width/3, 0, 0)))
txgl__world__cone = map(*, txgl__world__box, txgl__box__cone)

box_viz = plot(polygon_mesh(box_points), txgl__world__box, RGBA(0.0f0,0.5f0, 0.5f0, 0.7f0))
cone_viz = plot(polygon_mesh(cone_points), txgl__world__cone, RGBA(0.7f0, 0.7f0, 0.0f0, 0.3f0))

@async renderloop(window)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions