示例#1
0
func (self *Graphical) checkDefaultsOnVisual(component *components.Visual) {
	// Ensure we load something for this Visual.
	if component.Mesh == nil && component.MeshName == "" {
		component.MeshName = render.DefaultMeshName
	}

	if component.MaterialName == "" {
		component.MaterialName = render.DefaultMaterialName
	}
}
示例#2
0
// SkyBox returns an Entity that is set up as a SkyBox. The material given
// needs to be the name of a cube-map Material definition. The resulting entity
// will be position-locked to the passed in camera so that it never looks like
// it's moving.
func SkyBox(skyboxMaterial string, camera *core.Camera) *core.Entity {
	entity := core.NewEntity()
	entity.Name = "Skybox " + skyboxMaterial

	visual := new(components.Visual)
	visual.MeshName = "SkyBoxMesh"
	visual.MaterialName = skyboxMaterial

	transform := components.GetTransform(entity)
	transform.UsingPositionOf = camera.Entity
	transform.Scale = math3d.Vector{20, 20, 20}

	entity.AddComponent(visual)

	return entity
}