#usda 1.0

class "_class_UnitCube" {
    int[] faceVertexIndices = [0, 1, 3, 2, 2, 3, 5, 4, 4, 5, 7, 6, 6, 7, 1, 0, 1, 7, 5, 3, 6, 0, 2, 4]
    int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
    point3f[] points = [(-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (-0.5, -0.5, -0.5), (0.5, -0.5, -0.5)]
    float3[] extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
}

class "_class_Rotate45" {
    custom matrix4d xformOp:transform = ((1, 0, 0, 0), 
                                        (0.0, 0.70710678118654746, 0.70710678118654757, 0.0),
                                        (0.0, -0.70710678118654757, 0.70710678118654746, 0.0),
                                        (0.0, 0.0, 0.0, 1.0))
    uniform token[] xformOpOrder = ["xformOp:transform"]
}

def Scope "pCube1"
{
    def Mesh "pCubeShape1" (inherits=</_class_UnitCube>)
    {
        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (4,5,6,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]
    }
}

# Meshes with invisible parents should be ignored by the bounding box visitor.
def Scope "invisCube1"
{
    def Mesh "invisCubeShape1" (inherits=</_class_UnitCube>)
    {
        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (10,11,12,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]
    }
}

def Xform "_parent" (kind = "group")
{
    custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (1,1,1,1))

    matrix4d xformOp:transform.timeSamples = {
        1: ((1,0,0,0), (0,1,0,0), (0,0,1,0), (2,2,2,1)),
    }
    uniform token[] xformOpOrder = ["xformOp:transform"]

    def Xform "primWithLocalXform" (kind = "component")
    {
        custom float3[] extentsHint = [(-1.5, -1.5, -1.5), (-0.5, -0.5, -0.5),
                                      (-0.5, -2.5, -3.5), (0.5, -1.5, -2.5),
                                      (1.5, -2.5, -3.5), (2.5, -1.5, -2.5),
                                      (-2.5, -2.5, -3.5), (-1.5, -1.5, -2.5)]
        float3[] extentsHint.timeSamples = {
            0: [(-1.5, -1.5, -1.5), (-0.5, -0.5, -0.5),
                (-0.5, -2.5, -3.5), (0.5, -1.5, -2.5),
                (1.5, -2.5, -3.5), (2.5, -1.5, -2.5),
                (-2.5, -2.5, -3.5), (-1.5, -1.5, -2.5)],
        }

        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (1,1,1,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]

        def Mesh "Child" (inherits=</_class_UnitCube>) 
        {
            custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (-1,-1,-1,1))
            uniform token[] xformOpOrder = ["xformOp:transform"]
        }

        def Xform "InvisibleChild"
        {
            token visibility = "invisible"
            custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (-1,-1,-1,1))
            uniform token[] xformOpOrder = ["xformOp:transform"]

            def Mesh "NestedVisible" (inherits=</_class_UnitCube>)
            {
                custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (7,0,0,1))
                uniform token[] xformOpOrder = ["xformOp:transform"]
                color3f modelingColor = (0,1,0)
            }

            def Mesh "NestedInvisible" (inherits=</_class_UnitCube>)
            {
                token visibility = "invisible"
                custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (7,0,0,1))
                uniform token[] xformOpOrder = ["xformOp:transform"]
                color3f modelingColor = (0,0,1)
            }
        }

        def Mesh "PurposeIsGuide" (inherits=</_class_UnitCube>)
        {
            token purpose = "guide"
            custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (-2,-2,-3,1))
            uniform token[] xformOpOrder = ["xformOp:transform"]
            color3f modelingColor = (1,1,0)
        }

        def Mesh "PurposeIsRender" (inherits=</_class_UnitCube>) 
        {
            token purpose = "render"
            custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (0, -2,-3,1))
            uniform token[] xformOpOrder = ["xformOp:transform"]
            color3f modelingColor = (1,0,1)
        }

        def Mesh "PurposeIsProxy" (inherits=</_class_UnitCube>) 
        {
            token purpose = "proxy"
            custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (2,-2,-3,1))
            uniform token[] xformOpOrder = ["xformOp:transform"]
            color3f modelingColor = (0,1,1)
        }

    }
}

def "instanced_parent" (
    instanceable = true
    references = </_parent>
)
{
    custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (1,1,1,1))

    matrix4d xformOp:transform.timeSamples = {
        1: ((1,0,0,0), (0,1,0,0), (0,0,1,0), (11,18,82,1)),
    }
    uniform token[] xformOpOrder = ["xformOp:transform"]
}

def "uninstanced_parent" (
    instanceable = false
    references = </_parent>
)
{
    custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (1,1,1,1))

    matrix4d xformOp:transform.timeSamples = {
        1: ((1,0,0,0), (0,1,0,0), (0,0,1,0), (11,18,82,1)),
    }
    uniform token[] xformOpOrder = ["xformOp:transform"]
}

def Scope "_Rotated"
{
    def Xform "Trans"
    {
        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (4,-4,0,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]

        def Xform "Rot45" (inherits=</_class_Rotate45>)
        {
            def Mesh "Cube" (inherits=</_class_UnitCube>)
            {
                color3f modelingColor = (1,0,0)
            }
        }
    }

    def Xform "Rotate90"
    {
        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (0,-4,0,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]

        def Xform "Rot45" (inherits=</_class_Rotate45>)
        {
            def Mesh "CubeRot45" (inherits=[</_class_UnitCube>, </_class_Rotate45>])
            {
                color3f modelingColor = (1,0,0)
            }
        }
    }
    def Xform "Rotate135"
    {
        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (8,-4,0,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]

        def Xform "Rot45" (inherits=</_class_Rotate45>)
        {
            def Xform "Rot45" (inherits=</_class_Rotate45>)
            {
                def Xform "Rot45" (inherits=</_class_Rotate45>)
                {
                    def Mesh "CubeRot45" (inherits=[</_class_UnitCube>, </_class_Rotate45>])
                    {
                        color3f modelingColor = (1,0,0)
                    }
                }
            }
        }
    }

    def Xform "Rotate135AndTranslate"
    {
        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (8,-4,0,1))
        uniform token[] xformOpOrder = ["xformOp:transform"]

        def Xform "Rot45" (inherits=</_class_Rotate45>)
        {
            def Xform "Rot45" (inherits=</_class_Rotate45>)
            {
                def Xform "Rot45" (inherits=</_class_Rotate45>)
                {
                    def Mesh "CubeTrans" (inherits=[</_class_UnitCube>])
                    {
                        custom matrix4d xformOp:transform = ((1,0,0,0), (0,1,0,0), (0,0,1,0), (-8,4,0,1))
                        uniform token[] xformOpOrder = ["xformOp:transform"]
                        color3f modelingColor = (1,0,0)
                    }
                }

                def Mesh "CubeTrans" (inherits=[</_class_UnitCube>])
                {
                    color3f modelingColor = (1,0,0)
                    custom matrix4d xformOp:transform = ((1, 0, 0, 0), 
                                           (0.0, 0.70710678118654746, 0.70710678118654757, 0.0),
                                           (0.0, -0.70710678118654757, 0.70710678118654746, 0.0),
                                           (-8,4,0,1))
                    uniform token[] xformOpOrder = ["xformOp:transform"]

                }
            }
        }
    }

}

def "instanced_Rotated" (
    instanceable = true
    references = </_Rotated>
)
{
}

def "uninstanced_Rotated" (
    instanceable = false
    references = </_Rotated>
)
{
}
