UofC Large Display Framework
UofC Large Display Framework. Version 1.1. Fabrício Anastácio December, 2007. Outline. Framework Overview Touch Indicators LargeDisplayEvent VisComponentStrategy Animation Configurable Application Final Remarks. Framework Overview. Application. Toolkit. iLab Toolkit.
UofC Large Display Framework
E N D
Presentation Transcript
UofC Large Display Framework Version 1.1 Fabrício Anastácio December, 2007
Outline • Framework Overview • Touch Indicators • LargeDisplayEvent • VisComponentStrategy • Animation • Configurable Application • Final Remarks
Framework Overview Application Toolkit iLab Toolkit Large Display Framework I-Buffer
Framework Overview FrameTimer LargeDisplayManager VisComponentStrategy LargeDisplayEvent CompositeNode VisComponent VisComponentState Point3f IBufferProxy VectorTemplate IBuffer
Touch Indicators • Special case of a visual component • Touch indicators list (touchIndicators vector) in the LargeDisplayManager class • Initialized in the initTouchIndicators() method in a subclass of the LargeDisplayManager class • TouchIndicatorStrategy (Toolkit): updates the position of the associated component
Touch Indicators Example: adding a touch indicator VisComponentGL* touchIndicator = new VisComponentGL(); touchIndicator->setPosition(500, 500); touchIndicator->setScaleFactor(10); GradientCircleStrategy* gradientCircle = new GradientCircleStrategy(127, 0, 127); touchIndicator->pushStrategy(gradientCircle); TouchIndicatorStrategy* indicatorStrategy = new TouchIndicatorStrategy(); touchIndicator->pushStrategy(indicatorStrategy); touchIndicator->setLeaf(true); touchIndicators.push_back(touchIndicator);
LargeDisplayEvent • Base class for generic use of events (input and signals) • Attributes: • type identifier • user ID • sender component • 3D coordinates • ConstantProvider (Toolkit): dynamic definition of identifiers (event types, buffer types, button buffer values) • KeyEvent (iLab Toolkit): extends the LargeDisplayEvent class to hold keyboard input, used by the TextStrategy class
VisComponentStrategy • New interface: void initProperties();void process();void draw(const std::vector<unsigned long>& selectedIds);void drawForPicking();void onEvent(LargeDisplayEvent* evt);void resize(unsigned int width, unsigned int height);bool drop(bool parentChanged);void readPassiveBuffers(const std::vector<unsigned int>& types);void readAllPassiveBuffers();void readAllPickingPassiveBuffers(); • process(): called before drawing a frame • onEvent(LargeDisplayEvent* evt): called when the associated component receives an event
Animation • Framework-provided animation: • Linear interpolation between two instances of the VisComponentState* class • Originally intended for “dropping” animations • Sends events when the animation starts and stops using reserved event types (LargeDisplayManager::ANIMATION_STARTED and LargeDisplayManager::ANIMATION_OVER) * Augmented with a RGBA color attribute
Animation Example:ThickeningBorderStrategy (iLab Toolkit) void ThickeningBorderStrategy::onEvent(LargeDisplayEvent* evt) { if (evt) { unsigned int evtType = evt->getType(); if (evtType == LargeDisplayManager::ANIMATION_STARTED) { borderWidth += dBorderWidth; selectedBorderWidth += dBorderWidth; } else if (evtType == LargeDisplayManager::ANIMATION_OVER) { borderWidth -= dBorderWidth; selectedBorderWidth -= dBorderWidth; } } }
Animation • Strategy-based animation: • Uses the process() and onEvent() methods • AnimationStrategy (Toolkit): • Base class for generic animation behaviors • Starts the animation on a START_ANIMATION event • The animation duration can be defined in seconds virtual void animate() = 0; virtual void onAnimationEnd() {}; virtual void onAnimationStart(LargeDisplayEvent *evt) {};
Animation • Example:DestructionStrategy (Toolkit) provides an animation for the destruction of a component • Saves the sender of the triggering event when the animation startsvoid DestructionStrategy::onAnimationStart(LargeDisplayEvent *evt){ destroyer = evt->getSender();} • Notifies the sender when the animation is overvoid DestructionStrategy::onAnimationEnd(){ ConstantProvider* constants = ConstantProvider::getInstance(); LargeDisplayEvent* reply = new LargeDisplayEvent( constants->getEventTypeIdentifier("READY_TO_DIE"), 0, component->getPosition().x, component->getPosition().y, component->getPosition().z, component); if (destroyer) destroyer->onEvent(reply);} • Extended by the VortexDestructionStrategy & FadeDestructionStrategy (iLab Toolkit): by implementing the animate() method • Deprecates framework animation?
Configurable Application • Purpose: define an application from a configuration XML file • XMLParser library: DOM-like tree structure • XML config file structure: <LargeDisplayApplication> |__ <TouchIndicator>* |__ <Strategy>* |__ <RootComponent> |__ <Strategy>* |__ <Component>* |__ <Strategy>* |__ <Component>* |__ <Components>* |__ <Components>* |__ <Strategy>* |__ <Component>* |__ <Components>* |__ <Textures>
Configurable Application • Example of a config.xml file: <LargeDisplayApplication fullscreen="false"> <RootComponent posX="400" posY="300" posZ="0" width="800" height="600"> <Strategy name="GradientBorder" width="-10" color-red="0.3" color-green="0.5" color-blue="1.0" color-alpha="1.0"/> <Strategy name="FrictionSurface" border-width="50" border-height="50"/> <Component posX="450" posY="350" width="800" height="600" leaf="false"> <Strategy name="CurrentBeltContainer" belt-width="100" number-control-points="8" subdivision-levels="4"rounded="false"/> <Strategy name="Translation"/> </Component> </RootComponent> </LargeDisplayApplication>
Configurable Application • ConfigApplicationManager: parses the config file in the initComponents() method • StrategyParser: subclasses encapsulate the parsing logic for a specific strategy (Command Design Pattern: requests as objects [Gamma et al.]) virtual void parse(const XMLNode& node, VisComponent* component) = 0; • Parser registration: • add an entry in the parsers map of the ConfigApplicationManager class • Example: in the registerStrategyParsers() method: strategyParsers["Foo"] = new FooStrategyParser();
Final Remarks • Release versions: ‘LargeDisplayFramework’ innernet directory • LDFApplications CVS module: ConfigurableApplication, HelloTabletop, etc. • Innovis wiki tutorials: framework overview, “hello tabletop”, and “hello strategies” • Source code for the framework to be placed in the innernet • Next mantainer? • Testers needed! • Feedback