示例#1
0
EC_Hydrax::EC_Hydrax(Scene* scene) :
    IComponent(scene),
    INIT_ATTRIBUTE_VALUE(configRef, "Config ref", AssetReference(cDefaultConfig)),
    INIT_ATTRIBUTE_VALUE(visible, "Visible", true),
    INIT_ATTRIBUTE_VALUE(position, "Position", float3(0.0, 0.0, 0.0)),
//    INIT_ATTRIBUTE_VALUE(noiseModule, "Noise module", 0),
//    INIT_ATTRIBUTE_VALUE(noiseType, "Noise type", 0),
//    INIT_ATTRIBUTE_VALUE(normalMode, "Normal mode", 0),
    impl(0)
{
/*
    static AttributeMetadata noiseTypeMetadata;
    static AttributeMetadata normalModeMetadata;
    static bool metadataInitialized = false;
    if (!metadataInitialized)
    {
        noiseTypeMetadata.enums[Perlin] = "Perlin";
        noiseTypeMetadata.enums[FFT] = "FFT";

        normalModeMetadata.enums[Texture] = "Texture";
        normalModeMetadata.enums[Vertex] = "Vertex";
        normalModeMetadata.enums[RTT] = "RTT";

        metadataInitialized = true;
    }

    noiseType.SetMetadata(&noiseTypeMetadata);
    normalMode.SetMetadata(&normalModeMetadata);
*/
    connect(this, SIGNAL(ParentEntitySet()), SLOT(Create()));

    connect(&configRefListener, SIGNAL(Loaded(AssetPtr)), this, SLOT(ConfigLoadSucceeded(AssetPtr)));

}
示例#2
0
EC_RttTarget::EC_RttTarget(Scene* scene) :
    IComponent(scene),
    INIT_ATTRIBUTE_VALUE(textureName, "Texture name", "RttTex"),
    INIT_ATTRIBUTE_VALUE(width, "Texture width", 400),
    INIT_ATTRIBUTE_VALUE(height, "Texture height", 300)
{
    connect(this, SIGNAL(ParentEntitySet()), this, SLOT(PrepareRtt()));
}
示例#3
0
文件: EC_SkyX.cpp 项目: katik/naali
EC_SkyX::EC_SkyX(Scene* scene) :
    IComponent(scene),
    cloudType(this, "Cloud type", Normal),
    timeMultiplier(this, "Time multiplier", 0.0f),
    time(this, "Time [0-24]", 14.f), /**< @todo This metadata appended to attribute name is not nice. Usability issued should be resolved at UI level (f.ex. tooltip?) and/or by using AttributeMetadata. Remove this. */
    sunriseTime(this, "Time sunrise [0-24]", 7.5f), /**< @todo This metadata appended to attribute name is not nice. Usability issued should be resolved at UI level (f.ex. tooltip?) and/or by using AttributeMetadata. Remove this. */
    sunsetTime(this, "Time sunset [0-24]", 20.5f), /**< @todo This metadata appended to attribute name is not nice. Usability issued should be resolved at UI level (f.ex. tooltip?) and/or by using AttributeMetadata. Remove this. */
    cloudCoverage(this, "Cloud coverage [0-100]", 50), /**< @todo This metadata appended to attribute name is not nice. Usability issued should be resolved at UI level (f.ex. tooltip?) and/or by using AttributeMetadata. Remove this. */
    cloudAverageSize(this, "Cloud average size [0-100]", 50), /**< @todo This metadata appended to attribute name is not nice. Usability issued should be resolved at UI level (f.ex. tooltip?) and/or by using AttributeMetadata. Remove this. */
    cloudHeight(this, "Cloud height", 100),
    moonPhase(this, "Moon phase [0-100]", 50), /**< @todo This metadata appended to attribute name is not nice. Usability issued should be resolved at UI level (f.ex. tooltip?) and/or by using AttributeMetadata. Remove this. */
    windDirection(this, "Wind direction", 0.0f),
    windSpeed(this, "Wind speed", 5.0f),
    sunInnerRadius(this, "Sun inner radius", 9.75f),
    sunOuterRadius(this, "Sun outer radius", 10.25f),
    sunlightDiffuseColor(this, "Sunlight diffuse color", Color(0.639f,0.639f,0.639f)),
    sunlightSpecularColor(this, "Sunlight specular color"), // defaults to black
    moonlightDiffuseColor(this, "Moonlight color", Color(0.639f,0.639f,0.639f, 0.25f)), /**< @todo Nicer color for moonlight */
    moonlightSpecularColor(this, "Moonlight specular color"), // defaults to black
    ambientLightColor(this, "Ambient light color", OgreWorld::DefaultSceneAmbientLightColor()), // Ambient and sun diffuse color copied from EC_EnvironmentLight
    impl(0)
{
    static AttributeMetadata cloudTypeMd, cloudHeightMd, timeMd, zeroToHundredMd, mediumStepMd, smallStepMd;
    static bool metadataInitialized = false;
    if (!metadataInitialized)
    {
        cloudTypeMd.enums[None] = "None";
        cloudTypeMd.enums[Normal] = "Normal";
        cloudTypeMd.enums[Volumetric] = "Volumetric";
        timeMd.minimum = "0.0";
        timeMd.maximum = "24.0";
        timeMd.step = "0.5";
        zeroToHundredMd.minimum = "0.0";
        zeroToHundredMd.maximum = "100.0";
        zeroToHundredMd.step = "10.0";
        cloudHeightMd.minimum = "0.0";
        cloudHeightMd.maximum = "10000.0";
        cloudHeightMd.step = "10.0";
        mediumStepMd.step = "0.1";
        smallStepMd.step = "0.01";
        metadataInitialized = true;
    }
    cloudType.SetMetadata(&cloudTypeMd);
    time.SetMetadata(&timeMd);
    sunriseTime.SetMetadata(&timeMd);
    sunsetTime.SetMetadata(&timeMd);
    cloudCoverage.SetMetadata(&zeroToHundredMd);
    cloudAverageSize.SetMetadata(&zeroToHundredMd);
    cloudHeight.SetMetadata(&cloudHeightMd);
    moonPhase.SetMetadata(&zeroToHundredMd);
    timeMultiplier.SetMetadata(&smallStepMd);
    sunInnerRadius.SetMetadata(&mediumStepMd);
    sunOuterRadius.SetMetadata(&mediumStepMd);

    connect(this, SIGNAL(ParentEntitySet()), SLOT(Create()));
}
示例#4
0
EC_WidgetCanvas::EC_WidgetCanvas(Scene *scene) :
    IComponent(scene),
    widget_(0),
    update_internals_(false),
    mesh_hooked_(false),
    refresh_timer_(0),
    update_interval_msec_(0),
    material_name_(""),
    texture_name_("")
{
    if (framework->IsHeadless())
        return;
	
	if (framework->Renderer())
    {
        // Create texture
        texture_name_ = framework->Renderer()->GetUniqueObjectName("EC_3DCanvas_tex");
        Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(
            texture_name_, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D, 1, 1, 0, Ogre::PF_A8R8G8B8, 
            Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
        if (texture.isNull())
        {
            LogError("EC_WidgetCanvas: Could not create texture for usage!");
            return;
        }

        // Create material: Make sure we have one tech with one pass with one texture unit.
        // Don't use our lit textured templates here as emissive will not work there as it has vertex etc programs in it.
        material_name_ = framework->Renderer()->GetUniqueObjectName("EC_3DCanvas_mat");
        Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(material_name_, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
        if (material->getNumTechniques() == 0)
            material->createTechnique();
        if (material->getTechnique(0) && 
            material->getTechnique(0)->getNumPasses() == 0)
            material->getTechnique(0)->createPass();
        if (material->getTechnique(0)->getPass(0) && 
            material->getTechnique(0)->getPass(0)->getNumTextureUnitStates() == 0)
            material->getTechnique(0)->getPass(0)->createTextureUnitState(texture_name_);        
    }

    connect(this, SIGNAL(ParentEntitySet()), SLOT(ParentEntitySet()), Qt::UniqueConnection);
}
示例#5
0
EC_VideoSource::EC_VideoSource(IModule *module):
    IComponent(module->GetFramework()),
    videoSourceUrl(this, "Video source url"),
    submeshIndex(this, "Submesh index", 0),
    playbackState(this, "Playback state", PS_Stop),
    audioPlaybackVolume(this, "Audio playback volume", 0.8f),
    looping(this, "Looping", false),
    refreshRate(this, "Refresh per sec", 15),
    scaleDown(this, "Scale to 320x240", false),
    startup_checker_(false),
    start_canvas_(false),
    stop_canvas_(false),
    playing_canvas_(false),
    expecting_resources_(false),
    ready_poller_(new QTimer(this)),
    player_(0),
    video_widget_(0),
    media_object_(0),
//    video_request_tag_(0),
    error_label_(0)
{
    // Init metadata for attributes
    static AttributeMetadata psAttrData;
    static bool metadataInitialized = false;
    if(!metadataInitialized)
    {
        psAttrData.enums[PS_Play] = "Play";
        psAttrData.enums[PS_Pause] = "Pause";
        psAttrData.enums[PS_Stop] = "Stop";
        metadataInitialized = true;
    }
    playbackState.SetMetadata(&psAttrData);

    static AttributeMetadata volumeMetaData("", "0", "1", "0.1");
    audioPlaybackVolume.SetMetadata(&volumeMetaData);

    // Init ready poller and signals
    ready_poller_->setSingleShot(true);

    connect(ready_poller_, SIGNAL(timeout()), SLOT(Play()));
    connect(this, SIGNAL(ParentEntitySet()), SLOT(UpdateSignals()));
    connect(this, SIGNAL(AttributeChanged(IAttribute*, AttributeChange::Type)), SLOT(OnAttributeUpdated(IAttribute*)));

    // Register as a event listener
    EventManager *event_manager = framework_->GetEventManager().get();
    if (event_manager)
    {
        event_manager->RegisterEventSubscriber(this, 99);
        asset_event_category_ = event_manager->QueryEventCategory("Asset");
    }

    playbackState.Set(PS_Stop, AttributeChange::LocalOnly);
}
示例#6
0
EC_Touchable::EC_Touchable(IModule *module) :
    IComponent(module->GetFramework()),
    entityClone_(0),
    sceneNode_(0),
    materialName(this, "material name", "Touchable"),
    highlightOnHover(this, "highligh on hover", true),
    hoverCursor(this, "hover cursor", Qt::ArrowCursor)
{
    static AttributeMetadata metadata;
    static bool metadataInitialized = false;
    if(!metadataInitialized)
    {
        metadata.enums[Qt::ArrowCursor] = "ArrowCursor";
        metadata.enums[Qt::UpArrow] = "UpArrowCursor";
        metadata.enums[Qt::CrossCursor] = "CrossCursor";
        metadata.enums[Qt::WaitCursor] = "WaitCursor";
        metadata.enums[Qt::IBeamCursor] = "IBeamCursor";
        metadata.enums[Qt::SizeVerCursor] = "SizeVerCursor";
        metadata.enums[Qt::SizeHorCursor] = "SizeHorCursor";
        metadata.enums[Qt::SizeBDiagCursor] = "SizeBDiagCursor";
        metadata.enums[Qt::SizeFDiagCursor] = "SizeFDiagCursor";
        metadata.enums[Qt::SizeAllCursor] = "SizeAllCursor";
        metadata.enums[Qt::BlankCursor] = "BlankCursor";
        metadata.enums[Qt::SplitVCursor] = "SplitVCursor";
        metadata.enums[Qt::SplitHCursor] = "SplitHCursor";
        metadata.enums[Qt::PointingHandCursor] = "PointingHandCursor";
        metadata.enums[Qt::ForbiddenCursor] = "ForbiddenCursor";
        metadata.enums[Qt::WhatsThisCursor] = "WhatsThisCursor";
        metadata.enums[Qt::BusyCursor] = "BusyCursor";
        metadata.enums[Qt::OpenHandCursor] = "OpenHandCursor";
        metadata.enums[Qt::ClosedHandCursor] = "ClosedHandCursor";
        metadataInitialized = true;
    }

    hoverCursor.SetMetadata(&metadata);

    renderer_ = module->GetFramework()->GetServiceManager()->GetService<OgreRenderer::Renderer>(Service::ST_Renderer);
    connect(this, SIGNAL(AttributeChanged(IAttribute*, AttributeChange::Type)), SLOT(UpdateMaterial()));
    connect(this, SIGNAL(ParentEntitySet()), SLOT(RegisterActions()));
//    connect(this, SIGNAL(ParentEntitySet()), SLOT(Create()));
}
示例#7
0
EC_ChatBubble::EC_ChatBubble(IModule *module) :
    IComponent(module->GetFramework()),
    font_(QFont("Arial", 50)),
    bubbleColor_(QColor(48, 113, 255, 255)),
    textColor_(Qt::white),
    billboardSet_(0),
    billboard_(0),
    pop_timer_(new QTimer(this)),
    bubble_max_rect_(0,0,1024,512),
    current_scale_(1.0f),
    default_z_pos_(1.9f)
{
    // Get renderer service
    renderer_ = module->GetFramework()->GetServiceManager()->GetService<OgreRenderer::Renderer>();

    // Pop timer init
    pop_timer_->setSingleShot(true);
    connect(pop_timer_, SIGNAL(timeout()), SLOT(ShowNextMessage()));

    connect(this, SIGNAL(ParentEntitySet()), this, SLOT(Update()));
}
示例#8
0
文件: EC_Sound.cpp 项目: Chiru/naali
EC_Sound::EC_Sound(Foundation::ModuleInterface *module):
    Foundation::ComponentInterface(module->GetFramework()),
    sound_id_(0),
    soundId_(this, "Sound id"),
    soundInnerRadius_(this, "sound radius inner", 0.0f),
    soundOuterRadius_(this, "Sound radius outer", 20.0f),
    loopSound_(this, "Loop sound", false),
    triggerSound_(this, "Trigger sound", false),
    soundGain_(this, "Sound gain", 1.0f)
{
    static AttributeMetadata metaData;
    static bool metadataInitialized = false;
    if(!metadataInitialized)
    {
        metaData.min = "0";
        metaData.max = "1";
        metaData.step = "0.1";
        metadataInitialized = true;
    }
    soundGain_.SetMetadata(&metaData);

    QObject::connect(this, SIGNAL(ParentEntitySet()), this, SLOT(UpdateSignals()));
}
示例#9
0
EC_WaterPlane::EC_WaterPlane(Scene* scene) :
    IComponent(scene),
    xSize(this, "x-size", 5000),
    ySize(this, "y-size", 5000),
    depth(this, "Depth", 20),
    position(this, "Position", float3::zero),
    rotation(this, "Rotation", Quat::identity),
    scaleUfactor(this, "U factor", 0.0002f),
    scaleVfactor(this, "V factor", 0.0002f),
    xSegments(this, "Segments in x", 10),
    ySegments(this, "Segments in y", 10),
    materialName(this, "Material", QString("Ocean")),
    materialRef(this, "Material ref"),
   //textureNameAttr(this, "Texture", QString("DefaultOceanSkyCube.dds")),
    fogColor(this, "Fog color", Color(0.2f,0.4f,0.35f,1.0f)),
    fogStartDistance(this, "Fog start dist.", 100.f),
    fogEndDistance(this, "Fog end dist.", 2000.f),
    fogMode(this, "Fog mode", 3),
    entity_(0),
    node_(0),
    attached_(false),
    attachedToRoot_(false)
{
    static AttributeMetadata metadata;
    static bool metadataInitialized = false;
    if(!metadataInitialized)
    {
        metadata.enums[Ogre::FOG_NONE] = "NoFog";
        metadata.enums[Ogre::FOG_EXP] = "Exponential";
        metadata.enums[Ogre::FOG_EXP2] = "ExponentiallySquare";
        metadata.enums[Ogre::FOG_LINEAR] = "Linear";
        metadataInitialized = true;
    }

    fogMode.SetMetadata(&metadata);

    if (scene)
        world_ = scene->GetWorld<OgreWorld>();
    OgreWorldPtr world = world_.lock();
    if (world)
    {
        Ogre::SceneManager *sceneMgr = world->GetSceneManager();
        node_ = sceneMgr->createSceneNode(world->GetUniqueObjectName("EC_WaterPlane_Root"));
    }

    QObject::connect(this, SIGNAL(AttributeChanged(IAttribute*, AttributeChange::Type)),
        SLOT(OnAttributeUpdated(IAttribute*, AttributeChange::Type)));

    lastXsize_ = xSize.Get();
    lastYsize_ = ySize.Get();

    connect(this, SIGNAL(ParentEntitySet()), this, SLOT(SetParent()));

    // If there exist placeable copy its position for default position and rotation.
   
    /*
    EC_Placeable* placeable = dynamic_cast<EC_Placeable*>(FindPlaceable().get());
    if (placeable != 0)
    {
        float3 vec = placeable->GetPosition();
        position.Set(vec,AttributeChange::Default);
   
        Quaternion rot =placeable->GetOrientation();
        rotation.Set(rot, AttributeChange::Default);
        ComponentChanged(AttributeChange::Default);
    }
    */
}
EC_MeshmoonWater::EC_MeshmoonWater(Scene *scene) :
    IComponent(scene),
    INIT_ATTRIBUTE_VALUE(simulationModel, "Water Type", static_cast<uint>(Tessendorf)),
    INIT_ATTRIBUTE_VALUE(sprayEnabled, "Spray Enabled", false),
    INIT_ATTRIBUTE_VALUE(drawDebug, "Draw Debug", false),
    INIT_ATTRIBUTE_VALUE(enableHeightQueries, "Enable Height Queries", false),
    INIT_ATTRIBUTE_VALUE(waveChoppiness, "Wave Choppiness", 2.0f),
    INIT_ATTRIBUTE_VALUE(waterColor, "Water Color", Color(0.0f, 0.2f, 0.3f)),
    INIT_ATTRIBUTE_VALUE(seaLevel, "Sea Level", 0.0f),
    INIT_ATTRIBUTE_VALUE(beaufortScale, "Beaufort Scale", 4), // Moderate breeze
    INIT_ATTRIBUTE_VALUE(visible, "Visible", true),
    INIT_ATTRIBUTE_VALUE(reflectionsEnabled, "Reflections Enabled", false),
    INIT_ATTRIBUTE_VALUE(reflectionIntensity, "Reflection Intensity", 0.6f),
    LC("[EC_MeshmoonWater]: "),
    tritonVisible_(true),
#ifndef MESHMOON_SERVER_BUILD
    renderQueueListener_(0),
    renderSystemListener_(0),
    renderTargetListener_(0),
#endif
    activeCamera_(0)
{
    // Water type metadata
    static AttributeMetadata simulationModelMetadata, beaufortMetadata, reflectionIntensityMetadata;
    static bool metadataInitialized = false;
    if (!metadataInitialized)
    {
        simulationModelMetadata.enums[static_cast<int>(Tessendorf)] = "Tessendorf";
        simulationModelMetadata.enums[static_cast<int>(PiersonMoskowitz)] = "Pierson-Moskowitz";
        simulationModelMetadata.enums[static_cast<int>(Jonswap)] = "Jonswap";

        beaufortMetadata.enums[0] = "Calm";
        beaufortMetadata.enums[1] = "Light air";
        beaufortMetadata.enums[2] = "Light breeze";
        beaufortMetadata.enums[3] = "Gentle breeze";
        beaufortMetadata.enums[4] = "Moderate breeze";
        beaufortMetadata.enums[5] = "Fresh breeze";
        beaufortMetadata.enums[6] = "Strong breeze";
        beaufortMetadata.enums[7] = "Moderate gale";
        beaufortMetadata.enums[8] = "Fresh gale";
        beaufortMetadata.enums[9] = "Strong gale";
        beaufortMetadata.enums[10] = "Storm";
        beaufortMetadata.enums[11] = "Violent storm";
        beaufortMetadata.enums[12] = "Hurricane force";
        
        reflectionIntensityMetadata.minimum = "0.0";
        reflectionIntensityMetadata.maximum = "1.0";
        reflectionIntensityMetadata.step = "0.1";
        
        metadataInitialized = true;
    }

    simulationModel.SetMetadata(&simulationModelMetadata);
    beaufortScale.SetMetadata(&beaufortMetadata);
    reflectionIntensity.SetMetadata(&reflectionIntensityMetadata);
    
    connect(this, SIGNAL(ParentEntitySet()), SLOT(OnParentEntitySet()));
 
    // These can fail if created as unparented! Accounted in OnParentEntitySet().
    if (scene)
        world_ = scene->Subsystem<OgreWorld>();
    OgreRenderingModule* renderingModule = (framework ? framework->Module<OgreRenderingModule>() : 0);
    if (renderingModule)
        renderer_ = renderingModule->Renderer();
}
示例#11
0
EC_MediaPlayer::EC_MediaPlayer(Scene* scene) :
    IComponent(scene),
    mediaPlayer_(0),
    componentPrepared_(false),
    pendingMediaDownload_(false),
    sourceRef(this, "Media Source", AssetReference("", "")),
    renderSubmeshIndex(this, "Render Submesh", 0),
    interactive(this, "Interactive", false),
    illuminating(this, "Illuminating", true),
    streamingAllowed(this, "Streaming Allowed", true),
    enabled(this, "Enabled", true)
{
    if (!ViewEnabled() || GetFramework()->IsHeadless())
        return;

    // Set metadata min/max/step
    static AttributeMetadata submeshMetaData;
    static bool metadataInitialized = false;
    if (!metadataInitialized)
    {
        submeshMetaData.minimum = "0";
        submeshMetaData.step = "1";
        metadataInitialized = true;
    }
    renderSubmeshIndex.SetMetadata(&submeshMetaData);

    // Init our internal media player
    mediaPlayer_ = new VlcMediaPlayer();
    connect(mediaPlayer_, SIGNAL(FrameUpdate(QImage)), SLOT(OnFrameUpdate(QImage)), Qt::UniqueConnection);

    // Connect signals from IComponent
    connect(this, SIGNAL(ParentEntitySet()), SLOT(PrepareComponent()), Qt::UniqueConnection);

    // Connect window size changes to update rendering as the ogre textures go black.
    if (GetFramework()->Ui()->MainWindow())
        connect(GetFramework()->Ui()->MainWindow(), SIGNAL(WindowResizeEvent(int,int)), SLOT(RenderWindowResized()), Qt::UniqueConnection);

    resizeRenderTimer_ = new QTimer(this);
    resizeRenderTimer_->setSingleShot(true);
    connect(resizeRenderTimer_, SIGNAL(timeout()), mediaPlayer_, SLOT(ForceUpdateImage()), Qt::UniqueConnection);

    // Prepare scene interactions
    SceneInteract *sceneInteract = GetFramework()->GetModule<SceneInteract>();
    if (sceneInteract)
    {
        connect(sceneInteract, SIGNAL(EntityClicked(Entity*, Qt::MouseButton, RaycastResult*)), 
                SLOT(EntityClicked(Entity*, Qt::MouseButton, RaycastResult*)));
    }

    // Prepare media downloader
    mediaDownloader_ = new AssetRefListener();
    connect(mediaDownloader_, SIGNAL(Loaded(AssetPtr)), SLOT(OnMediaLoaded(AssetPtr)));
    connect(mediaDownloader_, SIGNAL(TransferFailed(IAssetTransfer*, QString)), SLOT(OnMediaFailed(IAssetTransfer*, QString)));

    // Construct loading image
    downloadingLogo_ = QImage(500, 300, QImage::Format_ARGB32);
    downloadingLogo_.fill(Qt::black);
    QPixmap bufferingIcon(":/images/buffering.png");
    QPoint centerPos = downloadingLogo_.rect().center();
    QRect target(centerPos.x() - (bufferingIcon.width()/2), centerPos.y() - (bufferingIcon.height()/2), bufferingIcon.width(), bufferingIcon.height());
    QPainter p(&downloadingLogo_);
    p.setPen(Qt::white);
    p.drawPixmap(target, bufferingIcon, bufferingIcon.rect());
    p.drawText(5, 12, "Downloading media...");
    p.end();
}
示例#12
0
文件: EC_WebView.cpp 项目: A-K/naali
EC_WebView::EC_WebView(IModule *module) :
    IComponent(module->GetFramework()),
    webview_(0),
    renderTimer_(0),
    webviewLoading_(false),
    webviewHasContent_(false),
    componentPrepared_(false),
    myControllerId_(0),
    currentControllerName_(""),
    webviewUrl(this, "View URL", QString()),
    webviewSize(this, "View Size", QSize(800,600)),
    renderSubmeshIndex(this, "Render Submesh", 0),
    renderRefreshRate(this, "Render FPS", 0),
    interactive(this, "Interactive", false),
    controllerId(this, "ControllerId", NoneControlID),
    illuminating(this, "Illuminating", true)
{
    interactionMetaData_ = new AttributeMetadata();

    static AttributeMetadata submeshMetaData;
    static AttributeMetadata refreshRateMetadata;
    static AttributeMetadata nonDesignableMetadata;
    static bool metadataInitialized = false;
    if (!metadataInitialized)
    {
        submeshMetaData.minimum = "0";
        submeshMetaData.step = "1";
        refreshRateMetadata.minimum = "0";
        refreshRateMetadata.maximum = "25";
        refreshRateMetadata.step = "1";
        nonDesignableMetadata.designable = false;
        metadataInitialized = true;
    }
    renderSubmeshIndex.SetMetadata(&submeshMetaData);
    renderRefreshRate.SetMetadata(&refreshRateMetadata);
    controllerId.SetMetadata(&nonDesignableMetadata);

    // Initializations depending if we are on the server or client
    TundraLogic::TundraLogicModule *tundraLogic = GetFramework()->GetModule<TundraLogic::TundraLogicModule>();
    if (tundraLogic)
    {
        if (tundraLogic->IsServer())
            ServerInitialize(tundraLogic->GetServer().get());
        else
            myControllerId_ = tundraLogic->GetClient()->GetConnectionID();
    }

    // Don't do anything beyond if rendering is not enabled
    // aka headless server. UI enabled server may continue, but they are not going
    // to have perfect browsing sync as the entity actions are sent to "peers" as in other clients.
    if (!ViewEnabled() || GetFramework()->IsHeadless())
        return;

    // Connect window size changes to update rendering as the ogre textures go black.
    if (GetFramework()->Ui()->MainWindow())
        connect(GetFramework()->Ui()->MainWindow(), SIGNAL(WindowResizeEvent(int,int)), SLOT(RenderDelayed()), Qt::UniqueConnection);

    // Connect signals from IComponent
    connect(this, SIGNAL(ParentEntitySet()), SLOT(PrepareComponent()), Qt::UniqueConnection);
    connect(this, SIGNAL(AttributeChanged(IAttribute*, AttributeChange::Type)), SLOT(AttributeChanged(IAttribute*, AttributeChange::Type)), Qt::UniqueConnection);
    
    // Prepare render timer
    renderTimer_ = new QTimer(this);
    connect(renderTimer_, SIGNAL(timeout()), SLOT(Render()), Qt::UniqueConnection);

    // Prepare scene interactions
    SceneInteractWeakPtr sceneInteract = GetFramework()->Scene()->GetSceneIteract();
    if (!sceneInteract.isNull())
    {
        connect(sceneInteract.data(), SIGNAL(EntityMousePressed(Scene::Entity*, Qt::MouseButton, RaycastResult*)), 
                SLOT(EntityClicked(Scene::Entity*, Qt::MouseButton, RaycastResult*)));
    }