Jump to content
Developer Wiki and Function Reference Links ×

VWBody texture face and texture mapping


Cmb

Recommended Posts

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 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" function body.

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...