当前位置: 首页>>代码示例>>Golang>>正文


Golang render.GetTexture函数代码示例

本文整理汇总了Golang中github.com/thinkofdeath/steven/render.GetTexture函数的典型用法代码示例。如果您正苦于以下问题:Golang GetTexture函数的具体用法?Golang GetTexture怎么用?Golang GetTexture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetTexture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: Draw

// Draw draws this to the target region.
func (b *Button) Draw(r Region, delta float64) {
	if b.isNew || b.isDirty() || forceDirty {
		b.isNew = false
		if b.disabled {
			b.currentTex = render.RelativeTexture(render.GetTexture("gui/widgets"), 256, 256).
				Sub(0, 46, 200, 20)
		} else {
			off := 66
			if b.hovered {
				off += 20
			}
			b.currentTex = render.RelativeTexture(render.GetTexture("gui/widgets"), 256, 256).
				Sub(0, off, 200, 20)
		}
		b.data = b.data[:0]

		cw, ch := b.Size()
		sx, sy := r.W/cw, r.H/ch
		b.data = append(b.data, b.newUIElement(b.currentTex, r.X, r.Y, 4*sx, 4*sy, 0, 0, 2/200.0, 2/20.0).Bytes()...)
		b.data = append(b.data, b.newUIElement(b.currentTex, r.X+r.W-4*sx, r.Y, 4*sx, 4*sy, 198/200.0, 0, 2/200.0, 2/20.0).Bytes()...)
		b.data = append(b.data, b.newUIElement(b.currentTex, r.X, r.Y+r.H-6*sy, 4*sx, 6*sy, 0, 17/20.0, 2/200.0, 3/20.0).Bytes()...)
		b.data = append(b.data, b.newUIElement(b.currentTex, r.X+r.W-4*sx, r.Y+r.H-6*sy, 4*sx, 6*sy, 198/200.0, 17/20.0, 2/200.0, 3/20.0).Bytes()...)

		w := (r.W/sx)/2 - 4
		b.data = append(b.data, b.newUIElement(b.currentTex.Sub(2, 0, 196, 2), r.X+4*sx, r.Y, r.W-8*sx, 4*sy, 0, 0, w/196.0, 1.0).Bytes()...)
		b.data = append(b.data, b.newUIElement(b.currentTex.Sub(2, 17, 196, 3), r.X+4*sx, r.Y+r.H-6*sy, r.W-8*sx, 6*sy, 0, 0, w/196.0, 1.0).Bytes()...)

		h := (r.H/sy)/2 - 5
		b.data = append(b.data, b.newUIElement(b.currentTex.Sub(0, 2, 2, 15), r.X, r.Y+4*sy, 4*sx, r.H-10*sy, 0.0, 0.0, 1.0, h/16.0).Bytes()...)
		b.data = append(b.data, b.newUIElement(b.currentTex.Sub(198, 2, 2, 15), r.X+r.W-4*sx, r.Y+4*sy, 4*sx, r.H-10*sy, 0.0, 0.0, 1.0, h/16.0).Bytes()...)

		b.data = append(b.data, b.newUIElement(b.currentTex.Sub(2, 2, 196, 15), r.X+4*sx, r.Y+4*sy, r.W-8*sx, r.H-10*sy, 0.0, 0.0, w/196.0, h/16.0).Bytes()...)
	}
	render.UIAddBytes(b.data)
}
开发者ID:num5,项目名称:steven,代码行数:36,代码来源:button.go

示例2: genSunModel

func genSunModel() {
	if sunModel != nil {
		sunModel.Free()
		moonModel.Free()
		sunModel = nil
		moonModel = nil
	}
	const size = 50
	tex := render.GetTexture("environment/sun")
	sunModel = render.NewModelCollection([][]*render.ModelVertex{
		{
			{X: 0, Y: -size, Z: -size, TextureX: 0, TextureY: 1, Texture: tex, R: 255, G: 255, B: 255, A: 255},
			{X: 0, Y: size, Z: -size, TextureX: 0, TextureY: 0, Texture: tex, R: 255, G: 255, B: 255, A: 255},
			{X: 0, Y: -size, Z: size, TextureX: 1, TextureY: 1, Texture: tex, R: 255, G: 255, B: 255, A: 255},
			{X: 0, Y: size, Z: size, TextureX: 1, TextureY: 0, Texture: tex, R: 255, G: 255, B: 255, A: 255},
		},
	}, render.SunModels)

	moon := render.GetTexture("environment/moon_phases")
	mpx, mpy := float64(moonPhase%4)*(1/4.0), float64(moonPhase/4)*(1/2.0)
	moonModel = render.NewModelCollection([][]*render.ModelVertex{
		{
			{X: 0, Y: -size, Z: -size, TextureX: mpx, TextureY: mpy + (1 / 2.0), Texture: moon, R: 255, G: 255, B: 255, A: 255},
			{X: 0, Y: size, Z: -size, TextureX: mpx, TextureY: mpy, Texture: moon, R: 255, G: 255, B: 255, A: 255},
			{X: 0, Y: -size, Z: size, TextureX: mpx + (1 / 4.0), TextureY: mpy + (1 / 2.0), Texture: moon, R: 255, G: 255, B: 255, A: 255},
			{X: 0, Y: size, Z: size, TextureX: mpx + (1 / 4.0), TextureY: mpy, Texture: moon, R: 255, G: 255, B: 255, A: 255},
		},
	}, render.SunModels)
}
开发者ID:num5,项目名称:steven,代码行数:29,代码来源:clouds.go

示例3: createItemIcon

func createItemIcon(item *ItemStack, scene *scene.Type, x, y float64) *ui.Container {
	mdl := getModel(item.Type.Name())

	container := ui.NewContainer(x, y, 32, 32)
	if mdl == nil || mdl.builtIn == builtInGenerated {
		var tex render.TextureInfo
		if mdl == nil {
			tex = render.GetTexture("missing_texture")

			img := ui.NewImage(tex, 0, 0, 32, 32, 0, 0, 1, 1, 255, 255, 255)
			img.AttachTo(container)
			scene.AddDrawable(img.Attach(ui.Top, ui.Left))
		} else {
			for i := 0; i < 9; i++ {
				v := fmt.Sprintf("layer%d", i)
				if _, ok := mdl.textureVars[v]; !ok {
					break
				}
				tex = mdl.lookupTexture("#" + v)

				img := ui.NewImage(tex, 0, 0, 32, 32, 0, 0, 1, 1, 255, 255, 255)
				img.AttachTo(container)
				scene.AddDrawable(img.Attach(ui.Top, ui.Left))
			}
		}
	} else if mdl.builtIn == builtInFalse {
		var blk Block
		if bt, ok := item.Type.(*blockItem); ok {
			blk = bt.block
		}
		u := modelToUI(mdl, blk)
		u.AttachTo(container)
		scene.AddDrawable(u.Attach(ui.Top, ui.Left))
	}
	if dam, ok := item.Type.(ItemDamagable); ok && dam.Damage() > 0 {
		val := 1.0 - (float64(dam.Damage()) / float64(dam.MaxDamage()))
		barShadow := ui.NewImage(render.GetTexture("solid"), 0, 2, 28, 4, 0, 0, 1, 1,
			0, 0, 0,
		)
		barShadow.SetLayer(2)
		barShadow.AttachTo(container)
		scene.AddDrawable(barShadow.Attach(ui.Bottom, ui.Center))
		bar := ui.NewImage(render.GetTexture("solid"), 0, 0, 28*val, 2, 0, 0, 1, 1,
			int(255*(1.0-val)), int(255*val), 0,
		)
		bar.SetLayer(2)
		bar.AttachTo(barShadow)
		scene.AddDrawable(bar.Attach(ui.Top, ui.Left))
	}
	if item.Count > 1 {
		txt := ui.NewText(fmt.Sprint(item.Count), -2, -2, 255, 255, 255).
			Attach(ui.Bottom, ui.Right)
		txt.AttachTo(container)
		txt.SetLayer(2)
		scene.AddDrawable(txt)
	}
	return container
}
开发者ID:num5,项目名称:steven,代码行数:58,代码来源:inventory.go

示例4: initBlocks

func initBlocks() {
	missingModel := findStateModel("steven", "missing_block")
	// Flatten the ids
	for _, bs := range blockSetsByID {
		if bs == nil {
			continue
		}
		for i, b := range bs.Blocks {
			br := reflect.ValueOf(b).Elem()
			br.FieldByName("Index").SetInt(int64(i))
			br.FieldByName("StevenID").SetUint(uint64(len(allBlocks)))
			allBlocks = append(allBlocks, b)
			if len(allBlocks) > math.MaxUint16 {
				panic("ran out of ids, time to do this correctly :(")
			}
			data := b.toData()
			if data != -1 {
				blocks[(bs.ID<<4)|data] = b
			}
			// Liquids have custom rendering
			if l, ok := b.(*blockLiquid); ok {
				if l.Lava {
					l.Tex = render.GetTexture("blocks/lava_still")
				} else {
					l.Tex = render.GetTexture("blocks/water_still")
				}
				continue
			}
			if !b.Renderable() {
				continue
			}

			if model := findStateModel(b.Plugin(), b.ModelName()); model != nil {
				if variants := model.variant(b.ModelVariant()); variants != nil {
					br.FieldByName("BlockVariants").Set(
						reflect.ValueOf(variants),
					)
					continue
				}
				if variants := model.matchPart(bs, b); variants != nil {
					br.FieldByName("BlockVariants").Set(
						reflect.ValueOf(variants),
					)
					continue
				}
				console.Text("Missing block variant (%s) for %s", b.ModelVariant(), b)
			} else {
				console.Text("Missing block model for %s", b)
			}
			br.FieldByName("BlockVariants").Set(
				reflect.ValueOf(missingModel.variant("normal")),
			)

		}
	}
}
开发者ID:num5,项目名称:steven,代码行数:56,代码来源:block.go

示例5: newGameMenu

func newGameMenu() screen {
	gm := &gameMenu{
		scene: scene.New(true),
	}

	gm.background = ui.NewImage(render.GetTexture("solid"), 0, 0, 854, 480, 0, 0, 1, 1, 0, 0, 0)
	gm.background.SetA(160)
	gm.scene.AddDrawable(gm.background.Attach(ui.Top, ui.Left))

	disconnect, txt := newButtonText("Disconnect", 0, 50, 400, 40)
	gm.scene.AddDrawable(disconnect.Attach(ui.Center, ui.Middle))
	gm.scene.AddDrawable(txt)
	disconnect.AddClick(func() { Client.network.SignalClose(errManualDisconnect) })

	rtg, txt := newButtonText("Return to game", 0, -50, 400, 40)
	gm.scene.AddDrawable(rtg.Attach(ui.Center, ui.Middle))
	gm.scene.AddDrawable(txt)
	rtg.AddClick(func() { setScreen(nil) })

	option, txt := newButtonText("Options", 0, 0, 400, 40)
	gm.scene.AddDrawable(option.Attach(ui.Center, ui.Middle))
	gm.scene.AddDrawable(txt)
	option.AddClick(func() { setScreen(newOptionMenu(newGameMenu)) })

	uiFooter(gm.scene)
	return gm
}
开发者ID:num5,项目名称:steven,代码行数:27,代码来源:uigamemenu.go

示例6: Update

func (b *blockBreakComponent) Update() {
	if b.model != nil {
		b.model.Free()
	}
	bounds := chunkMap.Block(b.Location.X, b.Location.Y, b.Location.Z).CollisionBounds()
	tex := render.GetTexture(fmt.Sprintf("blocks/destroy_stage_%d", b.stage))

	var verts []*render.StaticVertex
	for _, bo := range bounds {
		// Slightly bigger than the block to prevent clipping
		bo = bo.Grow(0.01, 0.01, 0.01)
		verts = appendBox(verts,
			bo.Min.X(), bo.Min.Y(), bo.Min.Z(),
			bo.Max.X()-bo.Min.X(), bo.Max.Y()-bo.Min.Y(), bo.Max.Z()-bo.Min.Z(),
			[6]render.TextureInfo{
				tex, tex, tex, tex, tex, tex,
			})
	}
	b.model = render.NewStaticModel([][]*render.StaticVertex{verts})

	b.model.Matrix[0] = mgl32.Translate3D(
		float32(b.Location.X),
		-float32(b.Location.Y),
		float32(b.Location.Z),
	)
}
开发者ID:suedadam,项目名称:steven,代码行数:26,代码来源:blockentity.go

示例7: Add

func (c *ChatUI) Add(msg format.AnyComponent) {
	format.ConvertLegacy(msg)
	copy(c.Lines[0:chatHistoryLines-1], c.Lines[1:])
	c.Lines[chatHistoryLines-1] = msg
	f := ui.NewFormattedWidth(msg, 5, chatHistoryLines*18+1, maxLineWidth-10).Attach(ui.Top, ui.Left)
	f.AttachTo(c.container)
	line := &chatLine{
		text:       f,
		fade:       3.0,
		background: ui.NewImage(render.GetTexture("solid"), 0, chatHistoryLines*18, maxLineWidth, f.Height, 0, 0, 1, 1, 0, 0, 0),
	}
	line.background.AttachTo(c.container)
	line.background.SetA(77)
	c.parts = append(c.parts, line)
	Client.scene.AddDrawable(line.background)
	Client.scene.AddDrawable(f)
	ff := f
	for _, f := range c.parts {
		f.text.SetY(f.text.Y() - 18*float64(ff.Lines))
		f.background.SetY(f.background.Y() - 18*float64(ff.Lines))
	}
	if c.enteringText {
		ff.SetY(ff.Y() - 18)
		line.background.SetY(line.background.Y() - 18)
	}
}
开发者ID:num5,项目名称:steven,代码行数:26,代码来源:chat.go

示例8: newRespawnScreen

func newRespawnScreen() *respawnScreen {
	rs := &respawnScreen{
		scene: scene.New(true),
	}

	rs.background = ui.NewImage(render.GetTexture("solid"), 0, 0, 854, 480, 0, 0, 1, 1, 0, 0, 0)
	rs.background.SetA(160)
	rs.scene.AddDrawable(rs.background.Attach(ui.Top, ui.Left))

	rs.scene.AddDrawable(
		ui.NewText("Respawn:", 0, -20, 255, 255, 255).Attach(ui.Center, ui.Middle),
	)

	respawn, txt := newButtonText("Respawn", -205, 20, 400, 40)
	rs.scene.AddDrawable(respawn.Attach(ui.Center, ui.Middle))
	rs.scene.AddDrawable(txt)
	respawn.AddClick(func() {
		setScreen(nil)
		Client.network.Write(&protocol.ClientStatus{ActionID: 0})
	})

	disconnect, txt := newButtonText("Disconnect", 205, 20, 400, 40)
	rs.scene.AddDrawable(disconnect.Attach(ui.Center, ui.Middle))
	rs.scene.AddDrawable(txt)
	disconnect.AddClick(func() { Client.network.SignalClose(errManualDisconnect) })

	uiFooter(rs.scene)
	return rs
}
开发者ID:num5,项目名称:steven,代码行数:29,代码来源:uirespawn.go

示例9: tick

func (u *uiLogo) tick(delta float64) {
	if logoTimer > 0 {
		logoTimer -= delta
	} else if logoTransTimer < 0 {
		logoTransTimer = 120
		logoTimer = r.Float64() * 60 * 30
		readStevenLogo()
		logoTexture = logoTargetTexture
		nextLogoTexture()
		nextLogoText()
		u.text.Update(logoText)
		width, _ := u.text.Size()
		u.textBaseScale = 300 / width
		if u.textBaseScale > 1 {
			u.textBaseScale = 1
		}
		u.text.SetX((-u.text.Width / 2) * u.textBaseScale)
		u.origX = u.text.X()
	} else {
		logoTransTimer -= delta
	}

	tex, tex2 := render.GetTexture(logoTexture), render.GetTexture(logoTargetTexture)
	for i := range logoLayers[0] {
		logoLayers[0][i].SetTexture(tex)
		logoLayers[1][i].SetTexture(tex2)

		logoLayers[0][i].SetA(int(255 * (logoTransTimer / 120)))
		logoLayers[1][i].SetA(int(255 * (1 - (logoTransTimer / 120))))
	}

	logoTextTimer += delta
	if logoTextTimer > 60 {
		logoTextTimer -= 60
	}
	off := (logoTextTimer / 30)
	if off > 1.0 {
		off = 2.0 - off
	}
	off = (math.Cos(off*math.Pi) + 1) / 2
	u.text.SetScaleX((0.7 + (off / 3)) * u.textBaseScale)
	u.text.SetScaleY((0.7 + (off / 3)) * u.textBaseScale)
	u.text.SetX(u.origX * u.text.ScaleX() * u.textBaseScale)
}
开发者ID:num5,项目名称:steven,代码行数:44,代码来源:uilogo.go

示例10: newServerList

func newServerList() screen {
	sl := &serverList{
		scene: scene.New(true),
	}
	sl.logo.init(sl.scene)

	uiFooter(sl.scene)

	sl.redraw()

	refresh, txt := newButtonText("Refresh", 300, -50-15, 100, 30)
	sl.scene.AddDrawable(refresh.Attach(ui.Center, ui.Middle))
	sl.scene.AddDrawable(txt)
	refresh.AddClick(sl.redraw)

	add, txt := newButtonText("Add", 200, -50-15, 100, 30)
	sl.scene.AddDrawable(add.Attach(ui.Center, ui.Middle))
	sl.scene.AddDrawable(txt)
	add.AddClick(func() {
		setScreen(newEditServer(-1))
	})

	options := ui.NewButton(5, 25, 40, 40)
	sl.scene.AddDrawable(options.Attach(ui.Bottom, ui.Right))
	cog := ui.NewImage(render.GetTexture("steven:gui/cog"), 0, 0, 40, 40, 0, 0, 1, 1, 255, 255, 255)
	cog.AttachTo(options)
	sl.scene.AddDrawable(cog.Attach(ui.Center, ui.Middle))
	options.AddClick(func() {
		setScreen(newOptionMenu(newServerList))
	})

	if disconnectReason.Value != nil {
		disMsg := ui.NewText("Disconnected", 0, 32, 255, 0, 0).Attach(ui.Top, ui.Center)
		dis := ui.NewFormattedWidth(disconnectReason, 0, 48, 600)
		disB := ui.NewImage(render.GetTexture("solid"), 0, 30, math.Max(dis.Width, disMsg.Width)+4, dis.Height+4+16, 0, 0, 1, 1, 0, 0, 0)
		disB.SetA(100)
		sl.scene.AddDrawable(disB.Attach(ui.Top, ui.Center))
		sl.scene.AddDrawable(dis.Attach(ui.Top, ui.Center))
		sl.scene.AddDrawable(disMsg)
	}

	return sl
}
开发者ID:num5,项目名称:steven,代码行数:43,代码来源:uiserverlist.go

示例11: init

func (p *playerListUI) init() {
	p.info = map[protocol.UUID]*playerInfo{}
	p.scene = scene.New(false)
	for i := range p.background {
		p.background[i] = ui.NewImage(render.GetTexture("solid"), 0, 16, playerListWidth+48, 16, 0, 0, 1, 1, 0, 0, 0)
		p.background[i].SetA(120)
		p.background[i].SetDraw(false)
		p.scene.AddDrawable(p.background[i].Attach(ui.Top, ui.Center))
	}
}
开发者ID:num5,项目名称:steven,代码行数:10,代码来源:playerlist.go

示例12: init

func (c *ChatUI) init() {
	c.container = ui.NewContainer(0, 44, maxLineWidth, chatHistoryLines*18+2)
	c.container.Attach(ui.Bottom, ui.Left)
	c.input = ui.NewText("", 5, 1, 255, 255, 255).Attach(ui.Bottom, ui.Left)
	c.input.SetDraw(false)
	c.input.AttachTo(c.container)
	c.inputBackground = ui.NewImage(render.GetTexture("solid"), 0, 0, maxLineWidth, 20, 0, 0, 1, 1, 0, 0, 0).Attach(ui.Bottom, ui.Left)
	c.inputBackground.SetA(77)
	c.inputBackground.AttachTo(c.container)
	c.inputBackground.SetDraw(false)
	Client.scene.AddDrawable(c.inputBackground)
	Client.scene.AddDrawable(c.input)
}
开发者ID:num5,项目名称:steven,代码行数:13,代码来源:chat.go

示例13: newProgressBar

func newProgressBar() *progressBar {
	p := &progressBar{
		id: len(progressBars),
	}
	p.bar = ui.NewImage(render.GetTexture("solid"), 0, 21*float64(p.id), 854, 21, 0, 0, 1, 1, 0, 125, 0)
	ui.AddDrawable(p.bar.Attach(ui.Top, ui.Left))
	p.text = ui.NewText("", 1, 21*float64(p.id)+1, 255, 255, 255)
	ui.AddDrawable(p.text.Attach(ui.Top, ui.Left))
	progressBars = append(progressBars, p)
	p.bar.SetLayer(-241)
	p.text.SetLayer(-240)
	return p
}
开发者ID:num5,项目名称:steven,代码行数:13,代码来源:progress.go

示例14: init

func (cs *consoleScreen) init() {
	cs.scene = scene.New(true)
	cs.container = ui.NewContainer(0, -220, 854, 220)
	cs.container.SetLayer(-200)
	cs.background = ui.NewImage(render.GetTexture("solid"), 0, 0, 854, 220, 0, 0, 1, 1, 0, 0, 0)
	cs.background.SetA(180)
	cs.background.AttachTo(cs.container)
	cs.scene.AddDrawable(cs.background.Attach(ui.Top, ui.Left))

	cs.inputText = ui.NewText("", 5, 200, 255, 255, 255)
	cs.inputText.AttachTo(cs.container)
	cs.scene.AddDrawable(cs.inputText.Attach(ui.Top, ui.Left))
	cs.pos = -220
	cs.visible = false
}
开发者ID:num5,项目名称:steven,代码行数:15,代码来源:console.go

示例15: create

func (s *signComponent) create() {
	const yS = (6.0 / 16.0) / 4.0
	const xS = yS / 16.0

	var verts []*render.StaticVertex
	for i, line := range s.lines {
		if line.Value == nil {
			continue
		}
		format.ConvertLegacy(line)
		// Hijack ui.Formatted's component parsing to split
		// up components into ui.Text elements.
		// TODO(Think) Move this into some common place for
		// easier reuse in other places?
		wrap := &format.TextComponent{}
		wrap.Color = format.Black
		wrap.Extra = []format.AnyComponent{line}
		f := ui.NewFormatted(format.Wrap(wrap), 0, 0)
		offset := 0.0
		for _, txt := range f.Text {
			str := txt.Value()

			for _, r := range str {
				tex := render.CharacterTexture(r)
				if tex == nil {
					continue
				}
				s := render.SizeOfCharacter(r)
				if r == ' ' {
					offset += (s + 2) * xS
					continue
				}

				for _, v := range faceVertices[direction.North].verts {
					vert := &render.StaticVertex{
						X:        float32(v.X)*float32(s*xS) - float32(offset+s*xS) + float32(f.Width*xS*0.5),
						Y:        float32(v.Y)*yS - yS*float32(i-1),
						Z:        -.6 / 16.0,
						Texture:  tex,
						TextureX: float64(v.TOffsetX),
						TextureY: float64(v.TOffsetY),
						R:        byte(txt.R()),
						G:        byte(txt.G()),
						B:        byte(txt.B()),
						A:        255,
					}
					verts = append(verts, vert)
				}
				offset += (s + 2) * xS
			}
		}
	}
	wood := render.GetTexture("blocks/planks_oak")
	// The backboard
	verts = appendBoxExtra(verts, -0.5, -4/16.0, -0.5/16.0, 1.0, 8/16.0, 1/16.0, [6]render.TextureInfo{
		direction.Up:    wood.Sub(0, 0, 16, 2),
		direction.Down:  wood.Sub(0, 0, 16, 2),
		direction.East:  wood.Sub(0, 0, 2, 12),
		direction.West:  wood.Sub(0, 0, 2, 12),
		direction.North: wood.Sub(0, 4, 16, 12),
		direction.South: wood.Sub(0, 4, 16, 12),
	}, [6][2]float64{
		direction.Up:    {1.5, 1.0},
		direction.Down:  {1.5, 1.0},
		direction.East:  {1.0, 1.0},
		direction.West:  {1.0, 1.0},
		direction.North: {1.5, 1.0},
		direction.South: {1.5, 1.0},
	})
	if s.hasStand {
		// Stand
		log := render.GetTexture("blocks/log_oak")
		verts = appendBox(verts, -0.5/16.0, -0.25-9/16.0, -0.5/16.0, 1/16.0, 9/16.0, 1/16.0, [6]render.TextureInfo{
			direction.Up:    log.Sub(0, 0, 2, 2),
			direction.Down:  log.Sub(0, 0, 2, 2),
			direction.East:  log.Sub(0, 0, 2, 12),
			direction.West:  log.Sub(0, 0, 2, 12),
			direction.North: log.Sub(0, 0, 2, 12),
			direction.South: log.Sub(0, 0, 2, 12),
		})
	}
	s.model = render.NewStaticModel([][]*render.StaticVertex{
		verts,
	})
	s.model.Radius = 2
	x, y, z := s.position.X, s.position.Y, s.position.Z

	s.model.X, s.model.Y, s.model.Z = -float32(x)-0.5, -float32(y)-0.5, float32(z)+0.5
	s.model.Matrix[0] = mgl32.Translate3D(
		float32(x)+0.5,
		-float32(y)-0.5,
		float32(z)+0.5,
	).Mul4(mgl32.Rotate3DY(float32(s.rotation)).Mat4()).
		Mul4(mgl32.Translate3D(float32(s.ox), float32(-s.oy), float32(s.oz)))
}
开发者ID:suedadam,项目名称:steven,代码行数:95,代码来源:blocksign.go


注:本文中的github.com/thinkofdeath/steven/render.GetTexture函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。