breaking map (warp3d) suport default map parameters. Planar not suported ( will render as deafaul

httptests
UbitUmarov 2018-05-08 16:58:15 +01:00
parent f7475d4a98
commit cf1ea3b093
1 changed files with 66 additions and 15 deletions

View File

@ -490,6 +490,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
continue;
warp_Object faceObj = new warp_Object();
Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i);
Color4 faceColor = teFace.RGBA;
string materialName = String.Empty;
if (m_texturePrims && primScaleLenSquared > m_texturePrimSize*m_texturePrimSize)
materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID);
else
materialName = GetOrCreateMaterial(renderer, GetFaceColor(teFace));
if(renderer.Scene.material(materialName).getTexture() == null)
{
for (int j = 0; j < face.Vertices.Count; j++)
{
Vertex v = face.Vertices[j];
@ -497,6 +509,54 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
warp_Vertex vert = new warp_Vertex(pos, v.TexCoord.X, 1.0f - v.TexCoord.Y);
faceObj.addVertex(vert);
}
}
else
{
float tu;
float tv;
float offsetu = teFace.OffsetU + 0.5f;
float offsetv = teFace.OffsetV + 0.5f;
float scaleu = teFace.RepeatU;
float scalev = teFace.RepeatV;
float rotation = teFace.Rotation;
float rc = 0;
float rs = 0;
if(rotation != 0)
{
rc = (float)Math.Cos(rotation);
rs = (float)Math.Sin(rotation);
}
for (int j = 0; j < face.Vertices.Count; j++)
{
warp_Vertex vert;
Vertex v = face.Vertices[j];
warp_Vector pos = ConvertVector(v.Position);
tu = v.TexCoord.X - 0.5f;
tv = 0.5f - v.TexCoord.Y;
if(rotation != 0)
{
float tur = tu * rc - tv * rs;
float tvr = tu * rs + tv * rc;
tur *= scaleu;
tur += offsetu;
tvr *= scalev;
tvr += offsetv;
vert = new warp_Vertex(pos, tur, tvr);
}
else
{
tu *= scaleu;
tu += offsetu;
tv *= scalev;
tv += offsetv;
vert = new warp_Vertex(pos, tu, tv);
}
faceObj.addVertex(vert);
}
}
for (int j = 0; j < face.Indices.Count; j += 3)
{
@ -506,15 +566,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
face.Indices[j + 2]);
}
Primitive.TextureEntryFace teFace = prim.Shape.Textures.GetFace((uint)i);
Color4 faceColor = teFace.RGBA;
string materialName = String.Empty;
if (m_texturePrims && primScaleLenSquared > m_texturePrimSize*m_texturePrimSize)
materialName = GetOrCreateMaterial(renderer, faceColor, teFace.TextureID);
else
materialName = GetOrCreateMaterial(renderer, GetFaceColor(teFace));
faceObj.scaleSelf(prim.Scale.X, prim.Scale.Z, prim.Scale.Y);
faceObj.transform(m);
faceObj.setPos(primPos);