# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FBOutput

import tdw.flatbuffers

class Lights(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsLights(cls, buf, offset):
        n = tdw.flatbuffers.encode.Get(tdw.flatbuffers.packer.uoffset, buf, offset)
        x = Lights()
        x.Init(buf, n + offset)
        return x

    # Lights
    def Init(self, buf, pos):
        self._tab = tdw.flatbuffers.table.Table(buf, pos)

    # Lights
    def DirectionalLights(self, j):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .DirectionalLight import DirectionalLight
            obj = DirectionalLight()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Lights
    def DirectionalLightsLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Lights
    def PointLights(self, j):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .PointLight import PointLight
            obj = PointLight()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Lights
    def PointLightsLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def LightsStart(builder): builder.StartObject(2)
def LightsAddDirectionalLights(builder, directionalLights): builder.PrependUOffsetTRelativeSlot(0, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(directionalLights), 0)
def LightsStartDirectionalLightsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def LightsAddPointLights(builder, pointLights): builder.PrependUOffsetTRelativeSlot(1, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(pointLights), 0)
def LightsStartPointLightsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def LightsEnd(builder): return builder.EndObject()
