utility

package module
v0.0.0-...-2ec6270 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LIGHT_DIRECTIONAL int32 = iota
	LIGHT_POINT
	LIGHT_SPOT
)

Variables

View Source
var MaxLights = 5
View Source
var ShaderFile sh.Shaders = sh.NewShader()

Functions

func Cobineshader

func Cobineshader() rl.Shader

Types

type AxisCamera

type AxisCamera int8
const (
	AxisCameraX AxisCamera = iota
	AxisCameraY
	AxisCameraZ
)

type ControllerModel

type ControllerModel struct {
	Model          *rl.Model
	Body           *ode.Body
	ModelPosition  *rl.Vector3
	ModelAnimation []rl.ModelAnimation

	CameraPosition *rl.Vector3

	OnceStatus bool

	CounterFrame int32
	Scale        float64
	// contains filtered or unexported fields
}

func (*ControllerModel) AddCollisionByBody

func (con *ControllerModel) AddCollisionByBody(body *ode.Body, kinematic bool, boneId int, scaleSize float32)

func (*ControllerModel) CameraTargetLockTheModel

func (con *ControllerModel) CameraTargetLockTheModel(camera *rl.Camera)

func (*ControllerModel) DefaultLoopAnimtion

func (con *ControllerModel) DefaultLoopAnimtion(indexAnimation, speed int32)

inside loop for run DefaultAnimtion

func (*ControllerModel) DrawModelControll

func (con *ControllerModel) DrawModelControll(rotationAxis rl.Vector3, rotationAngle float32, scale rl.Vector3, color rl.Color)

func (*ControllerModel) DrawSkeletAnimtion

func (con *ControllerModel) DrawSkeletAnimtion(scaleSize float32)

func (*ControllerModel) DrawSkeletBindPose

func (con *ControllerModel) DrawSkeletBindPose(scaleSize float32)

func (*ControllerModel) EnableDefaultAnimtion

func (con *ControllerModel) EnableDefaultAnimtion()

use inside rl.IsKeyReleased(...) if you want enable defualtAnimtion

func (*ControllerModel) FrameCountRest

func (con *ControllerModel) FrameCountRest()

func (*ControllerModel) GetBoneAnimtionTranslation

func (con *ControllerModel) GetBoneAnimtionTranslation(boneId int, scaleSize float32) rl.Vector3

func (*ControllerModel) GetBoneBindPoseTranslation

func (con *ControllerModel) GetBoneBindPoseTranslation(boneId int, scaleSize float32) rl.Vector3

func (*ControllerModel) GetStatusEnableDefaultAnimtion

func (con *ControllerModel) GetStatusEnableDefaultAnimtion() bool

func (*ControllerModel) Init

func (con *ControllerModel) Init(model *rl.Model, body *ode.Body, modelAnimation []rl.ModelAnimation, modelPosition, cameraPosition *rl.Vector3, scaleModel float64, enableDefaultAnimtion bool)

ModelPosition set the drawModel for postion

func (*ControllerModel) JointModelPostionAndDraw

func (con *ControllerModel) JointModelPostionAndDraw(model *rl.Model, boneId int, scaleSizeBone, scale float32, color rl.Color)

func (*ControllerModel) Move

func (con *ControllerModel) Move(indexAnimation int32, speedFrame int32, axisCamera AxisCamera, speedModelAndCamera rl.Vector2, angle rl.Vector3)

axisCamera is axis position and speedModelAndCamera x for camera speed and y for model speed you have to set just a angle

func (*ControllerModel) Once

func (con *ControllerModel) Once()

this is for everything that just once run you should by key event

func (*ControllerModel) OnceRun

func (con *ControllerModel) OnceRun(indexAnimation, speed int32)

inside loop for Once

func (*ControllerModel) SyncTransformTheModel

func (con *ControllerModel) SyncTransformTheModel(scale float64)

add inside loop RlStep ode

func (*ControllerModel) Unload

func (con *ControllerModel) Unload()

type Fog

type Fog struct {
	Shader *rl.Shader

	FogDensity float32
	// contains filtered or unexported fields
}

func (*Fog) AddTheMaterialToFog

func (fo *Fog) AddTheMaterialToFog(models []*rl.Material, textures []*rl.Texture2D)

func (*Fog) Init

func (fo *Fog) Init(ambient rl.Color, fogDensity float32)

fogDensity 0.0 -> 0.16

func (*Fog) SetCombineShader

func (fo *Fog) SetCombineShader(CombineShader *rl.Shader)

exce before init or set manually

func (*Fog) Unload

func (fo *Fog) Unload()

func (*Fog) Update

func (fo *Fog) Update(cameraPos rl.Vector3)

take inside loop

func (*Fog) UpdateFogDensity

func (fo *Fog) UpdateFogDensity(fogDensity float32)

type Instances

type Instances struct {
	MaxInstance int
	Matrixs     []rl.Matrix
	Material    rl.Material
}

func (*Instances) Draw

func (in *Instances) Draw(mesh rl.Mesh)

draw mesh

func (*Instances) InitInstance

func (in *Instances) InitInstance(shader rl.Shader)

init Instance and in the shader mat4 mvpi = mvp*instanceTransform; and finall gl_Position = mvpi*vec4(vertexPosition, 1.0);

func (*Instances) SetValueToMatrix

func (in *Instances) SetValueToMatrix(iteam int32, translate, angle, scale rl.Vector3)

use loop and MaxInstance for dynamic

type Light

type Light struct {
	Shader rl.Shader
	// contains filtered or unexported fields
}

func (*Light) DisableLight

func (lt *Light) DisableLight(light *Light)

func (*Light) DrawSpherelight

func (lt *Light) DrawSpherelight(light *Light)

func (*Light) EnableLight

func (lt *Light) EnableLight(light *Light)

func (*Light) Init

func (lt *Light) Init(ambientStrength float32, ambientColor rl.Vector3)

func (*Light) NewLight

func (lt *Light) NewLight(
	lightType LightType,
	position, direction rl.Vector3,
	color rl.Color,
	enargy float32, shader *rl.Shader) Light

func (*Light) SetCombineShader

func (lt *Light) SetCombineShader(CombineShader *rl.Shader)

exce before init or set manually

func (*Light) SetConfigPointLight

func (lt *Light) SetConfigPointLight(light *Light, constant, linear, quadratic float32)

func (*Light) SetConfigShiness

func (lt *Light) SetConfigShiness(light *Light, shiny, specularStr float32)

func (*Light) SetConfigSpotLight

func (lt *Light) SetConfigSpotLight(light *Light, cutOff, outerCutOff float32)

func (*Light) SetFlashlightTexture

func (lt *Light) SetFlashlightTexture(materials []*rl.Material, texure *rl.Texture2D)

func (*Light) SetMaterialTexture

func (lt *Light) SetMaterialTexture(materials []*rl.Material, texture []*rl.Texture2D)

func (*Light) SetMaxLight

func (lt *Light) SetMaxLight(max int)

if you want more 5 light in the light.fs change #define MAX_LIGHTS "your number"

func (*Light) Unload

func (lt *Light) Unload()

func (*Light) UpdateReflect

func (lt *Light) UpdateReflect(cameraPos rl.Vector3)

func (*Light) UpdateValues

func (lt *Light) UpdateValues()

type LightType

type LightType int32
const (
	LightTypeDirectional LightType = iota
	LightTypePoint
	LightTypeSpot
)

type Lights2d

type Lights2d struct {
	Shader        *rl.Shader
	Postion       rl.Vector2
	LightRadius   float32
	AmbientStrong float32
	AmbientColor  rl.Color
	// contains filtered or unexported fields
}

func (*Lights2d) PointLight

func (li *Lights2d) PointLight(texture *rl.Texture2D, position rl.Vector2, scale float32, color []color.RGBA)

you have to use Fade -> []color.RGBA{rl.Fade(rl.Yellow,0.3)

func (*Lights2d) SpotLightDraw

func (li *Lights2d) SpotLightDraw()

func (*Lights2d) SpotLightInit

func (li *Lights2d) SpotLightInit(lightRadius, ambientStrong float32, ambientColor rl.Color)

func (*Lights2d) Unload

func (li *Lights2d) Unload()

func (*Lights2d) UpdateOptions

func (li *Lights2d) UpdateOptions(lightRadius, ambientStrong float32, ambientColor rl.Color)

func (*Lights2d) UpdatePosition

func (li *Lights2d) UpdatePosition(pos rl.Vector2)

type Mask

type Mask struct {
	Shader *rl.Shader
	// contains filtered or unexported fields
}

func (*Mask) Init

func (ma *Mask) Init()

func (*Mask) SetMapDiffuse

func (ma *Mask) SetMapDiffuse(materials []*rl.Material, textures []*rl.Texture2D)

func (*Mask) SetMapEmission

func (ma *Mask) SetMapEmission(materials []*rl.Material, texturesMask []*rl.Texture2D)

func (*Mask) Unload

func (ma *Mask) Unload()

func (*Mask) UpdateAnimation

func (ma *Mask) UpdateAnimation(x int)

take inside loop

type OutLine

type OutLine struct {
	Shader *rl.Shader
	// contains filtered or unexported fields
}

func (*OutLine) Init

func (out *OutLine) Init(texture *rl.Texture2D, outlineSize float32, outlineColor rl.Color)

use BeginShaderMode for draw texture

func (*OutLine) OutLineColor

func (out *OutLine) OutLineColor(outlineColor rl.Color)

func (*OutLine) OutLineSize

func (out *OutLine) OutLineSize(size float32)

func (*OutLine) Unload

func (out *OutLine) Unload()

type Particle

type Particle struct {
	Position           rl.Vector3
	PositionInTheWorld rl.Vector3
	Speed              rl.Vector3
	Color              rl.Color
	Lifetime           float32
	Particles          []Particle
	MaxParticles       int32
	CircleParicleSpeed float32
	Oneshot            bool
}

func (*Particle) DrawCircleParicle

func (pa *Particle) DrawCircleParicle(speed float32, model *rl.Model, texture *rl.Texture2D, position, rotationAxis, scale rl.Vector3)

func (*Particle) DrawParticles

func (pa *Particle) DrawParticles(model *rl.Model, texture *rl.Texture2D, scale rl.Vector3)

func (*Particle) DrawParticles2dCircle

func (pa *Particle) DrawParticles2dCircle(radius float32)

func (*Particle) DrawParticles2dTexture

func (pa *Particle) DrawParticles2dTexture(texture *rl.Texture2D)

func (*Particle) DrawParticlesBilborid

func (pa *Particle) DrawParticlesBilborid(cam *rl.Camera, texture *rl.Texture2D, size float32)

func (*Particle) InitializeParticles

func (pa *Particle) InitializeParticles(max int, position, speed rl.Vector3, lifetimeMin, lifetimeMax int32, colorRandom bool)

The color Random set manually Color Option unless not show anything if you choose false.

func (*Particle) UpdateParticles

func (pa *Particle) UpdateParticles(speed rl.Vector3, lifetimeMin, lifetimeMax int32)

type PhysicRender

type PhysicRender struct {
	Shader *rl.Shader
	// contains filtered or unexported fields
}

func (*PhysicRender) AlbedoColorModel

func (ph *PhysicRender) AlbedoColorModel(model *rl.Model, color rl.Color)

func (*PhysicRender) AmbientColor

func (ph *PhysicRender) AmbientColor(colorAmbient rl.Vector3, ambientValue float32)

func (*PhysicRender) AoValue

func (ph *PhysicRender) AoValue(value float32)

func (*PhysicRender) CreateLight

func (ph *PhysicRender) CreateLight(typeLight int32, position rl.Vector3, target rl.Vector3, color rl.Color, intensity float32) light

func (*PhysicRender) DrawSphereLoctionLight

func (ph *PhysicRender) DrawSphereLoctionLight(li light, color rl.Color)

func (*PhysicRender) EmissiveColor

func (ph *PhysicRender) EmissiveColor(color rl.Color)

func (*PhysicRender) EmissivePower

func (ph *PhysicRender) EmissivePower(value float32)

func (*PhysicRender) Init

func (ph *PhysicRender) Init()

make light and pbr Shader

func (*PhysicRender) MaxLights

func (ph *PhysicRender) MaxLights(value int)

func (*PhysicRender) MetallicValue

func (ph *PhysicRender) MetallicValue(value float32)

func (*PhysicRender) NormalValue

func (ph *PhysicRender) NormalValue(value float32)

func (*PhysicRender) RoughnessValue

func (ph *PhysicRender) RoughnessValue(value float32)

func (*PhysicRender) SetCombineShader

func (ph *PhysicRender) SetCombineShader(CombineShader *rl.Shader)

exce before init or set manually

func (*PhysicRender) SetOffset

func (ph *PhysicRender) SetOffset(value rl.Vector2)

func (*PhysicRender) SetOffsetFlashlight

func (ph *PhysicRender) SetOffsetFlashlight(value rl.Vector2)

func (*PhysicRender) SetTiling

func (ph *PhysicRender) SetTiling(value rl.Vector2)

func (*PhysicRender) SetTilingFlashlight

func (ph *PhysicRender) SetTilingFlashlight(value rl.Vector2)

func (*PhysicRender) TextureMapAlbedo

func (ph *PhysicRender) TextureMapAlbedo(modelMaterials *rl.Material, texture rl.Texture2D)

func (*PhysicRender) TextureMapMetalness

func (ph *PhysicRender) TextureMapMetalness(modelMaterials *rl.Material, texture rl.Texture2D)

func (*PhysicRender) TextureMapNormal

func (ph *PhysicRender) TextureMapNormal(modelMaterials *rl.Material, texture rl.Texture2D)

func (*PhysicRender) TextureMapOcclusion

func (ph *PhysicRender) TextureMapOcclusion(modelMaterials *rl.Material, texture rl.Texture2D)

func (*PhysicRender) TextureMapRoughness

func (ph *PhysicRender) TextureMapRoughness(modelMaterials *rl.Material, texture rl.Texture2D)

func (*PhysicRender) Unload

func (ph *PhysicRender) Unload()

func (*PhysicRender) UpadteByCamera

func (ph *PhysicRender) UpadteByCamera(pos rl.Vector3)

func (*PhysicRender) UpdateLight

func (ph *PhysicRender) UpdateLight(Shader rl.Shader, light light)

func (*PhysicRender) UseTexAlbedo

func (ph *PhysicRender) UseTexAlbedo()

func (*PhysicRender) UseTexEmissive

func (ph *PhysicRender) UseTexEmissive()

func (*PhysicRender) UseTexMRA

func (ph *PhysicRender) UseTexMRA()

func (*PhysicRender) UseTexNormal

func (ph *PhysicRender) UseTexNormal()

type SkyBox

type SkyBox struct {
	// contains filtered or unexported fields
}

func (*SkyBox) Draw

func (sky *SkyBox) Draw()

func (*SkyBox) Init

func (sky *SkyBox) Init(doGamma, vflipped bool, file string)

func (*SkyBox) Unload

func (sky *SkyBox) Unload()

type Wave

type Wave struct {
	Shader     *rl.Shader
	ScreenSize rl.Vector2
	Seconds    float32
	SecondsLoc int32
	FreqXLoc   int32
	FreqYLoc   int32
	AmpXLoc    int32
	AmpYLoc    int32
	SpeedXLoc  int32
	SpeedYLoc  int32
}

func (*Wave) Init

func (wa *Wave) Init(materals []*rl.Material, texture []*rl.Texture2D)

func (*Wave) InitFor2D

func (wa *Wave) InitFor2D()

func (*Wave) Unload

func (wa *Wave) Unload()

func (*Wave) UpdateOptions

func (wa *Wave) UpdateOptions(freqX, freqY, ampX, ampY, speedX, speedY float32)

func (*Wave) UpdateWave

func (wa *Wave) UpdateWave()

use in the loop

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL