Skip to content

Smoothly scale first background image section on left based on the first visible 3D pixel #2

Description

@cartland

Smoothly scale first background image section on left based on the first visible 3D pixel.

The current implementation does integer multiple scaling based on bgIndexStep.

  • This fails if the background image width is smaller than the initial width because bgIndexStep is truncated to 0.
  • This "works" if the background image is an integer multiple of the initial width, because bgIndexStep will be an integer multiple
  • The background image is clipped because bgIndexStep is floored to an int value.

The solution should involve making bgIndexStep a float value.

// Skip initial consecutive places that reference negative-indexed pixels.
initialWidth := 0
for ; sourceIndexes[initialWidth] < 0; initialWidth++ {
}
// TODO: Make bgIndexStep a float value so that 
bgIndexStep := bgWidth / initialWidth

// Map background onto the first section on left.
var bgIndexes = make([]int, dmWidth)
for x := 0; x < initialWidth; x++ {
	bgIndexes[x] = x * bgIndexStep
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions