#pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include "FQLightgrid.h" #include "UQLightgridUpdaterComponent.generated.h" // Indicates that the actor this is attached to is a concept that can affect cbot cognition. // This can be as simple as a tagged actor that a cbot might decide to do a voiceline or animation on ("wow look at that very small crate") // or it might indicate that this is a sovereign actor who will be causing interactions in the world. UCLASS(BlueprintType, ClassGroup = (cbots), meta = (BlueprintSpawnableComponent)) class CADU_API UQLightgridUpdaterComponent : public UActorComponent { GENERATED_BODY() public: UQLightgridUpdaterComponent(const FObjectInitializer& init); virtual void BeginPlay() override; virtual void TickComponent(float delta, enum ELevelTick tick, FActorComponentTickFunction* tickFunc) override; public: UPROPERTY(BlueprintReadOnly, EditAnywhere) UDataTable* lightgridMeta; UPROPERTY(BlueprintReadOnly, EditAnywhere) UDataTable* lightgridCells; UPROPERTY(BlueprintReadOnly, EditAnywhere) int metaRowIdx; UPROPERTY(BlueprintReadOnly, EditAnywhere) FName lightgridParamName; // if false, neartest grid cell colors will be used. This is similar to how Dark Engine looks. UPROPERTY(BlueprintReadWrite, EditAnywhere) bool useTrilerp = true; // If >0 and useTrilerp is true, this will "step" the resultant lerped value so that it's not a smooth gradient. // If <=0 or !useTrilerp, this has no effect. // A value of 1 is the same as not using trilerp, since each cell is considered to have one "step" inside. // A value of 10 approximates every cell as if it has 10 possible interpolated positions inside (interpolating with its neighbors). // A value of 2-4 here is usually about right for aesthetic purposes. Anything much higher and the effect is invisible, and much lower might as well just not trilerp. // As a direct comparison; // * Dark Engine = !useTrilerp // * Goldsrc = useTrilerp, trilerpSteps=2.5 // * q3 = useTrilerp, trilerpSteps=0 UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(UIMin=1.5, UIMax=4)) float trilerpSteps = 2; protected: UFUNCTION(BlueprintCallable) void updateMaterials(AActor* actor, FVector colorOverride); UFUNCTION(BlueprintCallable) FVector getAmbientColorForLocation(FVector loc); UFUNCTION(BlueprintCallable) FVector trilerpCellColors(FVector indices, FQLightgridMeta meta); };