Hello and happy coding everyone
I just have a little problem: i use this class to upload every part of my 3D like layers. And to add some image to explain it.
BUT
I have one problem: i do not know why there is a black shadow of it? I try ofEnableAlphaBending() and ofEnableBlendMode(OF_BLENDMODE_ALPHA); but nothing happen and i still have this black shadow, and no transparency:
Can you help me on that, please? Here is the cpp of the class:
//
// CS3D.cpp
//
//
// Created by Vincent Marsat on 18/07/16.
//
//
#include “CS3D.h”
CS3D::CS3D(){
}
//--------------------------------------------------------------
void CS3D::load(string Type3D, string Image){ofEnableAlphaBlending(); ofEnableBlendMode(OF_BLENDMODE_ALPHA);
Organe.loadModel(Type3D, false); Organe.setScaleNormalization(false);
Img.load(Image);
}
//--------------------------------------------------------------
void CS3D::draw(int mode, float scale,ofColor colorRectif, bool colorR, ofColor colorSelect, ofPoint Rotate,ofPoint LeapPoint, ofPoint TouchMin, ofPoint TouchMax){ofPushStyle(); ofPushMatrix(); ofPoint Cmin; ofPoint Cmax; Cmin.rotate(Rotate.x, ofVec3f(1,0,0)); Cmin.rotate(Rotate.y, ofVec3f(0,1,0)); Cmin.rotate(Rotate.z, ofVec3f(0,0,1)); Cmax.rotate(Rotate.x, ofVec3f(1,0,0)); Cmax.rotate(Rotate.y, ofVec3f(0,1,0)); Cmax.rotate(Rotate.z, ofVec3f(0,0,1)); float XCmin = TouchMin.x *scale; float XCmax = TouchMax.x *scale; float YCmin = TouchMin.y *scale; float YCmax = TouchMax.y *scale; float ZCmin = TouchMin.z *scale; float ZCmax = TouchMax.z *scale; ofMesh mesh; cout << "LX = "<< LeapPoint.x << " LY = "<< LeapPoint.y<< " LZ = "<< LeapPoint.z << endl; cout << "XCmin3 = "<< XCmin << endl; if (LeapPoint.x > XCmin && LeapPoint.x < XCmax && LeapPoint.y > YCmin&& LeapPoint.y < YCmax && LeapPoint.z > ZCmin && LeapPoint.z < ZCmax) { mode = 1; cout << " BONJOUR " << endl; ofPushMatrix(); ofTranslate(1, -TouchMin.y/200 ,TouchMin.x/200); ofPushMatrix(); ofRotateX(180); ofRotateY(-90); Img.draw(0,0,0, 1, 0.3); ofPopMatrix(); ofPopMatrix(); } else { mode = 0; } switch(mode){ case 1: ofPushStyle(); mesh = Organe.getCurrentAnimatedMesh(0); ofSetColor(colorSelect); ofRotateZ(180); mesh.drawFaces(); ofPopStyle(); break; case 2: Organe.drawVertices(); break; case 3: Organe.clear(); break; default: if(colorR == true){ ofPushStyle(); ofSetColor(colorRectif); ofMesh mesh; mesh = Organe.getCurrentAnimatedMesh(0); ofSetColor(colorRectif); ofRotateZ(180); mesh.drawFaces(); ofPopStyle(); } else { Organe.drawFaces(); } break; } ofPopStyle(); ofPopMatrix();
}