Skip to content

VWBodyObj face texturing/highlighting issues #1

@folfure

Description

@folfure

We are trying to set different textures with different mapping options on an VWExtrudeObj.
We use VWBodyObj to do that, as it looks to be the perfect interface.

It looks like SetFaceTexture doesn't do anything as SetFaceTextureMappingInfo or even GetFaceTextureMappingInfo

Here is a peice of code showing the issue

double height = 2000;
double depth = 1000;
double thickness = 500;
VWPoint3D origin{ 0,0,0 };

VWPolygon2DObj poly;
poly.AddVertex(0, 0, false);
poly.AddVertex(thickness, 0, false);
poly.AddVertex(thickness, -depth, false);
poly.AddVertex(0, -depth, true);
poly.SetClosed(true);
VWPolygon2D polygon;
poly.GetPolygon(polygon);
VWExtrudeObj extrusion(polygon, height);
poly.DeleteObject();
extrusion.MoveObject3D(location);
MCObjectHandle extrude = extrusion.GetThisObject();

const VWClass class_obj("TexClass-1 INT");
auto texture_ref = class_obj.GetClassAttribs().GetGeneralTexture();
VWTextureObj texture_obj(gSDK->InternalIndexToHandle(texture_ref));
TXString texture_name = texture_obj.GetName();

if (VWBodyObj::IsBodyObject(extrude))
{
	VWBodyObj body_obj(extrude);
        body_obj.SetObjectName("TEST_BODY");
	VWBody body;
	auto nb = body_obj.GetBodyCount();
	body_obj.GetBody(0, body);
	size_t face_count = body.GetFacesCount();
	for (size_t i = 0; i < face_count; i++)
	{

		VWBodyFace face = body.GetFaceAt(i);
		VWPlane plane;
                InternalIndex texture_ref_ini = body_obj.GetFaceTexture(face);
                auto is_ok = body_obj.IsFaceBelongsToThisObject(face);
		VWTextureObj texture_ini_obj(gSDK->InternalIndexToHandle(texture_ref_ini));
		TXString texture_ini_name = texture_ini_obj.GetName();
		TextureMappingInfoSDK mapping_info;
                body_obj.GetFaceTextureMappingInfo(face, mapping_info);
                mapping_info.fParamSpaceKind = kParamSpaceKind_SurfaceUV;
                mapping_info.f2DRotation = 0.78;
                mapping_info.fInitialized = true;
                mapping_info.fRepeatH = true;
                mapping_info.fRepeatV = true;
                mapping_info.fRadius = 500;
                mapping_info.f2DScale = 1;

                body_obj.SetFaceTexture(texture_ref, face);
                body_obj.SetFaceTextureMappingInfo(face, mapping_info);
		auto texture_after_set = body_obj.GetFaceTexture(face);

          // unfortunalely, the texture is not set on the face, we should invert the asserts
          assert(texture_after_set == texture_ref_ini);
          assert(texture_ref != texture_ref_ini);
      }
      body_obj.ResetObject();
      body_obj.ResetObjectsVisibility();
}

We also need to be able to select faces with a tool, but the SDK lacks the ability to pick a face and to highlight it, for already three years, with "Not implemented" here and there.

Could you pelase help us, this is blocking us from moving forward with our tools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions