internal PlayerEffectSpaceSceneGraph(PlayerHandSceneGraph parent, PlayerEffectSpaceModel model) : base() { m_parent = parent; m_model = model; RootNode = new GroupNode(parent.RootNode, Transform.Identity, "EffectSpace"); // TODO: this should really use the starting drag location as its translation, and the rest of this too RootNode.LocalTransform = Transform.Identity; // We preallocate our big circle. m_boundingCircleNode = new SpriteNode(RootNode, "bounding circle", parent.Content.HollowCircle); m_boundingCircleNode.LocalTransform = new Transform( Vector2.Zero, new Vector2(MagicNumbers.EffectSpaceBoundingCircleMultiple * (1 / MagicNumbers.EffectSpaceBoundingCircleSize))); m_boundingCircleNode.Color = new Color(0, 0, 0, 0); m_boundingCircleNode.Origin = new Vector2(0.5f); m_boundingCircleNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored); m_effectKnobLineNode = new LineNode(RootNode, "effect line"); m_effectKnobLineNode.Color = new Color(0, 0, 0, 0); m_effectKnobLineNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored); m_effectKnobNode = new SpriteNode(RootNode, "effect knob", parent.Content.FilledCircle); m_effectKnobNode.Origin = new Vector2(0.5f); m_effectKnobNode.LocalTransform = new Transform(Vector2.Zero, new Vector2(MagicNumbers.EffectSpaceKnobMultiple)); m_effectKnobNode.Color = new Color(0, 0, 0, 0); m_effectKnobNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored); }
internal PlayerSceneGraph(HolofunkSceneGraph parent, int playerIndex, int channel) : base() { m_parent = parent; m_playerIndex = playerIndex; m_channel = channel; m_averageLevelRatio = new FloatAverager(15); // don't flicker face changes too fast m_averageLevelRatio.Update(0); // make sure it's initially zero // Center the textures. Vector2 origin = new Vector2(0.5f); RootNode = new GroupNode(parent.RootNode, Transform.Identity, "Player #" + playerIndex); m_headGroup = new GroupNode(RootNode, Transform.Identity, "Head group"); m_headNode = new SpriteNode( m_headGroup, "Head", PlayerIndex == 0 ? parent.Content.HollowOneOval : parent.Content.HollowTwoOval); m_headNode.Origin = new Vector2(0.5f, 0.5f); // semi-transparent heads, hopefully this will make them seem "less interactive" m_headNode.Color = new Color(0.7f, 0.7f, 0.7f, 0.7f); m_headNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored | SecondaryViewOption.SecondTexture); m_headNode.SecondaryTexture = parent.Content.Dot; // Make a faded mike signal that sticks to the head. m_headMikeSignal = new TrackNode( m_headGroup, new Transform(Vector2.Zero, new Vector2(MagicNumbers.LoopieScale)), "MikeSignal", parent.Content, -1, null, true, () => Audio.LevelRatio(Channel), () => new Color(63, 0, 0, 63), () => Color.White, () => 0, () => 0, () => new Color(127, 0, 0, 127), () => 1f); m_leftHandSceneGraph = new PlayerHandSceneGraph(this, false); m_rightHandSceneGraph = new PlayerHandSceneGraph(this, true); }
internal HolofunkSceneGraph( GraphicsDevice graphicsDevice, Vector2 canvasSize, Texture2D depthTexture, HolofunkTextureContent holofunkContent, HolofunkBass audio, Clock clock) : base() { m_content = holofunkContent; m_clock = clock; RootNode = new GroupNode(null, Transform.Identity, "Root"); m_canvasSize = canvasSize; m_background = new SpriteNode( RootNode, "Background", TextureFactory.ShadedCornerColor( graphicsDevice, canvasSize, Color.Black, new Color(0x10, 0x10, 0x10, 0x10), new Color(0x20, 0x20, 0x20, 0x20), new Color(0x20, 0x20, 0x20, 0x20))); m_background.LocalTransform = Transform.Identity; m_slide = new SpriteNode( RootNode, "Slide", Content.Slides[0]); m_slide.LocalTransform = new Transform(new Vector2(canvasSize.X - (int)(Content.Slides[0].Width * 1.1f), (canvasSize.Y - (int)Content.Slides[0].Height) / 2)); m_slide.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored | SecondaryViewOption.TextureMirrored); // constructing the nodes adds them as children of the parent, in first-at-bottom Z order. SpriteNode depthNode = new SpriteNode( RootNode, "DepthImage", depthTexture); depthNode.LocalTransform = new Transform( Vector2.Zero, new Vector2((float)canvasSize.X / depthTexture.Width, (float)canvasSize.Y / depthTexture.Height)); // we want the depth node texture (only) to be mirrored about the center of the viewport depthNode.SetSecondaryViewOption(SecondaryViewOption.TextureMirrored); // B4CR: should this also be | PositionMirrored? m_audio = audio; // Center the textures. Vector2 origin = new Vector2(0.5f); m_statusText = new TextNode(RootNode, "StatusText"); m_statusText.SetSecondaryViewOption(SecondaryViewOption.Hidden); m_statusText.LocalTransform = new Transform(new Vector2(30f, 20f), new Vector2(MagicNumbers.StatusTextScale)); // make sure that first update pushes status text m_frameCount = MagicNumbers.StatusTextUpdateInterval - 1; m_beatNode = new BeatNode( RootNode, new Transform(new Vector2(m_canvasSize.X / 2, m_canvasSize.Y / 8 * 7)), "Root Beater", false, MagicNumbers.MeasureCircleScale, () => (long)((float)clock.ContinuousBeatDuration * 4), () => 0, () => Color.White); m_trackGroupNode = new GroupNode(RootNode, Transform.Identity, "Track group"); }
internal TrackNode( AParentSceneNode parent, Transform transform, string label, TextureContent content, int id, SparseSampleByteStream videoStream, bool fillInEveryBeat, Func<float> levelRatioFunc, Func<Color> circleColorFunc, Func<Color> videoColorFunc, Func<Duration<Sample>> trackDurationFunc, Func<int> initialBeatFunc, Func<Color> beatColorFunc, Func<float> videoRateFunc) : base(parent, transform, label) { m_id = id; m_levelRatioFunc = levelRatioFunc; m_circleColorFunc = circleColorFunc; m_videoColorFunc = videoColorFunc; m_beatColorFunc = beatColorFunc; m_videoRateFunc = videoRateFunc; // create this first so it is Z-ordered behind m_soundNode m_selectNode = new SpriteNode(this, "TrackHighlight", content.FilledCircle); m_selectNode.Color = new Color((byte)0x80, (byte)0x80, (byte)0x80, (byte)0x80); m_selectNode.Origin = new Vector2(0.5f); m_soundNode = new SpriteNode(this, "TrackSound", content.FilledCircle); m_soundNode.Color = Color.Blue; m_soundNode.Origin = new Vector2(0.5f); m_videoNode = new SpriteNode(this, "Headshot", content.NewDynamicTexture(MagicNumbers.HeadCaptureSize, MagicNumbers.HeadCaptureSize)); m_videoNode.Origin = new Vector2(0.5f); m_videoNode.LocalTransform = new Transform(new Vector2(0), new Vector2(MagicNumbers.HeadRatio)); m_videoNode.SetSecondaryViewOption(SecondaryViewOption.TextureMirrored); m_videoStream = videoStream; m_beatNode = new BeatNode( this, // move it down a bit from the sprite node new Transform(new Vector2(0, 75)), "TrackBeats", fillInEveryBeat, MagicNumbers.MeasureCircleScale, trackDurationFunc, initialBeatFunc, beatColorFunc); m_beatNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored); // we always mirror track node position SetSecondaryViewOption(SecondaryViewOption.PositionMirrored); m_lastVideoFrame = default(Slice<Frame, byte>); }
public PlayerHandSceneGraph(PlayerSceneGraph parent, bool isRight) { m_parent = parent; m_isRight = isRight; RootNode = new GroupNode(parent.RootNode, Transform.Identity, isRight ? "Left Hand" : "Right Hand"); m_handGroup = new GroupNode(RootNode, Transform.Identity, isRight ? "Right Group" : "Left Group"); m_handMikeSignal = new TrackNode( m_handGroup, new Transform(Vector2.Zero, new Vector2(MagicNumbers.LoopieScale)), "MikeSignal", parent.Content, -1, null, true, () => parent.Audio.LevelRatio(parent.Channel) * 0.5f, () => m_handMikeSignalColor, () => Color.White, // TODO: revive beat meter on current recording () => new Duration<Sample>(0), () => 0, () => m_handMikeSignalColor, () => 1f); m_handNode = new SpriteNode(m_handGroup, isRight ? "Right Hand" : "Left Hand", null); m_handNode.Origin = new Vector2(0.5f); m_handNode.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored | SecondaryViewOption.TextureMirrored); m_effectLabelGroup = new GroupNode(m_handGroup, Transform.Identity, "Effect label group"); m_effectLabelGroup.SetSecondaryViewOption(SecondaryViewOption.PositionMirrored); m_effectLabels = MakeEffectLabels(m_effectLabelGroup); m_armPoseLabel = new TextNode(RootNode, "Elbow label"); m_armPoseLabel.Alignment = isRight ? Alignment.TopLeft : Alignment.TopRight; m_armPoseLabel.SetSecondaryViewOption(SecondaryViewOption.Hidden); }