本文整理汇总了Golang中github.com/gazed/vu.Pov类的典型用法代码示例。如果您正苦于以下问题:Golang Pov类的具体用法?Golang Pov怎么用?Golang Pov使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pov类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: move
// Handle movement assuming there is a physics body associated with the camera.
// This attempts to smooth out movement by adding a higher initial velocity push
// and then capping movement once max accelleration is reached.
func (c *cam) move(bod vu.Pov, x, y, z float64, dir *lin.Q) {
if body := bod.Body(); body != nil {
boost := 40.0 // kick into high gear from stop.
maxAccel := 10.0 // limit accelleration.
sx, _, sz := body.Speed()
if x != 0 {
switch {
case sx == 0.0:
// apply push in the current direction.
dx, dy, dz := lin.MultSQ(x*boost, 0, 0, dir)
body.Push(dx, dy, dz)
case math.Abs(sx) < maxAccel && math.Abs(sz) < maxAccel:
dx, dy, dz := lin.MultSQ(x, 0, 0, dir)
body.Push(dx, dy, dz)
}
}
if z != 0 {
switch {
case sz == 0.0:
dx, dy, dz := lin.MultSQ(0, 0, z*boost, dir)
body.Push(dx, dy, dz)
case math.Abs(sx) < maxAccel && math.Abs(sz) < maxAccel:
dx, dy, dz := lin.MultSQ(0, 0, z, dir)
body.Push(dx, dy, dz)
}
}
} else {
bod.Move(x, y, z, dir)
}
}
开发者ID:kissthink,项目名称:bampf,代码行数:33,代码来源:cam.go
示例2: newPlayer
// newPlayer sets the player hud location and creates the white background.
func newPlayer(root vu.Pov, screenWidth, screenHeight int) *player {
pl := &player{}
pl.cx, pl.cy = 100, 100
pl.bg = root.NewPov().SetScale(110, 110, 1).SetLocation(pl.cx, pl.cy, 0)
pl.bg.NewModel("uv").LoadMesh("icon").AddTex("hudbg")
return pl
}
开发者ID:kissthink,项目名称:bampf,代码行数:8,代码来源:hud.go
示例3: newCube
// newCube's are often started with 1 corner, 2 edges, or 4 bottom side pieces.
func newCube(tr vu.Pov, x, y, z, cubeSize float64) *cube {
c := &cube{}
c.part = tr.NewPov()
c.cells = []vu.Pov{}
c.cx, c.cy, c.cz, c.csize = x, y, z, cubeSize
c.ccnt, c.cmax = 0, 8
c.mergec = func() { c.merge() }
c.trashc = func() { c.trash() }
c.addc = func() { c.addCell() }
c.remc = func() { c.removeCell() }
// calculate the cell center locations (unsorted)
qs := c.csize * 0.25
c.centers = csort{
&lin.V3{X: x - qs, Y: y - qs, Z: z - qs},
&lin.V3{X: x - qs, Y: y - qs, Z: z + qs},
&lin.V3{X: x - qs, Y: y + qs, Z: z - qs},
&lin.V3{X: x - qs, Y: y + qs, Z: z + qs},
&lin.V3{X: x + qs, Y: y - qs, Z: z - qs},
&lin.V3{X: x + qs, Y: y - qs, Z: z + qs},
&lin.V3{X: x + qs, Y: y + qs, Z: z - qs},
&lin.V3{X: x + qs, Y: y + qs, Z: z + qs},
}
return c
}
开发者ID:skyview059,项目名称:vu,代码行数:26,代码来源:sg.go
示例4: newMinimap
// newMinimap initializes the minimap. It still needs to be populated.
func newMinimap(root vu.Pov, numTroops int) *minimap {
mm := &minimap{}
mm.radius = 120
mm.scale = 5.0
mm.cores = []vu.Pov{}
mm.view = root.NewView()
mm.view.SetUI()
mm.view.SetCull(vu.NewRadiusCull(float64(mm.radius)))
mm.cam = mm.view.Cam()
mm.cam.SetTransform(vu.XZ_XY)
// create the parent for all the visible minimap pieces.
mm.part = root.NewPov().SetLocation(float64(mm.x), 0, float64(-mm.y))
// add the white background.
mm.bg = mm.part.NewPov().SetScale(110, 1, 110)
mm.bg.NewModel("uv").LoadMesh("icon_xz").AddTex("hudbg")
// create the sentinel position markers
mm.spms = []vu.Pov{}
for cnt := 0; cnt < numTroops; cnt++ {
tpm := mm.part.NewPov().SetScale(mm.scale, mm.scale, mm.scale)
tpm.NewModel("alpha").LoadMesh("square_xz").LoadMat("tred")
mm.spms = append(mm.spms, tpm)
}
// create the player marker and center map marker.
mm.cpm = mm.part.NewPov().SetScale(mm.scale, mm.scale, mm.scale)
mm.cpm.NewModel("alpha").LoadMesh("square_xz").LoadMat("blue")
mm.ppm = mm.part.NewPov().SetScale(mm.scale, mm.scale, mm.scale)
mm.ppm.NewModel("alpha").LoadMesh("tri_xz").LoadMat("tblack")
return mm
}
开发者ID:kissthink,项目名称:bampf,代码行数:34,代码来源:hud.go
示例5: newText
func (rl *rltag) newText(parent vu.Pov, gap int) vu.Model {
text := parent.NewPov().SetLocation(10, 0, float64(-rl.wh+40+gap*24))
text.Spin(-90, 0, 0) // orient to the X-Z plane.
m := text.NewModel("uv").AddTex("lucidiaSu16White").LoadFont("lucidiaSu16")
m.SetPhrase(" ")
return m
}
开发者ID:skyview059,项目名称:vu,代码行数:7,代码来源:rl.go
示例6: makePlayer
// makePlayer: the player is the camera... the player-trooper is used by the hud
// to show player status and as such this trooper is part of the hud scene.
func (lvl *level) makePlayer(root vu.Pov, levelNum int) *trooper {
player := newTrooper(root.NewPov(), levelNum)
player.part.Spin(15, 0, 0)
player.part.Spin(0, 15, 0)
player.setScale(100)
player.part.SetListener()
return player
}
开发者ID:kissthink,项目名称:bampf,代码行数:10,代码来源:level.go
示例7: createCore
// createCore makes the new core model.
// Create a core image using a single multi-texture shader.
func (cc *coreControl) createCore(root vu.Pov, fade float64) vu.Pov {
core := root.NewPov().SetScale(0.25, 0.25, 0.25)
model := core.NewModel("spinball").LoadMesh("billboard")
model.AddTex("ele").AddTex("ele").AddTex("halo").AddTex("halo")
model.SetAlpha(0.6)
model.SetUniform("fd", fade)
return core
}
开发者ID:kissthink,项目名称:bampf,代码行数:10,代码来源:core.go
示例8: energyLossEffect
// energyLossEffect creates the model shown when the player gets hit
// by a sentinel.
func (hd *hud) energyLossEffect(root vu.Pov) vu.Pov {
ee := root.NewPov()
ee.SetVisible(false)
m := ee.NewModel("uvra").LoadMesh("icon").AddTex("loss")
m.SetAlpha(0.5)
m.SetUniform("fd", 1000)
m.SetUniform("spin", 2.0)
return ee
}
开发者ID:kissthink,项目名称:bampf,代码行数:11,代码来源:hud.go
示例9: teleportEffect
// teleportEffect creates the model shown when the user teleports.
func (hd *hud) teleportEffect(root vu.Pov) vu.Pov {
te := root.NewPov()
te.SetVisible(false)
m := te.NewModel("uvra").LoadMesh("icon").AddTex("smoke")
m.SetAlpha(0.5)
m.SetUniform("spin", 10.0)
m.SetUniform("fd", 1000)
return te
}
开发者ID:kissthink,项目名称:bampf,代码行数:10,代码来源:hud.go
示例10: makeSphere
// makeSphere creates a sphere at the given x, y, z location and with
// the given r, g, b colour.
func (rc *rctag) makeSphere(parent vu.Pov, x, y, z float64, r, g, b float32) vu.Pov {
sz := 0.5
sp := parent.NewPov()
sp.NewBody(vu.NewSphere(sz))
sp.SetLocation(x, y, z)
sp.SetScale(sz, sz, sz)
model := sp.NewModel("solid").LoadMesh("sphere")
model.SetUniform("kd", r, g, b)
return sp
}
开发者ID:toophy,项目名称:vu,代码行数:12,代码来源:rc.go
示例11: makeSentries
// makeSentries creates some AI sentinels.
func (lvl *level) makeSentries(root vu.Pov, levelNum int) {
sentinels := []*sentinel{}
numSentinels := gameMuster[levelNum]
for cnt := 0; cnt < numSentinels; cnt++ {
sentry := newSentinel(root.NewPov(), levelNum, lvl.units, lvl.fade)
sentry.setScale(0.25)
sentinels = append(sentinels, sentry)
}
lvl.sentries = sentinels
}
开发者ID:kissthink,项目名称:bampf,代码行数:11,代码来源:level.go
示例12: newStartAnimation
// newStartAnimation creates the start screen animation.
func newStartAnimation(mp *bampf, parent vu.Pov, screenWidth, screenHeight int) *startAnimation {
sa := &startAnimation{}
sa.parent = parent
sa.scale = 200
sa.hilite = parent.NewPov()
sa.hilite.NewModel("alpha").LoadMesh("square").LoadMat("white")
sa.hilite.SetVisible(false)
sa.resize(screenWidth, screenHeight)
sa.showLevel(0)
return sa
}
开发者ID:kissthink,项目名称:bampf,代码行数:12,代码来源:launch.go
示例13: newPanel
// newPanel creates a panel with no cubes. The cubes are added later using
// panel.addCube().
func newPanel(part vu.Pov, x, y, z float64, level int) *panel {
p := &panel{}
p.part = part.NewPov()
p.lvl = level
p.cubes = []*cube{}
p.cx, p.cy, p.cz = x, y, z
p.ccnt, p.cmax = 0, (level-1)*(level-1)*8
p.mergec = func() { p.merge() }
p.trashc = func() { p.trash() }
p.addc = func() { p.addCell() }
p.remc = func() { p.removeCell() }
return p
}
开发者ID:kissthink,项目名称:bampf,代码行数:15,代码来源:trooper.go
示例14: newElectron
// newElectron creates a new electron model.
func newElectron(root vu.Pov, band int, angle float64) *electron {
ele := &electron{}
ele.band = band
x, y := ele.initialLocation(angle)
ele.core = root.NewPov().SetLocation(x, y, 0)
// rotating image.
cimg := ele.core.NewPov().SetScale(0.25, 0.25, 0.25)
model := cimg.NewModel("spinball").LoadMesh("billboard")
model.AddTex("ele").AddTex("ele").AddTex("halo").AddTex("halo")
model.SetAlpha(0.6)
return ele
}
开发者ID:kissthink,项目名称:bampf,代码行数:14,代码来源:end.go
示例15: label
// label adds a banner to a button or updates the banner if there is
// an existing banner.
func (b *button) label(part vu.Pov, keyCode int) {
if keysym := vu.Keysym(keyCode); keysym > 0 {
texture := "lucidiaSu22Black"
if b.banner == nil {
b.banner = part.NewPov().SetLocation(float64(b.x), float64(b.y), 0)
b.banner.NewModel("uv").AddTex(texture).LoadFont("lucidiaSu22")
}
if keyCode == 0 {
keyCode = vu.K_Space
}
b.banner.Model().SetPhrase(string(keysym))
}
}
开发者ID:kissthink,项目名称:bampf,代码行数:15,代码来源:button.go
示例16: newBlock
// newBlock creates a panel with no cubes. The cubes are added later using
// panel.addCube().
func newBlock(part vu.Pov, x, y, z float64, level int) *block {
b := &block{}
b.part = part.NewPov()
b.lvl = level
b.cubes = []*cube{}
b.cx, b.cy, b.cz = x, y, z
b.ccnt, b.cmax = 0, (level-1)*(level-1)*8
b.mergec = func() { b.merge() }
b.trashc = func() { b.trash() }
b.addc = func() { b.addCell() }
b.remc = func() { b.removeCell() }
return b
}
开发者ID:skyview059,项目名称:vu,代码行数:15,代码来源:sg.go
示例17: newSentinel
// newSentinel creates a player enemy.
func newSentinel(part vu.Pov, level, units int, fade float64) *sentinel {
s := &sentinel{}
s.part = part
s.units = float64(units)
s.part.SetLocation(0, 0.5, 0)
if level > 0 {
s.center = s.part.NewPov().SetScale(0.125, 0.125, 0.125)
m := s.center.NewModel("flata").LoadMesh("cube").LoadMat("tred")
m.SetUniform("fd", fade)
}
s.model = part.NewPov()
m := s.model.NewModel("flata").LoadMesh("cube").LoadMat("tblue")
m.SetUniform("fd", fade)
return s
}
开发者ID:kissthink,项目名称:bampf,代码行数:16,代码来源:sentinel.go
示例18: newButton
// newButton creates a button. Buttons are initialized with a size and repositioned later.
// root is the parent transform.
// size is both the width and height.
// icon is the (already loaded) texture image.
// action is the action to perform when the button is pressed.
func newButton(root vu.Pov, size int, icon string, eventId int, eventData interface{}) *button {
btn := &button{}
btn.model = root.NewPov()
btn.eventId = eventId
btn.eventData = eventData
btn.w, btn.h = size, size
// create the button icon.
btn.id = icon
btn.icon = btn.model.NewPov().SetScale(float64(btn.w/2), float64(btn.h/2), 1)
btn.icon.NewModel("uv").LoadMesh("icon").AddTex(icon).SetAlpha(0.5)
// create a hilite that is only shown on mouse over.
btn.hilite = btn.model.NewPov().SetScale(float64(btn.w/2.0), float64(btn.h/2.0), 1)
btn.hilite.SetVisible(false)
btn.hilite.NewModel("alpha").LoadMesh("square").LoadMat("tblue")
return btn
}
开发者ID:kissthink,项目名称:bampf,代码行数:23,代码来源:button.go
示例19: buildFloorPlan
// buildFloorPlan creates the level layout.
func (lvl *level) buildFloorPlan(root vu.Pov, hd *hud, plan grid.Grid) {
width, height := plan.Size()
for x := 0; x < width; x++ {
for y := 0; y < height; y++ {
xc := float64(x * lvl.units)
yc := float64(-y * lvl.units)
band := plan.Band(x, y) / 3
if x == width/2 && y == height/2 {
lvl.gcx, lvl.gcy = x, y // remember the maze center location
lvl.center = root.NewPov().SetLocation(xc, 0, yc)
m := lvl.center.NewModel("uvra").LoadMesh("tile").AddTex("drop1")
m.SetAlpha(0.7)
m.SetUniform("spin", 1.0)
m.SetUniform("fd", lvl.fade)
} else if plan.IsOpen(x, y) {
// the floor tiles.
tileLabel := lvl.tileLabel(band)
tile := root.NewPov().SetLocation(xc, 0, yc)
m := tile.NewModel("uva").LoadMesh("tile").AddTex(tileLabel)
m.SetAlpha(0.7)
m.SetUniform("fd", lvl.fade)
// remember the tile locations for drop spots inside the maze.
lvl.cc.addDropLocation(x, y)
} else {
// draw flat on the y plane with the maze extending into the screen.
wm := lvl.wallMeshLabel(band)
wt := lvl.wallTextureLabel(band)
wall := root.NewPov().SetLocation(xc, 0, yc)
m := wall.NewModel("uva").LoadMesh(wm).AddTex(wt)
m.SetUniform("fd", lvl.fade)
lvl.walls = append(lvl.walls, wall)
// add the wall to the minimap
hd.addWall(xc, yc)
}
}
}
// add core drop locations around the outside of the maze.
for x := -1; x < width+1; x++ {
lvl.cc.addDropLocation(x, -1)
lvl.cc.addDropLocation(x, height)
}
for y := 0; y < height; y++ {
lvl.cc.addDropLocation(-1, y)
lvl.cc.addDropLocation(width, y)
}
}
开发者ID:kissthink,项目名称:bampf,代码行数:52,代码来源:level.go
示例20: cloakingEffect
// cloakingEffect creates the model shown when the user cloaks.
func (hd *hud) cloakingEffect(root vu.Pov) vu.Pov {
ce := root.NewPov()
ce.SetVisible(false)
ce.NewModel("uv").LoadMesh("icon").AddTex("cloakon").SetAlpha(0.5)
return ce
}
开发者ID:kissthink,项目名称:bampf,代码行数:7,代码来源:hud.go
注:本文中的github.com/gazed/vu.Pov类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论