コード例 #1
0
ファイル: dllmain.cpp プロジェクト: 360degrees-fi/tundra
 DLLEXPORT void TundraPluginMain(Framework *fw)
 {
     Framework::SetInstance(fw);
     fw->RegisterModule(new SceneWidgetComponents());
     fw->Scene()->RegisterComponentFactory(MAKE_SHARED(GenericComponentFactory<EC_WidgetCanvas>));
     fw->Scene()->RegisterComponentFactory(MAKE_SHARED(GenericComponentFactory<EC_WebView>));
     fw->Scene()->RegisterComponentFactory(MAKE_SHARED(GenericComponentFactory<EC_SlideShow>));
     fw->Scene()->RegisterComponentFactory(MAKE_SHARED(GenericComponentFactory<EC_WidgetBillboard>));
 }
コード例 #2
0
ファイル: dllmain.cpp プロジェクト: 360degrees-fi/tundra
DLLEXPORT void TundraPluginMain(Framework *fw)
{
    Framework::SetInstance(fw); // Inside this DLL, remember the pointer to the global framework object.
#if SKYX_ENABLED
    fw->Scene()->RegisterComponentFactory(MAKE_SHARED(GenericComponentFactory<EC_SkyX>));
#endif
#if HYDRAX_ENABLED
    fw->Scene()->RegisterComponentFactory(MAKE_SHARED(GenericComponentFactory<EC_Hydrax>));
#endif
}
コード例 #3
0
ファイル: ConsoleAPI.cpp プロジェクト: Pouique/naali
void ConsoleAPI::CreateNativeConsole()
{
#ifdef WIN32
    if (!GetConsoleWindow() && Application::ShowConsoleWindow(false))
        shellInputThread = MAKE_SHARED(ShellInputThread); // Recreate ShellInputThread so that we will have working input.
#endif
}
コード例 #4
0
ファイル: ConsoleAPI.cpp プロジェクト: Pouique/naali
void ConsoleAPI::RegisterCommand(const QString &name, const QString &desc, QObject *receiver, const char *memberSlot, const char *memberSlotDefaultArgs)
{
    if (name.isEmpty())
    {
        LogError("ConsoleAPI::RegisterCommand: Command name can not be an empty string.");
        return;
    }
    if (commands.find(name) != commands.end())
    {
        LogWarning("ConsoleAPI::RegisterCommand: Command " + name + " is already registered.");
        return;
    }

    shared_ptr<ConsoleCommand> command = MAKE_SHARED(ConsoleCommand, name, desc, receiver, memberSlot+1, memberSlotDefaultArgs ? memberSlotDefaultArgs+1 : "");
    commands[name] = command;
}
コード例 #5
0
EC_MeshmoonCulling::EC_MeshmoonCulling(Scene *scene) :
    IComponent(scene),
    LC("EC_MeshmoonCulling: "),
    INIT_ATTRIBUTE_VALUE(tomeRef, "Tome ref", AssetReference("", "Binary")),
    INIT_ATTRIBUTE_VALUE(id, "Id", 0),
    INIT_ATTRIBUTE_VALUE(smallestOccluder, "Smallest occluder", 3),
    INIT_ATTRIBUTE_VALUE(smallestHole, "Smallest hole", 0.25f),
    INIT_ATTRIBUTE_VALUE(backfaceLimit, "Backface limit", 100),
    INIT_ATTRIBUTE_VALUE(tileSize, "Tile size", 24),
    INIT_ATTRIBUTE_VALUE(drawDebug, "Draw debug", false),
    umbraScene_(0),
    umbraTome_(0),
    umbraObjectList_(0),
    umbraQuery_(0),
    umbraDebugRenderer_(0),
    freezeOcclusionCamera_(false),
    tomePath_(""),
    maxWaitingTime_(10.0),
    lastVisibleObjects_(0),
    lastVisibleObjectsSize_(0)
{
    if (!framework)
    {
        LogError(LC + "TODO: Make EC_MeshmoonCulling work when created as unparented!");
        return;
    }
    if (framework->IsHeadless())
        return;

    tomeListener_ = MAKE_SHARED(AssetRefListener);

    connect(tomeListener_.get(), SIGNAL(Loaded(AssetPtr)), this, SLOT(OnLoadTome(AssetPtr)));
    connect(tomeListener_.get(), SIGNAL(TransferFailed(IAssetTransfer *, QString)), this, SLOT(OnTomeLoadingFailed(IAssetTransfer *, QString)));

    connect(framework->Input()->TopLevelInputContext(), SIGNAL(KeyPressed(KeyEvent*)), this, SLOT(OnKeyPress(KeyEvent*)));

    OgreRenderer::OgreRenderingModule* renderingModule = framework->GetModule<OgreRenderer::OgreRenderingModule>();
    if(!renderingModule)
        return;

    renderer_ = renderingModule->GetRenderer();
    if(!renderer_.get())
        return;

    connect(renderer_.get(), SIGNAL(MainCameraChanged(Entity *)), this, SLOT(OnActiveCameraChanged(Entity *)), Qt::UniqueConnection);
}
コード例 #6
0
ファイル: ConsoleAPI.cpp プロジェクト: Pouique/naali
ConsoleCommand *ConsoleAPI::RegisterCommand(const QString &name, const QString &desc)
{
    if (name.isEmpty())
    {
        LogError("ConsoleAPI::RegisterCommand: Command name can not be an empty string.");
        return 0;
    }
    if (commands.find(name) != commands.end())
    {
        LogWarning("ConsoleAPI::RegisterCommand: Command " + name + " is already registered.");
        return commands[name].get();
    }

    shared_ptr<ConsoleCommand> command = MAKE_SHARED(ConsoleCommand, name, desc, (QObject *)0, "", "");
    commands[name] = command;
    return command.get();
}
コード例 #7
0
ファイル: ConsoleAPI.cpp プロジェクト: Pouique/naali
ConsoleAPI::ConsoleAPI(Framework *fw) :
    QObject(fw),
    framework(fw),
    enabledLogChannels(LogLevelErrorWarnInfo),
    logFile(0),
    logFileText(0)
{
    if (!fw->IsHeadless())
        consoleWidget = new ConsoleWidget(framework);

    inputContext = framework->Input()->RegisterInputContext("Console", 100);
    inputContext->SetTakeKeyboardEventsOverQt(true);
    connect(inputContext.get(), SIGNAL(KeyEventReceived(KeyEvent *)), SLOT(HandleKeyEvent(KeyEvent *)));

    RegisterCommand("help", "Lists all registered commands.", this, SLOT(ListCommands()));
    RegisterCommand("clear", "Clears the console log.", this, SLOT(ClearLog()));
    RegisterCommand("setLogLevel", "Sets the current log level. Call with one of the parameters \"error\", \"warning\", \"info\", or \"debug\".",
        this, SLOT(SetLogLevel(const QString &)));
#ifdef WIN32
    RegisterCommand("createConsole", "Creates the native Windows console if Tundra was started without such.", this, SLOT(CreateNativeConsole()));
    RegisterCommand("removeConsole", "Removes the native Windows console if applicable.", this, SLOT(RemoveNativeConsole()));
#endif

    /// \todo Visual Leak Detector shows a memory leak originating from this allocation although the shellInputThread is released in the destructor. Perhaps a shared pointer is held elsewhere.
    shellInputThread = MAKE_SHARED(ShellInputThread);

    QStringList logLevel = fw->CommandLineParameters("--loglevel");
    if (logLevel.size() >= 1)
        SetLogLevel(logLevel[logLevel.size()-1]);
    if (logLevel.size() > 1)
        LogWarning("Ignoring multiple --loglevel command line parameters!");

    QStringList logFile = fw->CommandLineParameters("--logfile");
    if (logFile.size() >= 1)
        SetLogFile(logFile[logFile.size()-1]);
    if (logFile.size() > 1)
        LogWarning("Ignoring multiple --logfile command line parameters!");
}
コード例 #8
0
void GenerateConvexHullSet(Ogre::Mesh* mesh, ConvexHullSet* ptr)
{
    std::vector<float3> vertices;
    GetTrianglesFromMesh(mesh, vertices);
    if (!vertices.size())
    {
        LogError("Mesh had no triangles; aborting convex hull generation");
        return;
    }
    
    StanHull::HullDesc desc;
    desc.SetHullFlag(StanHull::QF_TRIANGLES);
    desc.mVcount = (uint)vertices.size();
    desc.mVertices = &vertices[0].x;
    desc.mVertexStride = sizeof(float3);
    desc.mSkinWidth = 0.01f; // Hardcoded skin width
    
    StanHull::HullLibrary lib;
    StanHull::HullResult result;
    lib.CreateConvexHull(desc, result);

    if (!result.mNumOutputVertices)
    {
        LogError("No vertices were generated; aborting convex hull generation");
        return;
    }
    
    ConvexHull hull;
    hull.position_ = float3(0,0,0);
    /// \todo StanHull always produces only 1 hull. Therefore using a hull set is unnecessary and could be optimized away
#include "DisableMemoryLeakCheck.h"
    hull.hull_ = MAKE_SHARED(btConvexHullShape, (const btScalar*)&result.mOutputVertices[0], result.mNumOutputVertices, 3 * sizeof(float));
#include "EnableMemoryLeakCheck.h"
    ptr->hulls_.push_back(hull);
    
    lib.ReleaseResult(result);
}