function ViewportWindow.new(l)local s=setmetatable({},ViewportWindow)s.SurfaceGUI=l s.Camera=Instance.new("\067\097\109\101\114\097",l)s.ViewportFrame=VPF:Clone()s.ViewportFrame.Name="\087\111\114\108\100\070\114\097\109\101"s.ViewportFrame.ZIndex=2 s.ViewportFrame.LightDirection=-game.Lighting:GetSunDirection()s.ViewportFrame.CurrentCamera=s.Camera s.ViewportFrame.Parent=l s.SkyboxFrame=VPF:Clone()s.SkyboxFrame.Name="\083\107\121\098\111\120\070\114\097\109\101"s.SkyboxFrame.ZIndex=1 s.SkyboxFrame.Ambient=Color3.new(1,1,1)s.SkyboxFrame.LightColor=Color3.new(0,0,0)s.SkyboxFrame.CurrentCamera=s.Camera s.SkyboxFrame.Parent=l return s end function ViewportWindow.fromPart(l,s,L)local Q=Instance.new("\083\117\114\102\097\099\101\071\117\105")Q.Face=s Q.CanvasSize=Vector2.new(1024,1024)Q.SizingMode=Enum.SurfaceGuiSizingMode.FixedSize Q.Adornee=l Q.ClipsDescendants=true Q.Parent=L return ViewportWindow.new(Q)end


function ViewportWindow.new(surfaceGUI)
	local self = setmetatable({}, ViewportWindow)
	
	self.SurfaceGUI = surfaceGUI
	self.Camera = Instance.new("Camera", surfaceGUI)
	self.ViewportFrame = VPF:Clone()
	self.ViewportFrame.Name = "WorldFrame"
	self.ViewportFrame.ZIndex = 2
	self.ViewportFrame.LightDirection = -game.Lighting:GetSunDirection()
	self.ViewportFrame.CurrentCamera = self.Camera
	self.ViewportFrame.Parent = surfaceGUI
	
	self.SkyboxFrame = VPF:Clone()
	self.SkyboxFrame.Name = "SkyboxFrame"
	self.SkyboxFrame.ZIndex = 1
	self.SkyboxFrame.Ambient = Color3.new(1, 1, 1)
	self.SkyboxFrame.LightColor = Color3.new(0, 0, 0)
	self.SkyboxFrame.CurrentCamera = self.Camera
	self.SkyboxFrame.Parent = surfaceGUI
	
	return self
end

function ViewportWindow.fromPart(part, normalId, parent)
	local surfaceGUI = Instance.new("SurfaceGui")
	surfaceGUI.Face = normalId
	surfaceGUI.CanvasSize = Vector2.new(1024, 1024)
	surfaceGUI.SizingMode = Enum.SurfaceGuiSizingMode.FixedSize
	surfaceGUI.Adornee = part
	surfaceGUI.ClipsDescendants = true
	surfaceGUI.Parent = parent
	
	return ViewportWindow.new(surfaceGUI)
end
