Beispiel #1
0
void RgbEffects::RenderFaces(int Phoneme)
{
    int ColorIdx;
    size_t i,idx;
    int n,x,y,s;

    /*
        FacesPhoneme.Add("AI");     0
        FacesPhoneme.Add("E");      1
        FacesPhoneme.Add("FV");     2
        FacesPhoneme.Add("L");      3
        FacesPhoneme.Add("MBP");    4
        FacesPhoneme.Add("O");      5
        FacesPhoneme.Add("U");      6
        FacesPhoneme.Add("WQ");     7
        FacesPhoneme.Add("etc");    8
        FacesPhoneme.Add("rest");   9
    */
    wxColour color;
    wxImage::HSVValue hsv;
    int maxframe=BufferHt*2;
    int frame=(BufferHt * state / 200)%maxframe;
    double offset=double(state)/100.0;
    size_t colorcnt=GetColorCount();


    std::vector<int> chmap;
    chmap.resize(BufferHt * BufferWi,0);
    wxString html = "<html><body><table border=0>";
    int Ht, Wt;
    Ht = BufferHt;
    Wt = BufferWi;
    mouth( Phoneme, Ht,  Wt); // draw a mouth syllable


//size_t NodeCount=GetNodeCount();

//    above is from ModelClass::ChannelLayoutHtml()

#if 0 //DEBUG
//get list of models:
    wxString buf;
    for (auto it = xLightsFrame::PreviewModels.begin(); it != xLightsFrame::PreviewModels.end(); ++it)
        buf += ", " + (*it)->name; //ModelClassPtr*
    debug(1, "faces: models = %s", (const char*)buf + 2);

//get info about one of the models:
    buf = xLightsFrame::PreviewModels[0]->name;
    debug(1, "first model is %s", (const char*)buf);
    buf = xLightsFrame::PreviewModels[0]->ChannelLayoutHtml();
    if (buf.size() > 500) buf.resize(500);
    debug(1, "first 500 char of layout html = %s", (const char*)buf);
#endif



}
void head(void) {
	glColor3f(1.0f, 0.0f, 0.0f); //color the face red
	glTranslatef(0.0, 5.5, -7.5); //position the face, from the torso coordinate frame
	glScalef(2.0, 2.0, 2.0);
	drawCube();
	//draw face cube and then every feature from this coordinate frame
	//all facial features are yellow
	glPushMatrix();
		leye(); //draw left eye
	glPopMatrix();

	glPushMatrix();
		reye(); //draw right eye
	glPopMatrix();
	
	glPushMatrix();
		nose(); //draw nose
	glPopMatrix();

	glPushMatrix();
		mouth(); //draw mouth
	glPopMatrix();
}
Beispiel #3
0
void RgbEffects::RenderFaces(int Phoneme)
{


    /*
        FacesPhoneme.Add("AI");     0
        FacesPhoneme.Add("E");      1
        FacesPhoneme.Add("FV");     2
        FacesPhoneme.Add("L");      3
        FacesPhoneme.Add("MBP");    4
        FacesPhoneme.Add("O");      5
        FacesPhoneme.Add("U");      6
        FacesPhoneme.Add("WQ");     7
        FacesPhoneme.Add("etc");    8
        FacesPhoneme.Add("rest");   9
    */
    wxColour color;
    wxImage::HSVValue hsv;
    int maxframe=BufferHt*2;
    int frame=(BufferHt * state / 200)%maxframe;
    double offset=double(state)/100.0;
    size_t colorcnt=GetColorCount();

 // xout->SetIntensity(1000, 1);
    std::vector<int> chmap;
    chmap.resize(BufferHt * BufferWi,0);
    wxString html = "<html><body><table border=0>";
    int Ht, Wt;
    Ht = BufferHt;
    Wt = BufferWi;

    mouth( Phoneme, Ht,  Wt); // draw a mouth syllable


//size_t NodeCount=GetNodeCount();

//    above is from ModelClass::ChannelLayoutHtml()

#if 0 //DEBUG
//get list of models:
    wxString buf;
    for (auto it = xLightsFrame::PreviewModels.begin(); it != xLightsFrame::PreviewModels.end(); ++it)
        buf += ", " + (*it)->name; //ModelClassPtr*
    debug(1, "faces: models = %s", (const char*)buf + 2);

//get info about one of the models:
    buf = xLightsFrame::PreviewModels[0]->name;
    debug(1, "first model is %s", (const char*)buf);
    buf = xLightsFrame::PreviewModels[0]->ChannelLayoutHtml();
    if (buf.size() > 500) buf.resize(500);
    debug(1, "first 500 char of layout html = %s", (const char*)buf);
#endif

#if 1 //example code to map pixels back to channels
    wxString model; //set to target model name (optional)
    for (int y=0; y<BufferHt; y++) // For my 20x120 megatree, BufferHt=120
    {
        for (int x=0; x<BufferWi; x++) // BufferWi=20 in the above example
        {
//            ch = GetChannel(x,y);  // <== I need something like this routine
//            wxImage::HSVValue hsv = GetPixel(x, y);
            GetPixel(x, y, color);
//    hsv0 = wxImage::RGBtoHSV( wxImage::RGBValue( c0.Red(), c0.Green(), c0.Blue()));
// wxColor color, mapped;
//                color.Set(Shapes.GetRed(x, y), Shapes.GetGreen(x, y), Shapes.GetBlue(x, y));
//                ColorMap[color.GetRGB()
            if (!color.GetRGB()) continue; //color == BLACK) continue; //pixel is off
            int ch = FindChannelAt(x, y, model);
//            debug(1, "pixel (%d, %d) = 0x%6x is channel %d in model %s", x, y, ch, (const char*)(model.IsEmpty()? "(any)": model.c_str()));
        }
    }
#endif
}