Exemplo n.º 1
0
    public MapObjectRenderer(
        RenderingDevice device,
        MdfMaterialFactory mdfFactory,
        AasRenderer aasRenderer)
    {
        mDevice      = device;
        mAasRenderer = aasRenderer;

        mHighlightMaterial  = mdfFactory.LoadMaterial("art/meshes/hilight.mdf");
        mBlobShadowMaterial = mdfFactory.LoadMaterial("art/meshes/shadow.mdf");
        mOccludedMaterial   = mdfFactory.LoadMaterial("art/meshes/occlusion.mdf");

        mGrappleController = new FrogGrappleController(device, mdfFactory);

        Globals.ConfigManager.OnConfigChanged += UpdateShadowType;
        UpdateShadowType();

        // Load the weapon glow effect files
        mGlowMaterials[0] = mdfFactory.LoadMaterial("art/meshes/wg_magic.mdf");
        mGlowMaterials[1] = mdfFactory.LoadMaterial("art/meshes/wg_acid.mdf");
        mGlowMaterials[2] = mdfFactory.LoadMaterial("art/meshes/wg_bane.mdf");
        mGlowMaterials[3] = mdfFactory.LoadMaterial("art/meshes/wg_chaotic.mdf");
        mGlowMaterials[4] = mdfFactory.LoadMaterial("art/meshes/wg_cold.mdf");
        mGlowMaterials[5] = mdfFactory.LoadMaterial("art/meshes/wg_fire.mdf");
        mGlowMaterials[6] = mdfFactory.LoadMaterial("art/meshes/wg_holy.mdf");
        mGlowMaterials[7] = mdfFactory.LoadMaterial("art/meshes/wg_law.mdf");
        mGlowMaterials[8] = mdfFactory.LoadMaterial("art/meshes/wg_shock.mdf");
        mGlowMaterials[9] = mdfFactory.LoadMaterial("art/meshes/wg_unholy.mdf");
    }
    public AASSystem(IFileSystem fs, MdfMaterialFactory materials, AasRenderer renderer)
    {
        var meshIndex = fs.ReadMesFile("art/meshes/meshes.mes");

        _materials = materials;

        Renderer = renderer;

        _modelFactory = new AnimatedModelFactory(
            fs,
            meshIndex,
            ResolveMaterial
            );
    }
Exemplo n.º 3
0
    public FrogGrappleController(RenderingDevice device,
                                 MdfMaterialFactory mdfFactory)
    {
        mDevice        = device;
        mBufferBinding = device.CreateMdfBufferBinding();

        mTongueMaterial = mdfFactory.LoadMaterial("art/meshes/Monsters/GiantFrog/tongue.mdf");

        mVertexBuffer = device.CreateEmptyVertexBuffer(TongueVertex.Size * VertexCount, debugName: "FrogTongue");

        CreateIndexBuffer();

        mBufferBinding.AddBuffer(mVertexBuffer, 0, TongueVertex.Size)
        .AddElement(VertexElementType.Float4, VertexElementSemantic.Position)
        .AddElement(VertexElementType.Float4, VertexElementSemantic.Normal)
        .AddElement(VertexElementType.Float2, VertexElementSemantic.TexCoord);
    }
    protected LineSegmentRenderer(RenderingDevice device, MdfMaterialFactory materialFactory, PerlinNoise noise,
                                  int maxLineSegments, string debugName)
    {
        _noise   = noise;
        Vertices = new Vertex[maxLineSegments * 2];
        Jitter   = new float[maxLineSegments];

        _device   = device;
        _material = materialFactory.LoadMaterial("art/meshes/lightning.mdf",
                                                 material => material.perVertexColor = true);

        _indexBuffer    = CreateIndexBuffer(_device, maxLineSegments, debugName);
        _capIndexBuffer = CreateIndexBuffer2(_device, debugName);
        _vertexBuffer   =
            _device.CreateEmptyVertexBuffer(Vertex.Size * Vertices.Length, debugName: debugName);
        _bufferBinding = _device.CreateMdfBufferBinding(true).Ref();
        _bufferBinding.Resource.AddBuffer <Vertex>(_vertexBuffer.Resource, 0)
        .AddElement(VertexElementType.Float3, VertexElementSemantic.Position)
        .AddElement(VertexElementType.Float3, VertexElementSemantic.Normal)
        .AddElement(VertexElementType.Color, VertexElementSemantic.Color)
        .AddElement(VertexElementType.Float2, VertexElementSemantic.TexCoord);
    }
 public ChainLightningRenderer(RenderingDevice device, MdfMaterialFactory materialFactory, PerlinNoise noise)
     : base(device, materialFactory, noise, MaxLineSegments, "LightningBolt")
 {
     // The line's "surface" will always be facing up
     InitVertices(Vector3.UnitY);
 }
Exemplo n.º 6
0
    public static void Startup(GameConfig config, TigSettings tigSettings = null)
    {
        tigSettings ??= new TigSettings();

        Logger.Info("Initializing TIG");

        FS = CreateFileSystem(config.InstallationFolder, tigSettings.DataFolder);

        DynamicScripting = TryLoadDynamicScripting();

        if (tigSettings.OffScreen)
        {
            MainWindow = new HeadlessMainWindow();
        }
        else
        {
            MainWindow = new MainWindow(config.Window, FS);
        }

        var configRendering = config.Rendering;

        RenderingDevice = new RenderingDevice(
            FS,
            MainWindow,
            configRendering.AdapterIndex,
            configRendering.DebugDevice);

        if (config.EnableDebugUI)
        {
            DebugUI = new DebugUiSystem(MainWindow, RenderingDevice);
        }
        else
        {
            DebugUI = new NoOpDebugUI();
        }

        MdfFactory      = new MdfMaterialFactory(FS, RenderingDevice);
        ShapeRenderer2d = new ShapeRenderer2d(RenderingDevice);
        ShapeRenderer3d = new ShapeRenderer3d(RenderingDevice);
        TextLayouter    = new TextLayouter(RenderingDevice, ShapeRenderer2d);

        // TODO mStartedSystems.emplace_back(StartSystem("idxtable.c", 0x101EC400, 0x101ECAD0));
        // TODO mStartedSystems.emplace_back(StartSystem("trect.c", TigStartupNoop, 0x101E4E40));
        // TODO mStartedSystems.emplace_back(StartSystem("color.c", 0x101ECB20, 0x101ED070));

        // TODO mLegacyVideoSystem = std::make_unique<LegacyVideoSystem>(*mMainWindow, *mRenderingDevice);


        // mStartedSystems.emplace_back(StartSystem("video.c", 0x101DC6E0, 0x101D8540));

        // TODO mStartedSystems.emplace_back(StartSystem("shader", 0x101E3350, 0x101E2090));
        // TODO mStartedSystems.emplace_back(StartSystem("palette.c", 0x101EBE30, 0x101EBEB0));
        // TODO mStartedSystems.emplace_back(StartSystem("window.c", 0x101DED20, 0x101DF320));
        // TODO mStartedSystems.emplace_back(StartSystem("timer.c", 0x101E34E0, 0x101E34F0));
        // mStartedSystems.emplace_back(StartSystem("dxinput.c", 0x101FF910, 0x101FF950));
        // mStartedSystems.emplace_back(StartSystem("keyboard.c", 0x101DE430, 0x101DE2D0));
        Keyboard = new TigKeyboard();

        // mStartedSystems.emplace_back(StartSystem("texture.c", 0x101EDF60, 0x101EE0A0));
        Mouse = new TigMouse();
        // TODO mStartedSystems.emplace_back(StartSystem("mouse.c", 0x101DDF50, 0x101DDE30));
        // TODO mStartedSystems.emplace_back(StartSystem("message.c", 0x101DE460, 0x101DE4E0));
        MessageQueue    = new MessageQueue();
        SystemEventPump = new SystemEventPump();

        // startedSystems.emplace_back(StartSystem("gfx.c", TigStartupNoop, TigShutdownNoop));
        // TODO mStartedSystems.emplace_back(StartSystem("strparse.c", 0x101EBF00, TigShutdownNoop));
        // TODO mStartedSystems.emplace_back(StartSystem("filecache.c", TigStartupNoop, TigShutdownNoop));
        Sound = new TigSound(
            soundId => GameSystems.SoundGame.FindSoundFilename(soundId),
            tigSettings.DisableSound
            );
        // TODO mSoundSystem = std::make_unique<temple::SoundSystem>();
        // TODO mMovieSystem = std::make_unique<temple::MovieSystem>(*mSoundSystem);
        // mStartedSystems.emplace_back(StartSystem("movie.c", 0x101F1090, TigShutdownNoop));
        // NOTE: WFT -> UiManager
        // TODO mStartedSystems.emplace_back(StartSystem("wft.c", 0x101F98A0, 0x101F9770));

        // TODO mStartedSystems.emplace_back(StartSystem("font.c", 0x101EAEC0, 0x101EA140));
        Fonts = new TigFonts();
        Fonts.LoadAllFrom("art/arial-10");
        Fonts.PushFont("arial-10", 10);

        // TODO mConsole = std::make_unique<Console>();
        // mStartedSystems.emplace_back(StartSystem("console.c", 0x101E0290, 0x101DFBC0));
        Console = new TigConsole(DynamicScripting);
        // TODO mStartedSystems.emplace_back(StartSystem("loadscreen.c", 0x101E8260, TigShutdownNoop));

        // TODO *tigInternal.consoleDisabled = false; // tig init disables console by default
    }
Exemplo n.º 7
0
 public LightningBoltRenderer(RenderingDevice device, MdfMaterialFactory materialFactory, PerlinNoise noise)
     : base(device, materialFactory, noise, MaxLineSegments, "LightningBolt")
 {
     InitVertices(Vector3.UnitY);
 }
 public CallLightningRenderer(RenderingDevice device, MdfMaterialFactory materialFactory, PerlinNoise noise)
     : base(device, materialFactory, noise, LineSegments, "CallLightning")
 {
     // This is the normal that vanilla used. Since lightning is not lit, the normal doesn't really matter
     InitVertices(new Vector3(MathF.Sqrt(0.5f), 0, MathF.Sqrt(0.5f)));
 }