• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang mgl32.Translate3D函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ExampleRebase

func ExampleRebase() {
	parent1 := NewTransformStack()

	scale := mgl32.Scale3D(2, 2, 2)
	rot := mgl32.HomogRotate3DY(mgl32.DegToRad(90))
	trans := mgl32.Translate3D(5, 5, 5)

	parent1.Push(trans)
	parent1.Push(rot)
	parent1.Push(scale)

	parent2 := parent1.Copy()

	trans2 := mgl32.Translate3D(1, 1, 1)
	rot2 := mgl32.HomogRotate3DX(mgl32.DegToRad(45))
	parent1.Push(trans2)
	parent1.Push(rot2)

	// Replay the pushes the changes from parent1 after the copy onto parent2, as if
	// they had been done on parent2 instead
	parent2, err := Rebase(parent1, 4, parent2)

	if err != nil {
		panic(err)
	}

	// Now parent2 and parent 1 should be the same!
	fmt.Println(parent2.Peek().ApproxEqualThreshold(parent1.Peek(), 1e-4))
	// Output: true
}
开发者ID:rdterner,项目名称:mathgl,代码行数:30,代码来源:transformstack_test.go


示例2: init

func init() {
	uvRotations = make(map[int]*mgl32.Mat4)
	for i := 0; i < 4; i++ {
		matrix := mgl32.Translate3D(0.5, 0.5, 0.0).
			Mul4(mgl32.HomogRotate3DZ(float32(math.Pi * float32(i) / 2.0))).
			Mul4(mgl32.Translate3D(-0.5, -0.5, 0.0))
		uvRotations[i] = &matrix
	}
}
开发者ID:inkyblackness,项目名称:shocked-client,代码行数:9,代码来源:TileTextureMapRenderable.go


示例3: GetMtx

func (k PianoKey) GetMtx() mgl32.Mat4 {
	axis := mgl32.Vec3{1, 0, 0}
	keyLen := float32(2.0)
	if !k.white {
		keyLen = 1.0
	}
	modelMtx := mgl32.Ident4()
	modelMtx = modelMtx.Mul4(mgl32.Translate3D(k.Pos[0], k.Pos[1], k.Pos[2]-2))
	modelMtx = modelMtx.Mul4(mgl32.HomogRotate3D(k.Angle, axis))
	modelMtx = modelMtx.Mul4(mgl32.Translate3D(0, 0, keyLen))
	modelMtx = modelMtx.Mul4(mgl32.Scale3D(0.5, 0.5, keyLen))

	return modelMtx
}
开发者ID:xnattack,项目名称:GCSolutions,代码行数:14,代码来源:piano.go


示例4: 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


示例5: TestStackMultiPush

func TestStackMultiPush(t *testing.T) {
	stack := NewTransformStack()

	scale := mgl32.Scale3D(2, 2, 2)
	rot := mgl32.HomogRotate3DY(mgl32.DegToRad(90))
	trans := mgl32.Translate3D(4, 5, 6)

	stack.Push(trans)
	stack.Push(rot)

	if !stack.Peek().ApproxEqualThreshold(trans.Mul4(rot), 1e-4) {
		t.Errorf("Stack does not multiply first two pushes correctly")
	}

	stack.Push(scale)

	if !stack.Peek().ApproxEqualThreshold(trans.Mul4(rot).Mul4(scale), 1e-4) {
		t.Errorf("Stack does not multiple third push correctly")
	}

	stack.Unwind(2)
	stack.Push(scale)

	if !stack.Peek().ApproxEqualThreshold(trans.Mul4(scale), 1e-4) {
		t.Errorf("Unwinding and multiplying does not work correctly")
	}
}
开发者ID:rdterner,项目名称:mathgl,代码行数:27,代码来源:transformstack_test.go


示例6: onPaint

func onPaint(glctx gl.Context, sz size.Event) {

	glctx.Viewport(0, 0, sz.WidthPx, sz.HeightPx)
	glctx.ClearColor(0.5, 0.5, 0.5, 1)
	glctx.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	glctx.UseProgram(program)

	projectionMtx = mgl32.Perspective(45, float32(width)/float32(height), 0.1, 100)

	arcBallMtx := arcball.getMtx()

	glctx.UniformMatrix4fv(projection, projectionMtx[:])

	glctx.UniformMatrix4fv(view, arcBallMtx[:])

	glctx.BindBuffer(gl.ARRAY_BUFFER, triBuf)
	glctx.EnableVertexAttribArray(position)
	glctx.EnableVertexAttribArray(color)
	glctx.EnableVertexAttribArray(normals)

	vertSize := 4 * (coordsPerVertex + colorPerVertex + normalsPerVertex)

	glctx.VertexAttribPointer(position, coordsPerVertex, gl.FLOAT, false, vertSize, 0)
	glctx.VertexAttribPointer(color, colorPerVertex, gl.FLOAT, false, vertSize, 4*coordsPerVertex)
	glctx.VertexAttribPointer(normals, normalsPerVertex, gl.FLOAT, false, vertSize, 4*(coordsPerVertex+colorPerVertex))

	glctx.DepthMask(true)

	glctx.Uniform3fv(lightPos, light.Pos[:])
	glctx.Uniform3fv(lightIntensity, light.Intensities[:])

	for _, k := range piano.Keys {
		glctx.Uniform4fv(tint, k.Color[:])

		mtx := k.GetMtx()
		normMat := mtx.Mat3().Inv().Transpose()
		glctx.UniformMatrix3fv(normalMatrix, normMat[:])
		glctx.UniformMatrix4fv(model, mtx[:])
		glctx.DrawArrays(gl.TRIANGLES, 0, len(triangleData)/vertSize)
	}

	modelMtx := mgl32.Ident4()
	modelMtx = modelMtx.Mul4(mgl32.Translate3D(worldPos.X(), worldPos.Y(), worldPos.Z()))
	modelMtx = modelMtx.Mul4(mgl32.Scale3D(0.5, 0.5, 0.5))

	/*
		glctx.Uniform4fv(tint, red[:])
		// Disable depthmask so we dont get the pixel depth of the cursor cube
		glctx.DepthMask(false)
		glctx.UniformMatrix4fv(model, modelMtx[:])
		glctx.DepthMask(true)
	*/

	glctx.DisableVertexAttribArray(position)
	glctx.DisableVertexAttribArray(color)
	glctx.DisableVertexAttribArray(normals)

	fps.Draw(sz)
}
开发者ID:rakyll,项目名称:GCSolutions,代码行数:60,代码来源:main.go


示例7: renderCallback

func renderCallback(delta float64) {
	gl.Viewport(0, 0, int32(app.Width), int32(app.Height))
	gl.ClearColor(0.196078, 0.6, 0.8, 1.0) // some pov-ray sky blue
	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

	// make the projection and view matrixes
	projection := mgl.Perspective(mgl.DegToRad(60.0), float32(app.Width)/float32(app.Height), 1.0, 200.0)
	view := app.CameraRotation.Mat4()
	view = view.Mul4(mgl.Translate3D(-app.CameraPos[0], -app.CameraPos[1], -app.CameraPos[2]))

	// draw the cube
	cube.Node.Draw(projection, view)

	// draw all of the bullets
	for _, bullet := range bullets {
		bullet.Node.Draw(projection, view)
	}

	// draw the backboard
	backboard.Node.Draw(projection, view)

	// draw the ground
	ground.Draw(projection, view)

	//time.Sleep(10 * time.Millisecond)
}
开发者ID:tbogdala,项目名称:cubez,代码行数:26,代码来源:ballistic.go


示例8: Update

/* Update transform matrix and right/up/forward vectors */
func (t *Transform) Update(dt float32) {
	// todo: avoid recalculating unless something has changed

	/* Update transform */
	rad := t.Rotation.Mul(math.Pi / 180.0) // translate rotaiton to radians
	rotation := mgl.AnglesToQuat(rad[0], rad[1], rad[2], mgl.XYZ).Mat4()
	scaling := mgl.Scale3D(t.Scale[0], t.Scale[1], t.Scale[2])
	translation := mgl.Translate3D(t.Position[0], t.Position[1], t.Position[2])

	/* New transform matrix: S * R * T */
	//m := scaling.Mul4(rotation.Mul4(translation))
	m := translation.Mul4(rotation.Mul4(scaling))

	/* Grab axis vectors from transformation matrix */
	t.Right[0] = m[4*0+0] // first column
	t.Right[1] = m[4*1+0]
	t.Right[2] = m[4*2+0]
	t.Up[0] = m[4*0+1] // second column
	t.Up[1] = m[4*1+1]
	t.Up[2] = m[4*2+1]
	t.Forward[0] = -m[4*0+2] // third column
	t.Forward[1] = -m[4*1+2]
	t.Forward[2] = -m[4*2+2]

	/* Update transformation matrix */
	t.Matrix = m
}
开发者ID:johanhenriksson,项目名称:goworld,代码行数:28,代码来源:transform.go


示例9: ToSpritesheetFrame

func (c SpritesheetFrameConfig) ToSpritesheetFrame() *SpritesheetFrame {
	var (
		texX = c.textureX / c.textureOriginalW
		texY = c.textureY / c.textureOriginalH
		texW = c.textureW / c.textureOriginalW
		texH = c.textureH / c.textureOriginalH
	)
	var (
		texMove   = mgl32.Translate3D(texX, -texH-texY, 0.0)
		texScale  = mgl32.Scale3D(texW, texH, 1.0)
		texRotate = mgl32.HomogRotate3DZ(mgl32.DegToRad(0))
		texAdj    = texMove.Mul4(texScale).Mul4(texRotate).Transpose()
	)
	var (
		ptScale = mgl32.Scale3D(c.sourceW/c.pxPerUnit, c.sourceH/c.pxPerUnit, 1.0)
		ptAdj   = ptScale.Transpose()
	)
	return &SpritesheetFrame{
		Frame: FrameConfig{
			PointAdjustment:   ptAdj,
			TextureAdjustment: texAdj,
		},
		Width:  c.sourceW / c.pxPerUnit,
		Height: c.sourceH / c.pxPerUnit,
	}
}
开发者ID:pikkpoiss,项目名称:twodee,代码行数:26,代码来源:spritesheet.go


示例10: GetTransformMat4

// GetTransformMat4 creates a transform matrix: scale * transform
func (r *Renderable) GetTransformMat4() mgl.Mat4 {
	scaleMat := mgl.Scale3D(r.Scale[0], r.Scale[1], r.Scale[2])
	transMat := mgl.Translate3D(r.Location[0], r.Location[1], r.Location[2])
	localRotMat := r.LocalRotation.Mat4()
	rotMat := r.Rotation.Mat4()
	modelTransform := rotMat.Mul4(transMat).Mul4(localRotMat).Mul4(scaleMat)
	return modelTransform
}
开发者ID:tbogdala,项目名称:cubez,代码行数:9,代码来源:exampleapp.go


示例11: TextTransform

func (this *TextRenderer) TextTransform(vertex mathgl.Vec4) mathgl.Vec4 {
	// apply font transforms
	scale := float32(this.size) / 100.0
	t := mathgl.Translate3D(curTotWidth, 0, 0).Mul4x1(vertex)

	t = mathgl.Scale3D(scale, scale, 1).Mul4x1(t)

	return t
}
开发者ID:Triangle345,项目名称:GT,代码行数:9,代码来源:TextRenderer.go


示例12: tickClouds

func tickClouds(delta float64) {
	if Client != nil && Client.WorldType != wtOverworld {
		render.DrawClouds = false
		if sunModel != nil {
			sunModel.Free()
			moonModel.Free()
			sunModel = nil
			moonModel = nil
		}
		return
	}
	render.DrawClouds = true
	if Client == nil && Client.entity != nil {
		return
	}
	if sunModel == nil {
		genSunModel()
	}

	phase := int((Client.WorldAge / 24000) % 8)
	if phase != moonPhase {
		moonPhase = phase
		genSunModel()
	}

	x, y, z := Client.entity.Position()

	time := Client.WorldTime / 12000
	ox := math.Cos(time*math.Pi) * 300
	oy := math.Sin(time*math.Pi) * 300

	sunModel.Matrix[0] = mgl32.Translate3D(
		float32(x+ox),
		-float32(y+oy),
		float32(z),
	).Mul4(mgl32.Rotate3DZ(-float32(time * math.Pi)).Mat4())

	moonModel.Matrix[0] = mgl32.Translate3D(
		float32(x-ox),
		-float32(y-oy),
		float32(z),
	).Mul4(mgl32.Rotate3DZ(math.Pi - float32(time*math.Pi)).Mat4())
}
开发者ID:num5,项目名称:steven,代码行数:43,代码来源:clouds.go


示例13: TestReseed

func TestReseed(t *testing.T) {
	stack := NewTransformStack()

	scale := mgl32.Scale3D(2, 2, 2)
	rot := mgl32.HomogRotate3DY(mgl32.DegToRad(90))
	trans := mgl32.Translate3D(4, 5, 6)

	stack.Push(trans)
	stack.Push(rot)
	stack.Push(scale)

	trans2 := mgl32.Translate3D(1, 2, 3)
	err := stack.Reseed(1, trans2)

	if err != nil {
		t.Fatalf("Rebase returned error when it should not %v", err)
	}

	if !stack.Peek().ApproxEqualThreshold(trans2.Mul4(rot).Mul4(scale), 1e-4) {
		t.Fatalf("Rebase does not remultiply correctly. Got\n %v expected\n %v. (Previous state:\n %v)", stack.Peek(), trans2.Mul4(rot).Mul4(scale), trans.Mul4(rot).Mul4(scale))
	}
}
开发者ID:rdterner,项目名称:mathgl,代码行数:22,代码来源:transformstack_test.go


示例14: TestRebase

func TestRebase(t *testing.T) {
	stack := NewTransformStack()
	stack2 := NewTransformStack()

	scale := mgl32.Scale3D(2, 2, 2)
	rot := mgl32.HomogRotate3DY(mgl32.DegToRad(90))
	trans := mgl32.Translate3D(4, 5, 6)
	trans2 := mgl32.Translate3D(1, 2, 3)

	stack.Push(trans)
	stack.Push(rot)

	stack2.Push(trans2)
	stack2.Push(scale)

	out, _ := Rebase(stack2, 1, stack)

	if !out.Peek().ApproxEqualThreshold(trans.Mul4(rot).Mul4(trans2).Mul4(scale), 1e-4) {
		t.Log("\n", out)
		t.Errorf("Rebase unsuccessful. Got\n %v, expected\n %v", out.Peek(), trans.Mul4(rot).Mul4(trans2).Mul4(scale))
	}
}
开发者ID:rdterner,项目名称:mathgl,代码行数:22,代码来源:transformstack_test.go


示例15: Draw

func (r *BatchRenderer) Draw(batch *Batch, x, y, rot float32) error {
	batch.Texture.Bind()
	gl.BindBuffer(gl.ARRAY_BUFFER, batch.Buffer)
	gl.EnableVertexAttribArray(r.PositionLoc)
	gl.VertexAttribPointer(r.PositionLoc, 3, gl.FLOAT, false, 5*4, gl.PtrOffset(0))
	gl.EnableVertexAttribArray(r.TextureLoc)
	gl.VertexAttribPointer(r.TextureLoc, 2, gl.FLOAT, false, 5*4, gl.PtrOffset(3*4))
	m := mgl32.Translate3D(x, y, 0.0).Mul4(mgl32.HomogRotate3DZ(rot))
	gl.UniformMatrix4fv(r.ModelViewLoc, 1, false, &m[0])
	gl.Uniform2f(r.TexOffsetLoc, batch.textureOffset.X(), batch.textureOffset.Y())
	gl.DrawArrays(gl.TRIANGLES, 0, int32(batch.Count))
	gl.BindBuffer(gl.ARRAY_BUFFER, 0)
	return nil
}
开发者ID:pikkpoiss,项目名称:twodee,代码行数:14,代码来源:renderer_batch.go


示例16: DrawRectangle

func (c Context) DrawRectangle(x, y, w, h float32, color Color) {

	gl.UseProgram(c.program)
	model := mgl32.Translate3D(x, y, 0).Mul4(mgl32.Scale3D(w, h, 0))
	modelUniform := gl.GetUniformLocation(c.program, gl.Str("model\x00"))
	gl.UniformMatrix4fv(modelUniform, 1, false, &model[0])

	colorArray := []float32{color.B, color.G, color.R}

	colorUniform := gl.GetUniformLocation(c.program, gl.Str("color\x00"))
	gl.Uniform4fv(colorUniform, 1, &colorArray[0])

	gl.DrawArrays(gl.TRIANGLES, 0, 6)
}
开发者ID:esenti,项目名称:godraw,代码行数:14,代码来源:godraw.go


示例17: ExampleReseed

func ExampleReseed() {
	stack := NewTransformStack()

	scale := mgl32.Scale3D(2, 2, 2)
	rot := mgl32.HomogRotate3DY(mgl32.DegToRad(90))
	trans := mgl32.Translate3D(4, 5, 6)

	stack.Push(trans)
	stack.Push(rot)
	stack.Push(scale)

	fmt.Println("Initial state:\n", stack.Peek())

	trans2 := mgl32.Translate3D(1, 2, 3)

	err := stack.Reseed(1, trans2)
	if err == nil {
		panic("Rebase failed")
	}

	fmt.Println("After rebase:\n", stack.Peek())
	fmt.Println("Should be:\n", trans2.Mul4(rot).Mul4(scale))
}
开发者ID:rdterner,项目名称:mathgl,代码行数:23,代码来源:transformstack_test.go


示例18: Render

// Render renders the bitmap with the center at given position
func (renderable *SimpleBitmapRenderable) Render(context *RenderContext, icons []PlacedIcon) {
	gl := renderable.gl

	renderable.withShader(func() {
		renderable.setMatrix(renderable.viewMatrixUniform, context.ViewMatrix())
		renderable.setMatrix(renderable.projectionMatrixUniform, context.ProjectionMatrix())

		gl.EnableVertexAttribArray(uint32(renderable.vertexPositionAttrib))
		gl.BindBuffer(opengl.ARRAY_BUFFER, renderable.vertexPositionBuffer)
		gl.VertexAttribOffset(uint32(renderable.vertexPositionAttrib), 3, opengl.FLOAT, false, 0, 0)
		gl.EnableVertexAttribArray(uint32(renderable.uvPositionAttrib))
		gl.BindBuffer(opengl.ARRAY_BUFFER, renderable.uvPositionBuffer)
		gl.VertexAttribOffset(uint32(renderable.uvPositionAttrib), 3, opengl.FLOAT, false, 0, 0)

		textureUnit := int32(0)
		gl.ActiveTexture(opengl.TEXTURE0 + uint32(textureUnit))
		gl.BindTexture(opengl.TEXTURE_2D, renderable.paletteTexture.Handle())
		gl.Uniform1i(renderable.paletteUniform, textureUnit)

		textureUnit = 1
		gl.ActiveTexture(opengl.TEXTURE0 + uint32(textureUnit))
		gl.Uniform1i(renderable.bitmapUniform, textureUnit)
		for _, icon := range icons {
			x, y := icon.Center()
			u, v := icon.Icon().UV()
			width, height := renderable.limitedSize(icon)
			modelMatrix := mgl.Ident4().
				Mul4(mgl.Translate3D(x, y, 0.0)).
				Mul4(mgl.Scale3D(width, height, 1.0))

			renderable.setMatrix(renderable.modelMatrixUniform, &modelMatrix)

			var uv = []float32{
				0.0, 0.0, 0.0,
				u, 0.0, 0.0,
				u, v, 0.0,

				u, v, 0.0,
				0.0, v, 0.0,
				0.0, 0.0, 0.0}
			gl.BindBuffer(opengl.ARRAY_BUFFER, renderable.uvPositionBuffer)
			gl.BufferData(opengl.ARRAY_BUFFER, len(uv)*4, uv, opengl.STATIC_DRAW)

			gl.BindTexture(opengl.TEXTURE_2D, icon.Icon().Handle())
			gl.DrawArrays(opengl.TRIANGLES, 0, 6)
		}
		gl.BindTexture(opengl.TEXTURE_2D, 0)
	})
}
开发者ID:inkyblackness,项目名称:shocked-client,代码行数:50,代码来源:SimpleBitmapRenderable.go


示例19: NewTextureRenderable

// NewTextureRenderable returns a new instance of a texture renderable
func NewTextureRenderable(gl opengl.OpenGl, positionX, positionY float32, displaySize float32,
	paletteTexture graphics.Texture, bitmapTexture graphics.Texture) *TextureRenderable {
	vertexShader, err1 := opengl.CompileNewShader(gl, opengl.VERTEX_SHADER, textureVertexShaderSource)
	defer gl.DeleteShader(vertexShader)
	fragmentShader, err2 := opengl.CompileNewShader(gl, opengl.FRAGMENT_SHADER, textureFragmentShaderSource)
	defer gl.DeleteShader(fragmentShader)
	program, _ := opengl.LinkNewProgram(gl, vertexShader, fragmentShader)

	if err1 != nil {
		fmt.Fprintf(os.Stderr, "Failed to compile shader 1:\n", err1)
	}
	if err2 != nil {
		fmt.Fprintf(os.Stderr, "Failed to compile shader 2:\n", err2)
	}

	renderable := &TextureRenderable{
		gl:      gl,
		program: program,
		modelMatrix: mgl.Ident4().
			Mul4(mgl.Translate3D(positionX, positionY, 0.0)).
			Mul4(mgl.Scale3D(displaySize, displaySize, 1.0)),

		vertexArrayObject:       gl.GenVertexArrays(1)[0],
		vertexPositionBuffer:    gl.GenBuffers(1)[0],
		vertexPositionAttrib:    gl.GetAttribLocation(program, "vertexPosition"),
		modelMatrixUniform:      gl.GetUniformLocation(program, "modelMatrix"),
		viewMatrixUniform:       gl.GetUniformLocation(program, "viewMatrix"),
		projectionMatrixUniform: gl.GetUniformLocation(program, "projectionMatrix"),
		paletteTexture:          paletteTexture,
		paletteUniform:          gl.GetUniformLocation(program, "palette"),
		bitmapTexture:           bitmapTexture,
		bitmapUniform:           gl.GetUniformLocation(program, "bitmap")}

	renderable.withShader(func() {
		gl.BindBuffer(opengl.ARRAY_BUFFER, renderable.vertexPositionBuffer)
		limit := float32(1.0)
		var vertices = []float32{
			0.0, 0.0, 0.0,
			limit, 0.0, 0.0,
			limit, limit, 0.0,

			limit, limit, 0.0,
			0.0, limit, 0.0,
			0.0, 0.0, 0.0}
		gl.BufferData(opengl.ARRAY_BUFFER, len(vertices)*4, vertices, opengl.STATIC_DRAW)
	})

	return renderable
}
开发者ID:inkyblackness,项目名称:shocked-client,代码行数:50,代码来源:TextureRenderable.go


示例20: GetUpdatedModel

func (this *Transform) GetUpdatedModel() mathgl.Mat4 {
	Model := this.model
	Model = Model.Mul4(mathgl.Translate3D(float32(this.X), float32(this.Y), float32(this.Z)))
	// Model = Model.Mul4(mathgl.HomogRotate3DZ(float32(s.rot)))
	// Model = Model.Mul4(mathgl.HomogRotate3D(s.Rot, mathgl.Vec3{s.XR, s.YR, s.ZR}))

	// Euler rotation is easy.. no quaternions yet.. what a pain.
	Model = Model.Mul4(mathgl.Rotate3DX(this.XR * this.Rot).Mat4())
	Model = Model.Mul4(mathgl.Rotate3DY(this.YR * this.Rot).Mat4())
	Model = Model.Mul4(mathgl.Rotate3DZ(this.ZR * this.Rot).Mat4())

	Model = Model.Mul4(mathgl.Scale3D(float32(this.XS), float32(this.YS), float32(this.ZS)))

	return Model
}
开发者ID:Triangle345,项目名称:GT,代码行数:15,代码来源:Transform.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang mgl32.Mat4类代码示例发布时间:2022-05-23
下一篇:
Golang mgl32.Scale3D函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap