--an object that represents a positioned boost that will temporarily increase the players speed
plugin Helper CRBoost
    name:"CRBoost"
    classID:#(0x40a5c7ce, 0x24ead9bf)
    category:"CableRacer"
    extends:BoxGizmo
    replaceUI:true
(
    parameters main rollout:params
    (
        lengthCustom type:#float ui:lengthSpinner default:0
        widthCustom type:#float ui:widthSpinner default:0
        heightCustom type:#float ui:heightSpinner default:0
    )

    rollout params "Boost Parameters"
    (
        group "Object size"
        (
            spinner lengthSpinner "Length" range:[-10000000, 10000000, 0]
            spinner widthSpinner "Width" range:[-10000000, 10000000, 0]
            spinner heightSpinner "Height" range:[-10000000, 10000000, 0]
        )

        on lengthSpinner changed val do
        (
            delegate.length = val

        )

        on widthSpinner changed val do
        (
            delegate.width = val
        )

        on heightSpinner changed val do
        (
            delegate.height = val
            centerPivot $
        )
    )
    
    tool create
    (
        on mousePoint click do
        (
            case click of
            (
                1:
                (
                    nodeTM.translation = gridPoint
                )
                3:
                (
                    #stop
                )
            )
        )

        on mouseMove click do
        (
            case click of
            (
                2:
                (
                    delegate.length = lengthCustom = gridDist.y * 2
                    delegate.width = widthCustom = gridDist.x * 2
                )
                3:
                (
                    delegate.height = heightCustom = gridDist.y
                    centerPivot $
                )
            )
        )
    )
)





--an object that represents an area in which a certain HDRI multiplier is desired
plugin Helper CRHDRI
    name:"CRHDRI"
    classID:#(0x123d0708, 0x7f8829d6)
    category:"CableRacer"
    extends:SphereGizmo
    replaceUI:true
(
    parameters main rollout:params
    (
		hdriMultiplier type:#float ui:hdriMultiplierSpinner default:2
		borderHdriMultiplier type:#float ui:borderHdriMultiplierSpinner default:1.429
		centreSizeFraction type:#float ui:centreSizeFractionSpinner default:0.5
    )

    rollout params "HDRI settings"
    (
		spinner hdriMultiplierSpinner "Centre HDRI" range:[-100, 100, 2]
		spinner borderHdriMultiplierSpinner "Border HDRI" range:[-100, 100, 1.429]
		spinner centreSizeFractionSpinner "Centre size" range:[0, 1, 0.5]
		label info1 "Centre size is a fraction of"
		label info2 "the total size. From centre to"
		label info3 "border, the two HDRI values are"
		label info4 "interpolated."
    )
    
    tool create
    (
        on mousePoint click do
        (
            case click of
            (
            1: nodeTM.translation = gridPoint
            2: #stop
            )
        )

        on mouseMove click do
        (
            delegate.radius = length [gridDist.x, gridDist.y]
        )
    )
)





--an object that represents an area in which the vehicle is considered to be in shadow
plugin Helper CRShadow
    name:"CRShadow"
    classID:#(0x35002513, 0x767d9778)
    category:"CableRacer"
    extends:SphereGizmo
    replaceUI:true
(
    parameters main rollout:params
    (
		centreShadowMultiplier type:#float ui:centreShadowMultiplierSpinner default:0.5
		borderShadowMultiplier type:#float ui:borderShadowMultiplierSpinner default:1
		centreSizeFraction type:#float ui:centreSizeFractionSpinner default:0.5
    )

    rollout params "Shadow settings"
    (
        spinner centreShadowMultiplierSpinner "Centre shadow" range:[-100, 100, 0.5]
        spinner borderShadowMultiplierSpinner "Border shadow" range:[-100, 100, 1]
        spinner centreSizeFractionSpinner "Centre size" range:[0, 1, 0.5]
        label info1 "Centre size is a fraction of"
		label info2 "the total size. From centre to"
		label info3 "border, the two shadow values"
		label info4 "are interpolated."
    )
    
    tool create
    (
        on mousePoint click do
        (
            case click of
            (
            1: nodeTM.translation = gridPoint
            2: #stop
            )
        )

        on mouseMove click do
        (
            delegate.radius = length [gridDist.x, gridDist.y]
        )
    )
)





--This material adds some extra parameters to a 3dsmax Standard Material.
plugin Material CRExtendedMaterial
    name:"CRExtendedMaterial"
    classID:#(0x4415ffb1, 0x108d7f46)
    extends:Standard
    replaceUI:false
(
	local filtering1Names = #("point", "bilinear")
	local filtering1Aliases = #("point point", "linear linear")
	local filtering2Names = #("none", "point", "linear")

	parameters main rollout:params
    (
    	filtering1Index type:#radiobtnIndex ui:filtering1RadioButtons	default:2
    	filtering2Index type:#radiobtnIndex ui:filtering2RadioButtons	default:2
		noLighting		type:#boolean		ui:noLightingCheckbox		default:false
		doubleSided		type:#boolean		ui:doubleSidedCheckbox		default:false
    )

	rollout params "CableRacer Material"
    (
    	group "Filtering:"
    	(
    		RadioButtons filtering1RadioButtons "filtering:" labels:filtering1Names default:2
    		RadioButtons filtering2RadioButtons "mipmapping:" labels:filtering2Names default:2
    	)
    	group "Other:"
    	(
			Checkbox noLightingCheckbox "No lighting" default:false
			Checkbox doubleSidedCheckbox "Double sided" default:false
    	)
    )
)





--These parameters can be added to a mesh to make it define
--the sound it wants to use when a vehicle crashes into it.
obstacleAttributes = attributes CRObstacleAttributesDefinition attribID:#(0x3ef0d9df, 0xe15d5f6)
(
	parameters main rollout:params
	(
		crashSound type:#string ui:crashSoundEditText default:""
	)
	rollout params "CRObstacleParameters"
	(
    	group "Crash sound group:"
    	(
			editText crashSoundEditText ""
    	)
	)
)