Skip to content

Commit

Permalink
#5231: More shader-related compilation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jun 16, 2020
1 parent 23dc2f1 commit 54909b5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
6 changes: 3 additions & 3 deletions radiantcore/patch/Patch.cpp
Expand Up @@ -856,7 +856,7 @@ Patch* Patch::MakeCap(Patch* patch, patch::CapType eType, EMatrixMajor mt, bool
patch->ConstructSeam(eType, &p.front(), width);

// greebo: Apply natural texture to that patch, to fix the texcoord==1.#INF bug.
patch->NaturalTexture();
patch->scaleTextureNaturally();
return patch;
}

Expand Down Expand Up @@ -1942,7 +1942,7 @@ void Patch::constructPlane(const AABB& aabb, int axis, std::size_t width, std::s
vTmp[y]+=yAdj;
}

NaturalTexture();
scaleTextureNaturally();
}

// Returns the dimension for the given viewtype, used by the patch prefab routines
Expand Down Expand Up @@ -2265,7 +2265,7 @@ void Patch::ConstructPrefab(const AABB& aabb, EPatchPrefab eType, EViewType view
}
}

NaturalTexture();
scaleTextureNaturally();
}

namespace
Expand Down
2 changes: 1 addition & 1 deletion radiantcore/patch/algorithm/General.cpp
Expand Up @@ -69,7 +69,7 @@ void thicken(const PatchNodePtr& sourcePatch, float thickness, bool createSeams,
parent->addChildNode(nodes[i]);

// Now the shader is realised, apply natural scale
wallPatch->NaturalTexture();
wallPatch->scaleTextureNaturally();

// Now select the newly created patch
Node_setSelected(nodes[i], true);
Expand Down
4 changes: 2 additions & 2 deletions radiantcore/selection/algorithm/Primitives.cpp
Expand Up @@ -309,8 +309,8 @@ class DecalPatchCreator
}

// Fit the texture on it
patch->SetTextureRepeat(1,1);
patch->FlipTexture(1);
patch->fitTexture(1,1);
patch->flipTexture(1);

// Insert the patch into worldspawn
scene::INodePtr worldSpawnNode = GlobalMapModule().findOrInsertWorldspawn();
Expand Down
36 changes: 26 additions & 10 deletions radiantcore/selection/algorithm/Shader.cpp
Expand Up @@ -338,22 +338,38 @@ class ClipboardShaderApplicator

void operator()(IPatch& patch)
{
Texturable target;
target.patch = &patch;
target.node = patch.getPatchNode().shared_from_this();
try
{
Texturable target;

Patch& targetPatch = dynamic_cast<Patch&>(patch);

// Apply the shader (projected, not to the entire brush)
applyClipboardToTexturable(target, !_natural, false);
target.patch = &targetPatch;
target.node = targetPatch.getPatchNode().shared_from_this();

// Apply the shader (projected, not to the entire brush)
applyClipboardToTexturable(target, !_natural, false);
}
catch (const std::bad_cast&)
{}
}

void operator()(IFace& face)
{
Texturable target;
target.face = &face;
target.node = face.getBrush().getBrushNode().shared_from_this();
try
{
Texturable target;

// Apply the shader (projected, not to the entire brush)
applyClipboardToTexturable(target, !_natural, false);
// Downcast the IFace reference
Face& targetFace = dynamic_cast<Face&>(face);
target.face = &targetFace;
target.node = targetFace.getBrush().getBrushNode().shared_from_this();

// Apply the shader (projected, not to the entire brush)
applyClipboardToTexturable(target, !_natural, false);
}
catch (const std::bad_cast&)
{}
}
};

Expand Down

0 comments on commit 54909b5

Please sign in to comment.