You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
Fix the material preview sphere
This commit is contained in:
@@ -393,7 +393,7 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
|
|||||||
|
|
||||||
int lats = 32;
|
int lats = 32;
|
||||||
int lons = 32;
|
int lons = 32;
|
||||||
const double lat_step = Math::TAU / lats;
|
const double lat_step = Math::PI / lats;
|
||||||
const double lon_step = Math::TAU / lons;
|
const double lon_step = Math::TAU / lons;
|
||||||
real_t radius = 1.0;
|
real_t radius = 1.0;
|
||||||
|
|
||||||
@@ -432,7 +432,12 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
|
|||||||
normals.push_back(v[m_idx]); \
|
normals.push_back(v[m_idx]); \
|
||||||
vertices.push_back(v[m_idx] * radius); \
|
vertices.push_back(v[m_idx] * radius); \
|
||||||
{ \
|
{ \
|
||||||
Vector2 uv(Math::atan2(v[m_idx].x, v[m_idx].z), Math::atan2(-v[m_idx].y, v[m_idx].z)); \
|
Vector2 uv; \
|
||||||
|
if (j >= lons / 2) { \
|
||||||
|
uv = Vector2(Math::atan2(-v[m_idx].x, -v[m_idx].z), Math::atan2(v[m_idx].y, -v[m_idx].z)); \
|
||||||
|
} else { \
|
||||||
|
uv = Vector2(Math::atan2(v[m_idx].x, v[m_idx].z), Math::atan2(-v[m_idx].y, v[m_idx].z)); \
|
||||||
|
} \
|
||||||
uv /= Math::PI; \
|
uv /= Math::PI; \
|
||||||
uv *= 4.0; \
|
uv *= 4.0; \
|
||||||
uv = uv * 0.5 + Vector2(0.5, 0.5); \
|
uv = uv * 0.5 + Vector2(0.5, 0.5); \
|
||||||
|
|||||||
Reference in New Issue
Block a user