本文整理汇总了Golang中github.com/gazed/vu.Pov.NewPov方法的典型用法代码示例。如果您正苦于以下问题:Golang Pov.NewPov方法的具体用法?Golang Pov.NewPov怎么用?Golang Pov.NewPov使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/gazed/vu.Pov
的用法示例。
在下文中一共展示了Pov.NewPov方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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
}
示例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
}
示例3: 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
}
示例4: 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
}
示例5: 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
}
示例6: 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
}
示例7: 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
}
示例8: 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
}
示例9: 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
}
示例10: 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
}
示例11: 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
}
示例12: 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))
}
}
示例13: 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
}
示例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
}
示例15: 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
}