Using resource.create_buffer to uniquely create different mesh. But getting texture correctly only in one mesh and in others getting texture in rotated.
local uuid = require("game.uuid.src.uuid")
go.property("Type", hash("WALL"))
go.property("Width", 0)
go.property("Height", 0)
go.property("Left", 0)
go.property("Right", 0)
go.property("Top", 0)
go.property("Bottom", 0)
go.property("Adjacent_1", hash("adjacent wall id"))
go.property("Adjacent_2", hash("adjacent wall id"))
-- go.property("my_texture", resource.texture("/assets/background-elements-redux-fix/Backgrounds/backgroundCastles.png"))
-- wall types
-- WALL / FLOOR / LEFT_WALL / RIGHT_WALL / LEFT_ROOM_DIVIDER / RIGHT_ROOM_DIVIDER / LEFT_WALL_DIVIDER / RIGHT_WALL_DIVIDER
local function fill_positions(self, v0, v1, v2, v3)
	-- first triangle
	self.positions[1] = v0.x
	self.positions[2] = v0.y
	self.positions[3] = v0.z
	self.positions[4] = v1.x
	self.positions[5] = v1.y
	self.positions[6] = v1.z
	self.positions[7] = v2.x
	self.positions[8] = v2.y
	self.positions[9] = v2.z
	-- second triangle
	self.positions[10] = v0.x
	self.positions[11] = v0.y
	self.positions[12] = v0.z
	self.positions[13] = v2.x
	self.positions[14] = v2.y
	self.positions[15] = v2.z
	self.positions[16] = v3.x
	self.positions[17] = v3.y
	self.positions[18] = v3.z
end
local function vertex_position(self)
	--for wall
	-- right 640  top 960
	local v0, v1, v2, v3 = vmath.vector3()
	if self.Type == hash("WALL") then
		v3 = vmath.vector3(self.origin.x, self.Height, 0)
		v2 = vmath.vector3(self.Width, self.Height, 0)
		v1 = vmath.vector3(self.Width, self.origin.y, 0)
		v0 = vmath.vector3(self.origin.x, self.origin.y, 0)
	elseif self.Type == hash("FLOOR") then
		v0 = vmath.vector3(self.Left- self.Left, self.Bottom, 0)
		v1 = vmath.vector3(self.Left, self.Top, 0)
		v2 = vmath.vector3(self.Right, self.Top, 0)
		v3 = vmath.vector3(self.Right + self.Left, self.Bottom, 0)
	end
	return v0, v1, v2, v3
end
function init(self)
	self.origin = go.get_world_position()
	local res = go.get("#front", "vertices")
	local buf = resource.get_buffer(res)
	-- -- create a cloned buffer resource from another resource buffer
	local res_path = "buf-" .. uuid() .. ".bufferc"
	local cloned_res = resource.create_buffer(res_path, { buffer = buf})
	local new_buffer = resource.get_buffer(cloned_res)
	self.positions = buffer.get_stream(new_buffer, "position")
	self.v0, self.v1, self.v2, self.v3 = vertex_position(self)
	fill_positions(self, self.v0, self.v1, self.v2, self.v3)
	local data = sys.load_resource('/assets/background-elements-redux-fix/Backgrounds/backgroundColorForest.png') 
	imageloader.load{
		data = data,
		listener = function(self, image_resource)
			pprint(image_resource)
			resource.set_texture( go.get("#front", "texture0"), image_resource.header, image_resource.buffer )
		end
	}
	-- assign cloned buffer to a mesh component
	go.set("#front", "vertices", cloned_res)
end
function update(self, dt)
end
function on_message(self, message_id, message, sender)
end





