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

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 = -LIGHTING:GetSunDirection()
	self.ViewportFrame.Ambient = LIGHTING.Ambient
	self.ViewportFrame.LightColor = Color3.new(0, 0, 0)
	self.ViewportFrame.CurrentCamera = self.Camera
	self.ViewportFrame.Parent = surfaceGUI

	self.SkyboxFrame = VPF:Clone()
	self.SkyboxFrame.Name = "SkyboxFrame"
	self.SkyboxFrame.ZIndex = 1
	self.SkyboxFrame.LightDirection = -LIGHTING:GetSunDirection()
	self.SkyboxFrame.Ambient = LIGHTING.Ambient
	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
