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


Golang Mat4.Multiply方法代码示例

本文整理汇总了Golang中github.com/runningwild/mathgl.Mat4.Multiply方法的典型用法代码示例。如果您正苦于以下问题:Golang Mat4.Multiply方法的具体用法?Golang Mat4.Multiply怎么用?Golang Mat4.Multiply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/runningwild/mathgl.Mat4的用法示例。


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

示例1: Render

func Render(x, y, dx, dy float64) {
	var run, op mathgl.Mat4
	run.Identity()
	op.Translation(float32(x), float32(y), 0)
	run.Multiply(&op)
	op.Scaling(float32(dx), float32(dy), 1)
	run.Multiply(&op)

	gl.PushMatrix()
	gl.Enable(gl.TEXTURE_2D)
	gl.MultMatrixf((*gl.Float)(&run[0]))
	gl.CallList(textureList)
	gl.PopMatrix()
}
开发者ID:dgthunder,项目名称:magnus,代码行数:14,代码来源:manager.go

示例2: RenderAdvanced

func RenderAdvanced(x, y, dx, dy, rot float64, flip bool) {
	setupTextureList()
	if textureList == 0 {
		return
	}
	var run, op mathgl.Mat4
	run.Identity()
	op.Translation(float32(x), float32(y), 0)
	run.Multiply(&op)
	op.Translation(float32(dx/2), float32(dy/2), 0)
	run.Multiply(&op)
	op.RotationZ(float32(rot))
	run.Multiply(&op)
	if flip {
		op.Translation(float32(-dx/2), float32(-dy/2), 0)
		run.Multiply(&op)
		op.Scaling(float32(dx), float32(dy), 1)
		run.Multiply(&op)
	} else {
		op.Translation(float32(dx/2), float32(-dy/2), 0)
		run.Multiply(&op)
		op.Scaling(float32(-dx), float32(dy), 1)
		run.Multiply(&op)
	}
	gl.PushMatrix()
	gl.MultMatrixf((*gl.Float)(&run[0]))
	gl.Enable(gl.TEXTURE_2D)
	gl.CallList(textureList)
	gl.PopMatrix()
}
开发者ID:runningwild,项目名称:jbot,代码行数:30,代码来源:manager.go

示例3: render


//.........这里部分代码省略.........
		new_state.room.dy = room.Size.Dy
		if new_state != state {
			wt.setupGlStuff(room.X, room.Y, room.Size.Dx, room.Size.Dy, &ids)
			room.wall_texture_gl_map[wt] = ids
			room.wall_texture_state_map[wt] = new_state
		}
		gl.LoadMatrixf(&floor[0])
		if ids.vbuffer != 0 {
			wt.Texture.Data().Bind()
			R, G, B, A := wt.Color()

			gl.ClientActiveTexture(gl.TEXTURE0)
			gl.BindBuffer(gl.ARRAY_BUFFER, ids.vbuffer)
			gl.VertexPointer(3, gl.FLOAT, gl.Sizei(unsafe.Sizeof(vert)), gl.Pointer(unsafe.Offsetof(vert.x)))
			gl.TexCoordPointer(2, gl.FLOAT, gl.Sizei(unsafe.Sizeof(vert)), gl.Pointer(unsafe.Offsetof(vert.u)))
			gl.ClientActiveTexture(gl.TEXTURE1)
			gl.TexCoordPointer(2, gl.FLOAT, gl.Sizei(unsafe.Sizeof(vert)), gl.Pointer(unsafe.Offsetof(vert.los_u)))
			gl.ClientActiveTexture(gl.TEXTURE0)
			if ids.floor_buffer != 0 {
				gl.StencilFunc(gl.ALWAYS, 2, 2)
				gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, ids.floor_buffer)
				gl.Color4ub(R, G, B, A)
				gl.DrawElements(gl.TRIANGLES, ids.floor_count, gl.UNSIGNED_SHORT, nil)
			}
			if ids.left_buffer != 0 {
				gl.StencilFunc(gl.ALWAYS, 1, 1)
				gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, ids.left_buffer)
				do_color(R, G, B, alphaMult(A, room.far_left.wall_alpha))
				gl.DrawElements(gl.TRIANGLES, ids.left_count, gl.UNSIGNED_SHORT, nil)
			}
			if ids.right_buffer != 0 {
				gl.StencilFunc(gl.ALWAYS, 1, 1)
				gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, ids.right_buffer)
				do_color(R, G, B, alphaMult(A, room.far_right.wall_alpha))
				gl.DrawElements(gl.TRIANGLES, ids.right_count, gl.UNSIGNED_SHORT, nil)
			}
		}
	}
	base.EnableShader("marble")
	base.SetUniformI("marble", "tex2", 1)
	base.SetUniformF("marble", "room_x", float32(room.X))
	base.SetUniformF("marble", "room_y", float32(room.Y))
	for _, door := range room.Doors {
		door.setupGlStuff(room)
		if door.threshold_glids.vbuffer == 0 {
			continue
		}
		if door.AlwaysOpen() {
			continue
		}
		if door.highlight_threshold {
			gl.Color4ub(255, 255, 255, 255)
		} else {
			gl.Color4ub(128, 128, 128, 255)
		}
		gl.BindBuffer(gl.ARRAY_BUFFER, door.threshold_glids.vbuffer)
		gl.VertexPointer(3, gl.FLOAT, gl.Sizei(unsafe.Sizeof(vert)), gl.Pointer(unsafe.Offsetof(vert.x)))
		gl.TexCoordPointer(2, gl.FLOAT, gl.Sizei(unsafe.Sizeof(vert)), gl.Pointer(unsafe.Offsetof(vert.u)))
		gl.ClientActiveTexture(gl.TEXTURE1)
		gl.TexCoordPointer(2, gl.FLOAT, gl.Sizei(unsafe.Sizeof(vert)), gl.Pointer(unsafe.Offsetof(vert.los_u)))
		gl.ClientActiveTexture(gl.TEXTURE0)
		gl.BindBuffer(gl.ELEMENT_ARRAY_BUFFER, door.threshold_glids.floor_buffer)
		gl.DrawElements(gl.TRIANGLES, door.threshold_glids.floor_count, gl.UNSIGNED_SHORT, nil)
	}
	base.EnableShader("")
	if los_tex != nil {
		base.EnableShader("")
		gl.ActiveTexture(gl.TEXTURE1)
		gl.Disable(gl.TEXTURE_2D)
		gl.ActiveTexture(gl.TEXTURE0)
		gl.ClientActiveTexture(gl.TEXTURE1)
		gl.DisableClientState(gl.TEXTURE_COORD_ARRAY)
		gl.ClientActiveTexture(gl.TEXTURE0)
	}

	run.Assign(&floor)
	mul.Translation(float32(-room.X), float32(-room.Y), 0)
	run.Multiply(&mul)
	gl.LoadMatrixf(&run[0])
	gl.StencilFunc(gl.EQUAL, 2, 3)
	gl.StencilOp(gl.KEEP, gl.KEEP, gl.KEEP)
	room_rect := image.Rect(room.X, room.Y, room.X+room.Size.Dx, room.Y+room.Size.Dy)
	for _, fd := range floor_drawers {
		x, y := fd.Pos()
		dx, dy := fd.Dims()
		if room_rect.Overlaps(image.Rect(x, y, x+dx, y+dy)) {
			fd.RenderOnFloor()
		}
	}

	do_color(255, 255, 255, 255)
	gl.LoadIdentity()
	gl.Disable(gl.STENCIL_TEST)
	room.renderFurniture(floor, 255, drawables, los_tex)

	gl.ClientActiveTexture(gl.TEXTURE1)
	gl.Disable(gl.TEXTURE_2D)
	gl.ClientActiveTexture(gl.TEXTURE0)
	base.EnableShader("")
}
开发者ID:RickDakan,项目名称:haunts,代码行数:101,代码来源:room.go


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