Class PageContentBridge
- Namespace
- GrindFest
- Assembly
- GrindFest.dll
Bridge between BookController and OneJS for rendering book page content. Creates 4 RenderTexture-targeted UIDocuments matching EndlessBook's material slots:
- Left: BookPageLeft (left page in OpenMiddle)
- Right: BookPageRight (right page in OpenMiddle)
- Front: BookPageFront (front of turning page / right side in OpenFront / cover when closed)
- Back: BookPageBack (back of turning page)
public class PageContentBridge : MonoBehaviour
- Inheritance
-
objectPageContentBridge
Fields
- pageUVWidth
The U range [0..pageUVWidth] the page mesh UVs cover. EndlessBook's page mesh only uses ~80.4% of the texture width — the rest is never sampled. Setting this scales the page material so the entire RT fills the visible page area. Measure from the mesh: SubMesh UV U max = ~0.804.
Properties
- CoverPageMaterial
Dedicated cover material (backed by a static RT copy of the cover). Null until CaptureCoverFromFrontRT() is called after the first RenderCover. Falls back to FrontPageMaterial if not yet captured.
- CoverRendered
Whether the front RT currently shows the cover.
Methods
- CaptureCoverFromFrontRT()
Copy the current Front RT content (which should have the cover) into a dedicated cover RT. This creates a permanent cover material that doesn't change when the Front RT switches to page content. Must be called after UIToolkit has rendered the cover into Front RT (1-frame delay).
- ClearPages()
Clear all displayed pages when book is destroyed.
- OpenBook(string, string)
Open a book by ID. Queries JS registry for page count.
- RenderCover()
Render the cover into the front RT. Called when book is in closed state.
- ShowPages(int, int)
Set which pages are currently visible on the left/right spread. Also renders page 1 into front RT for OpenFront state.
- ShowTurningPages(int, int)
Set which pages show on the front/back of a turning page. Called at page turn start.