# D3DService.DLL

## Origin
**Entirely new** — no corresponding code in the old source tree.
Provides a higher-level 3D graphics API that plugins can use to render 3D objects
in the game world (meshes, 3D text, transformed geometry).

## Binary Facts
- Size: **262 KB** (the largest of the new native modules)
- Type: COM in-process server (DLL)
- Standard 4 COM exports: `DllCanUnloadNow`, `DllGetClassObject`, `DllRegisterServer`, `DllUnregisterServer`

## Key Imports
| DLL | Functions |
|-----|-----------|
| **Inject.DLL** | `BeginSceneO`, `EndSceneO` |
| **d3dx9_30.dll** | `D3DXCreateRenderToSurface`, `D3DXLoadMeshFromXResource`, `D3DXLoadMeshFromXW`, `D3DXCreateTextW`, `D3DXMatrixTranslation`, `D3DXMatrixRotationY`, and others |

## What It Does
- Loads `.x` mesh files (from resources or from disk)
- Creates 3D text geometry
- Performs matrix transforms (translation, rotation)
- Renders to off-screen surfaces
- Essentially a "3D drawing toolkit" layered on top of Inject's scene hooks

## Reconstruction Notes
- **LOOK AT:** `Managed/Decal.Interop.D3DService/` for the COM interface definitions
  this DLL must implement. That directory contains **8 decompiled C# files**.
- There is **no old source** to reference. This must be reimplemented from:
  1. The COM interfaces defined in the interop assembly
  2. Knowledge of the D3DX9 API calls it makes
  3. Understanding of how `BeginSceneO`/`EndSceneO` work (see `Native/Inject/`)
- This is the most complex new module to reconstruct due to its size and the
  lack of any prior source code.
