Documentation ¶
Index ¶
- Constants
- func BuildCameraMaskDepthBuffer(roomImageOutput *fileio.RoomImageOutput, cameraMasks []fileio.MaskRectangle, ...) []float32
- func BuildEnvironmentLight(light fileio.LITCameraLight) [3]float32
- func BuildSpriteTexture(spriteData fileio.SpriteData) []uint32
- func BuildTexture(imagePixels []uint16, imageWidth int32, imageHeight int32) uint32
- func NewTextureTIM(timOutput *fileio.TIMOutput) uint32
- func RenderAnimatedEntity(programShader uint32, playerEntity PlayerEntity, timeElapsedSeconds float64)
- func RenderCameraSwitches(programShader uint32, cameraSwitchDebugEntity *DebugEntity)
- func RenderDebugEntities(programShader uint32, debugEntities []*DebugEntity)
- func RenderSprites(programShader uint32, spriteGroupEntity *SpriteGroupEntity, ...)
- func UpdateTexture(texId uint32, imagePixels []uint16, imageWidth int32, imageHeight int32)
- func UpdateTextureADT(texId uint32, adtOutput *fileio.ADTOutput)
- type Animation
- type Camera
- type ComponentOffsets
- type DebugEntities
- type DebugEntity
- func BuildAllDebugEntities(gameWorld *world.GameWorld) []*DebugEntity
- func NewAotTriggerDebugEntity(aotTriggers []world.AotObject) *DebugEntity
- func NewCameraSwitchDebugEntity(curCameraId int, cameraSwitches []fileio.RVDHeader, ...) *DebugEntity
- func NewCollisionDebugEntity(collisionEntities []fileio.CollisionEntity) *DebugEntity
- func NewDoorTriggerDebugEntity(doors []world.AotDoor) *DebugEntity
- func NewItemTriggerDebugEntity(items []world.AotItem) *DebugEntity
- func NewSlopedSurfacesDebugEntity(collisionEntities []fileio.CollisionEntity) *DebugEntity
- type HealthECGView
- type Image16Bit
- func (image16bit *Image16Bit) ApplyMask(destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle)
- func (image16bit *Image16Bit) Clear()
- func (image16bit *Image16Bit) FillPixels(destOrigin image.Point, sourceBounds image.Rectangle, fillColor color.RGBA)
- func (image16bit *Image16Bit) GetHeight() int
- func (image16bit *Image16Bit) GetPixelsForRendering() []uint16
- func (image16bit *Image16Bit) GetWidth() int
- func (image16bit *Image16Bit) WriteSubImage(destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle)
- func (image16bit *Image16Bit) WriteSubImageUniformBrightness(destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle, ...)
- func (image16bit *Image16Bit) WriteSubImageVariableBrightness(destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle, ...)
- type InventoryItem
- type ItemGroupEntity
- type PlayerEntity
- type RenderDef
- func (renderDef *RenderDef) AddSprite(sprite fileio.ScriptInstrSceEsprOn)
- func (renderDef *RenderDef) GenerateInventoryImage(inventoryMenuImages []*Image16Bit, inventoryItemImages []*Image16Bit, ...)
- func (renderDef *RenderDef) GenerateSaveScreenImage(saveScreenImage *Image16Bit)
- func (r *RenderDef) GetPerspectiveMatrix(fovDegrees float32) mgl32.Mat4
- func (r *RenderDef) RenderBackground()
- func (r *RenderDef) RenderFrame(playerEntity PlayerEntity, debugEntities DebugEntities, ...)
- func (r *RenderDef) RenderSceneEntity(entity *SceneEntity, renderType int32)
- func (renderDef *RenderDef) RenderSolidVideoBuffer()
- func (r *RenderDef) RenderStaticEntity(entity SceneMD1Entity, renderType int32)
- func (r *RenderDef) RenderSurface2D(surface *Surface2D)
- func (renderDef *RenderDef) RenderTransparentVideoBuffer()
- func (renderDef *RenderDef) SetItemEntity(instruction fileio.ScriptInstrObjModelSet)
- func (renderDef *RenderDef) UpdateMainMenu(menuBackgroundImage *Image16Bit, menuTextImages []*Image16Bit, ...)
- func (renderDef *RenderDef) UpdateSpecialMenu(menuBackgroundImage *Image16Bit, menuTextImages []*Image16Bit, ...)
- type RenderRoom
- type SceneEntity
- func (entity *SceneEntity) DeleteSceneEntity()
- func (entity *SceneEntity) SetMesh(vertexBuffer []float32)
- func (entity *SceneEntity) SetTexture(imagePixels []uint16, imageWidth int32, imageHeight int32)
- func (cameraMaskImageEntity *SceneEntity) UpdateCameraImageMaskEntity(renderDef *RenderDef, roomOutput *fileio.RoomImageOutput, ...)
- func (entity *SceneEntity) UpdateSurface(newImagePixels []uint16, imageWidth int32, imageHeight int32)
- type SceneMD1Entity
- type Shader
- type SpriteGroupEntity
- type Surface2D
Constants ¶
View Source
const ( RENDER_TYPE_ENTITY = 3 VERTEX_LEN = 8 )
View Source
const ( CAMERA_MASK_WIDTH = 256 CAMERA_MASK_HEIGHT = 256 BACKGROUND_IMAGE_WIDTH = 320 BACKGROUND_IMAGE_HEIGHT = 240 )
View Source
const ( ITEMLIST_POS_X = 220 ITEMLIST_POS_Y = 70 )
View Source
const ( HEALTH_FINE = 0 HEALTH_YELLOW_CAUTION = 1 HEALTH_ORANGE_CAUTION = 2 HEALTH_DANGER = 3 HEALTH_POISON = 4 HEALTH_POS_X = 58 HEALTH_POS_Y = 29 )
View Source
const ( RENDER_GAME_STATE_MAIN = 0 RENDER_GAME_STATE_BACKGROUND_SOLID = 1 RENDER_GAME_STATE_BACKGROUND_TRANSPARENT = 2 RENDER_TYPE_ITEM = 5 )
View Source
const ( RENDER_TYPE_SPRITE = 4 SPRITE_FRAME_TIME = 0.5 // in seconds )
View Source
const ( IMAGE_SURFACE_WIDTH = 320 IMAGE_SURFACE_HEIGHT = 240 )
View Source
const (
ANIMATION_FRAME_TIME = 30 // time in milliseconds
)
View Source
const (
RENDER_TYPE_DEBUG = -1
)
Variables ¶
This section is empty.
Functions ¶
func BuildCameraMaskDepthBuffer ¶
func BuildCameraMaskDepthBuffer(roomImageOutput *fileio.RoomImageOutput, cameraMasks []fileio.MaskRectangle, renderDef *RenderDef) []float32
func BuildEnvironmentLight ¶
func BuildEnvironmentLight(light fileio.LITCameraLight) [3]float32
func BuildSpriteTexture ¶
func BuildSpriteTexture(spriteData fileio.SpriteData) []uint32
Each sprite id has its own texture Build a texture for each frame
func BuildTexture ¶
func NewTextureTIM ¶
func RenderAnimatedEntity ¶
func RenderAnimatedEntity(programShader uint32, playerEntity PlayerEntity, timeElapsedSeconds float64)
func RenderCameraSwitches ¶
func RenderCameraSwitches(programShader uint32, cameraSwitchDebugEntity *DebugEntity)
func RenderDebugEntities ¶
func RenderDebugEntities(programShader uint32, debugEntities []*DebugEntity)
func RenderSprites ¶
func RenderSprites(programShader uint32, spriteGroupEntity *SpriteGroupEntity, timeElapsedSeconds float64)
func UpdateTexture ¶
func UpdateTextureADT ¶
Types ¶
type Animation ¶
type Animation struct { TotalTime float64 FrameIndex int // index in AnimationIndexFrames FrameNumber int // corresponds to 1 frame id in the animation loop CurPose int }
func NewAnimation ¶
func NewAnimation() *Animation
type Camera ¶
type Camera struct { CameraFrom mgl32.Vec3 CameraTo mgl32.Vec3 CameraUp mgl32.Vec3 CameraFov float32 }
func (*Camera) BuildViewMatrix ¶
func (*Camera) GetDirection ¶
type ComponentOffsets ¶
Offset in vertex buffer
type DebugEntities ¶
type DebugEntities struct { CameraSwitchDebugEntity *DebugEntity DebugEntities []*DebugEntity }
type DebugEntity ¶
type DebugEntity struct { Color [4]float32 VertexBuffer []float32 VertexArrayObject uint32 VertexBufferObject uint32 }
func BuildAllDebugEntities ¶
func BuildAllDebugEntities(gameWorld *world.GameWorld) []*DebugEntity
func NewAotTriggerDebugEntity ¶
func NewAotTriggerDebugEntity(aotTriggers []world.AotObject) *DebugEntity
func NewCollisionDebugEntity ¶
func NewCollisionDebugEntity(collisionEntities []fileio.CollisionEntity) *DebugEntity
func NewDoorTriggerDebugEntity ¶
func NewDoorTriggerDebugEntity(doors []world.AotDoor) *DebugEntity
func NewItemTriggerDebugEntity ¶
func NewItemTriggerDebugEntity(items []world.AotItem) *DebugEntity
func NewSlopedSurfacesDebugEntity ¶
func NewSlopedSurfacesDebugEntity(collisionEntities []fileio.CollisionEntity) *DebugEntity
type HealthECGView ¶
func NewHealthECGDanger ¶
func NewHealthECGDanger() HealthECGView
func NewHealthECGFine ¶
func NewHealthECGFine() HealthECGView
func NewHealthECGOrangeCaution ¶
func NewHealthECGOrangeCaution() HealthECGView
func NewHealthECGPoison ¶
func NewHealthECGPoison() HealthECGView
func NewHealthECGYellowCaution ¶
func NewHealthECGYellowCaution() HealthECGView
type Image16Bit ¶
type Image16Bit struct {
// contains filtered or unexported fields
}
func BuildCameraMask ¶
func BuildCameraMask(roomImageOutput *fileio.RoomImageOutput, cameraMasks []fileio.MaskRectangle) *Image16Bit
func ConvertPixelsToImage16Bit ¶
func ConvertPixelsToImage16Bit(sourcePixels [][]uint16) *Image16Bit
func NewImage16Bit ¶
func NewImage16Bit(x int, y int, width int, height int) *Image16Bit
func (*Image16Bit) ApplyMask ¶
func (image16bit *Image16Bit) ApplyMask( destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle, )
func (*Image16Bit) Clear ¶
func (image16bit *Image16Bit) Clear()
func (*Image16Bit) FillPixels ¶
func (*Image16Bit) GetHeight ¶
func (image16bit *Image16Bit) GetHeight() int
func (*Image16Bit) GetPixelsForRendering ¶
func (image16bit *Image16Bit) GetPixelsForRendering() []uint16
OpenGL renderer uses a 1d array to render pixels to screen
func (*Image16Bit) GetWidth ¶
func (image16bit *Image16Bit) GetWidth() int
func (*Image16Bit) WriteSubImage ¶
func (image16bit *Image16Bit) WriteSubImage( destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle, )
func (*Image16Bit) WriteSubImageUniformBrightness ¶
func (image16bit *Image16Bit) WriteSubImageUniformBrightness( destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle, factor float64, )
Multiply pixels by a brightness factor Less than 1.0 will darken it
func (*Image16Bit) WriteSubImageVariableBrightness ¶
func (image16bit *Image16Bit) WriteSubImageVariableBrightness( destOrigin image.Point, sourceImage *Image16Bit, sourceBounds image.Rectangle, rgbFactor [3]float64, )
type InventoryItem ¶
func InitializeInventoryItems ¶
func InitializeInventoryItems() []InventoryItem
type ItemGroupEntity ¶
type ItemGroupEntity struct { ItemTextureData []*fileio.TIMOutput ItemModelData []*fileio.MD1Output ModelObjectData []*SceneMD1Entity }
func NewItemGroupEntity ¶
func NewItemGroupEntity() *ItemGroupEntity
type PlayerEntity ¶
type PlayerEntity struct { TextureId uint32 VertexBuffer []float32 PLDOutput *fileio.PLDOutput Player *game.Player AnimationPoseNumber int VertexArrayObject uint32 VertexBufferObject uint32 }
func NewPlayerEntity ¶
func NewPlayerEntity(pldOutput *fileio.PLDOutput) *PlayerEntity
func (*PlayerEntity) UpdatePlayerEntity ¶
func (playerEntity *PlayerEntity) UpdatePlayerEntity(player *game.Player, animationPoseNumber int)
type RenderDef ¶
type RenderDef struct { ProgramShader uint32 Camera *Camera ProjectionMatrix mgl32.Mat4 ViewMatrix mgl32.Mat4 EnvironmentLight [3]float32 WindowWidth int WindowHeight int VideoBuffer *Surface2D SpriteGroupEntity *SpriteGroupEntity BackgroundImageEntity *SceneEntity CameraMaskEntity *SceneEntity ItemGroupEntity *ItemGroupEntity }
func InitRenderer ¶
func (*RenderDef) AddSprite ¶
func (renderDef *RenderDef) AddSprite(sprite fileio.ScriptInstrSceEsprOn)
func (*RenderDef) GenerateInventoryImage ¶
func (renderDef *RenderDef) GenerateInventoryImage( inventoryMenuImages []*Image16Bit, inventoryItemImages []*Image16Bit, inventoryMenu *gui.InventoryMenu, timeElapsedSeconds float64, )
func (*RenderDef) GenerateSaveScreenImage ¶
func (renderDef *RenderDef) GenerateSaveScreenImage(saveScreenImage *Image16Bit)
func (*RenderDef) GetPerspectiveMatrix ¶
func (*RenderDef) RenderBackground ¶
func (r *RenderDef) RenderBackground()
func (*RenderDef) RenderFrame ¶
func (r *RenderDef) RenderFrame(playerEntity PlayerEntity, debugEntities DebugEntities, timeElapsedSeconds float64)
func (*RenderDef) RenderSceneEntity ¶
func (r *RenderDef) RenderSceneEntity(entity *SceneEntity, renderType int32)
func (*RenderDef) RenderSolidVideoBuffer ¶
func (renderDef *RenderDef) RenderSolidVideoBuffer()
func (*RenderDef) RenderStaticEntity ¶
func (r *RenderDef) RenderStaticEntity(entity SceneMD1Entity, renderType int32)
func (*RenderDef) RenderSurface2D ¶
func (*RenderDef) RenderTransparentVideoBuffer ¶
func (renderDef *RenderDef) RenderTransparentVideoBuffer()
func (*RenderDef) SetItemEntity ¶
func (renderDef *RenderDef) SetItemEntity(instruction fileio.ScriptInstrObjModelSet)
func (*RenderDef) UpdateMainMenu ¶
func (renderDef *RenderDef) UpdateMainMenu( menuBackgroundImage *Image16Bit, menuTextImages []*Image16Bit, mainMenuOption int, )
func (*RenderDef) UpdateSpecialMenu ¶
func (renderDef *RenderDef) UpdateSpecialMenu( menuBackgroundImage *Image16Bit, menuTextImages []*Image16Bit, mainMenuOption int, )
type RenderRoom ¶
type RenderRoom struct { CameraMaskData [][]fileio.MaskRectangle LightData []fileio.LITCameraLight ItemTextureData []*fileio.TIMOutput ItemModelData []*fileio.MD1Output SpriteData []fileio.SpriteData }
func NewRenderRoom ¶
func NewRenderRoom(rdtOutput *fileio.RDTOutput) RenderRoom
type SceneEntity ¶
type SceneEntity struct { TextureId uint32 // texture id in OpenGL VertexBuffer []float32 // 3 elements for x,y,z and 2 elements for texture u,v VertexArrayObject uint32 VertexBufferObject uint32 }
func NewBackgroundImageEntity ¶
func NewBackgroundImageEntity() *SceneEntity
func NewSceneEntity ¶
func NewSceneEntity() *SceneEntity
func (*SceneEntity) DeleteSceneEntity ¶
func (entity *SceneEntity) DeleteSceneEntity()
func (*SceneEntity) SetMesh ¶
func (entity *SceneEntity) SetMesh(vertexBuffer []float32)
func (*SceneEntity) SetTexture ¶
func (entity *SceneEntity) SetTexture(imagePixels []uint16, imageWidth int32, imageHeight int32)
func (*SceneEntity) UpdateCameraImageMaskEntity ¶
func (cameraMaskImageEntity *SceneEntity) UpdateCameraImageMaskEntity( renderDef *RenderDef, roomOutput *fileio.RoomImageOutput, cameraMasks []fileio.MaskRectangle)
func (*SceneEntity) UpdateSurface ¶
func (entity *SceneEntity) UpdateSurface(newImagePixels []uint16, imageWidth int32, imageHeight int32)
type SceneMD1Entity ¶
type SceneMD1Entity struct { TextureId uint32 // texture id in OpenGL VertexBuffer []float32 // 3 elements for x,y,z, 2 elements for texture u,v, and 3 elements for normal x,y,z ModelPosition mgl32.Vec3 // Position in world space RotationAngle float32 VertexArrayObject uint32 VertexBufferObject uint32 }
type SpriteGroupEntity ¶
type SpriteGroupEntity struct { SpriteTextureIndexMap map[int]int TextureIdPool [][]uint32 VertexBuffer []float32 VertexArrayObject uint32 VertexBufferObject uint32 }
func NewSpriteGroupEntity ¶
func NewSpriteGroupEntity(spriteData []fileio.SpriteData) *SpriteGroupEntity
type Surface2D ¶
type Surface2D struct { TextureId uint32 // texture id in OpenGL VertexBuffer []float32 // 3 elements for x,y,z and 2 elements for texture u,v VertexArrayObject uint32 VertexBufferObject uint32 }
func NewSurface2D ¶
func NewSurface2D() *Surface2D
func (*Surface2D) UpdateSurface ¶
func (surface *Surface2D) UpdateSurface(newImage *Image16Bit)
Click to show internal directories.
Click to hide internal directories.