Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ static int* currentShader;
static int* g_currentDrawBucket;

static CRGBA outlineColor{ 255, 0, 255, 255 };

constexpr const char* DEFAULT_SHADER_TECHNIQUE_GROUP = "unlit";
static std::string g_shaderTechniqueGroupId = DEFAULT_SHADER_TECHNIQUE_GROUP;


class OutlineRenderer
{
Expand Down Expand Up @@ -432,7 +436,7 @@ static InitFunction initFunctionBuffers([]()
SetBlendState(GetStockStateIdentifier(BlendStateDefault));

last = *currentShader;
*currentShader = _getTechniqueDrawName("unlit");
*currentShader = _getTechniqueDrawName(g_shaderTechniqueGroupId.c_str());

// draw bucket 0 pls, not 1
// #TODO: set via DC?
Expand Down Expand Up @@ -604,6 +608,21 @@ static InitFunction initFunctionScriptBind([]()
}
});

fx::ScriptEngine::RegisterNativeHandler("SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE", [](fx::ScriptContext& context)
{
std::string techniqueGroupId = context.GetArgument<const char*>(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string techniqueGroupId = context.GetArgument<const char*>(0);
std::string techniqueGroupId = context.CheckArgument<const char*>(0);

Using CheckArgument here will make this error if index 0 is null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I thought the type checking in natives would handle that. I'll do some tests and fix it in upcoming commits

if (techniqueGroupId.empty())
{
return;
}
g_shaderTechniqueGroupId = techniqueGroupId;
});

fx::ScriptEngine::RegisterNativeHandler("RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE", [](fx::ScriptContext& context)
{
g_shaderTechniqueGroupId = DEFAULT_SHADER_TECHNIQUE_GROUP;
});

fx::ScriptEngine::RegisterNativeHandler("SET_ENTITY_MATRIX", [](fx::ScriptContext& context)
{
fwEntity* entity = rage::fwScriptGuid::GetBaseFromGuid(context.GetArgument<int>(0));
Expand Down
11 changes: 11 additions & 0 deletions ext/native-decls/sdk/ResetEntityDrawOutlineRenderTechnique.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
ns: CFX
apiset: client
game: gta5
---
## RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE

```c
void RESET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE();
```
This function undoes changes made by [`SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE`](#_0x68DFF2DD), restoring the original outline rendering behavior. The default render technique group is `unlit`.
64 changes: 64 additions & 0 deletions ext/native-decls/sdk/SetEntityDrawOutlineRenderTechnique.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
ns: CFX
apiset: client
game: gta5
---
## SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE

```c
void SET_ENTITY_DRAW_OUTLINE_RENDER_TECHNIQUE(char* techniqueGroup);
```
Sets the render technique for drawing an entity's outline. This function allows you to specify a technique group name to control how the entity's outline is rendered in the game.
Comment thread
prikolium-cfx marked this conversation as resolved.

List of known technique group's:
```
alt0
alt1
alt2
alt3
alt4
alt5
alt6
alt7
alt8
blit
cube
default
geometry
imposter
imposterdeferred
lightweight0
lightweight0CutOut
lightweight0CutOutTint
lightweight0WaterRefractionAlpha
lightweight4
lightweight4CutOut
lightweight4CutOutTint
lightweight4WaterRefractionAlpha
lightweight8
lightweight8CutOut
lightweight8CutOutTint
lightweight8WaterRefractionAlpha
lightweightHighQuality0
lightweightHighQuality0CutOut
lightweightHighQuality0WaterRefractionAlpha
lightweightHighQuality4
lightweightHighQuality4CutOut
lightweightHighQuality4WaterRefractionAlpha
lightweightHighQuality8
lightweightHighQuality8CutOut
lightweightHighQuality8WaterRefractionAlpha
lightweightNoCapsule4
lightweightNoCapsule8
multilight
tessellate
ui
unlit
waterreflection
waterreflectionalphaclip
waterreflectionalphacliptint
wdcascade
```

## Parameters
* **techniqueGroup**: Technique group name.