void GiantSlimeEntity::render(sf::RenderTarget* app) { if (!isDying) { // shadow sprite.setPosition(x, y); if (isMirroring) sprite.setTextureRect(sf::IntRect(shadowFrame * width + width, 0, -width, height)); else sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } sprite.setPosition(x, y - h); if (isMirroring) sprite.setTextureRect(sf::IntRect(frame * width + width, 0, -width, height)); else sprite.setTextureRect(sf::IntRect(frame * width, 0, width, height)); app->draw(sprite); renderLifeBar(app, tools::getLabel("enemy_giant_slime")); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void LargeSlimeEntity::render(sf::RenderTarget* app) { if (!isDying) { // shadow sprite.setPosition(x, y); if (isMirroring) sprite.setTextureRect(sf::IntRect(shadowFrame * width + width, 0, -width, height)); else sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } sprite.setPosition(x, y - h); if (isMirroring) sprite.setTextureRect(sf::IntRect( (frame % 5) * width + width, (frame / 5) * height, -width, height)); else sprite.setTextureRect(sf::IntRect((frame % 5) * width, (frame / 5) * height, width, height)); app->draw(sprite); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void SlimePetEntity::render(sf::RenderTarget* app) { // shadow if (h < 1055) { int fade = 255; if (h > 800) fade = - (h - 1055); sprite.setColor(sf::Color(255, 255, 255, fade)); sprite.setPosition(x, y); sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); sprite.setColor(sf::Color(255, 255, 255, 255)); } // sprite sprite.setPosition(x, y - h); sprite.setTextureRect(sf::IntRect(frame * width, 4 * height, width, height)); app->draw(sprite); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void ItemEntity::render(sf::RenderTarget* app) { // shadow if (itemType < FirstEquipItem) { sprite.setTextureRect(sf::IntRect(9 * width, 3 * height, width, height)); sprite.setPosition(x, y + 3); app->draw(sprite); sprite.setPosition(x, y); } else { sprite.setTextureRect(sf::IntRect(9 * width, 7 * height, width, height)); app->draw(sprite); } // price if (isMerchandise) { std::ostringstream oss; oss << getPrice(); sf::Color fontColor; if (getPrice() > game().getPlayer()->getGold()) fontColor = sf::Color(215, 20, 20); else fontColor = sf::Color(255, 255, 255); game().write(oss.str(), 16, x, y + 35.0f, ALIGN_CENTER, fontColor, app, 1 , 1, 0); } if (itemType < FirstEquipItem && itemType >= ItemPotion01 + NUMBER_UNIDENTIFIED) { float yItem = h > 0.1f ? y - h : y; int frameBottle = game().getPotion(itemType); sprite.setPosition(x, yItem); sprite.setTextureRect(sf::IntRect(frameBottle % imagesProLine * width, frameBottle / imagesProLine * height, width, height)); app->draw(sprite); sprite.setTextureRect(sf::IntRect(frame % imagesProLine * width, frame / imagesProLine * height, width, height)); app->draw(sprite); sprite.setPosition(x, y); } else if (h > 0.1f) { sprite.setTextureRect(sf::IntRect(frame % imagesProLine * width, frame / imagesProLine * height, width, height)); sprite.setPosition(x, y - h); app->draw(sprite); sprite.setPosition(x, y); } else CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void ChestEntity::render(sf::RenderTarget* app) { CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void BaseCreatureEntity::render(sf::RenderTarget* app) { if (!isDying && shadowFrame > -1) { // shadow sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void ChestEntity::render(sf::RenderTarget* app) { if (appearTimer > 0.0f) { int fade = 255 * (1.0f - appearTimer / CHEST_APPEAR_DELAY); sprite.setColor(sf::Color(255, 255, 255, fade)); } else sprite.setColor(sf::Color(255, 255, 255, 255)); CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void SausageEntity::render(sf::RenderTarget* app) { if (!isDying && shadowFrame > -1) { // shadow sprite.setPosition(x, y); sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } sprite.setPosition(x, y - h); sprite.setTextureRect(sf::IntRect(frame * width, 0, width, height)); app->draw(sprite); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void VisusSceneNode::display3D(VisusTransformation3D model_view_3D) { VisusCamera camera; getValue(camera); /* glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(model_view_3D); */ camera.setupOpenGL(model_view_3D); if (mDrawBoundingBox) displayBoundingBox(); recurse(model_view_3D); glPopMatrix(); }
void VisusTickMarks::display3D(VisusTransformation3D model_view_3D) { VisusTransformation3D local; GLint viewport[4]; // x, y, width, height int canvas_width, canvas_height; getValue<VisusSharedTransformation3D>(local); if (mParent==NULL) getValue<VisusSharedBoundingBox>(mBBox); else mParent->getValue<VisusSharedBoundingBox>(mBBox); switch (mTMAxis) { case TM_X_AXIS: mAxis.minValue(mBBox[0]); mAxis.maxValue(mBBox[3]); break; case TM_Y_AXIS: mAxis.minValue(mBBox[1]); mAxis.maxValue(mBBox[4]); break; case TM_Z_AXIS: mAxis.minValue(mBBox[2]); mAxis.maxValue(mBBox[5]); break; } //fprintf(stderr,"Axis [%f,%f] \n",mAxis.mMinValue,mAxis.mMaxValue); //fprintf(stderr,"VisusTickMarks bbox: [%f,%f,%f] x [%f,%f,%f]\n",mBBox[0],mBBox[1],mBBox[2], // mBBox[3],mBBox[4],mBBox[5]); model_view_3D *= local; // Determine Where To Draw Ticks getMostVisible(model_view_3D); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(model_view_3D); // Get the current viewport glGetIntegerv(GL_VIEWPORT,viewport); canvas_width = viewport[2]; canvas_height = viewport[3]; renderTickMarks(canvas_width, canvas_height); renderLegend(canvas_width,canvas_height); if (mDrawBoundingBox) displayBoundingBox(); for (CIterator it=mChildren.begin();it!=mChildren.end();it++) (*it)->display(model_view_3D); glPopMatrix(); vglerror(); }
void VisusMeshDisplay::display3D(VisusTransformation3D model_view_3D) { VisusTransformation3D local; VisusColor color; synchronize(); getValue(local); getValue(color); if (!frozen()) model_view_3D *= local; else model_view_3D = mFrozen3D; glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(model_view_3D); if (!frozen()) glMultMatrixf(mMesh.matrix()); else glMultMatrixf(mFrozenDataTransformation); if (mDrawBoundingBox) { //fprintf(stderr,"draw bounding box\n"); displayBoundingBox(); } glPolygonMode(GL_FRONT_AND_BACK,mPolygonMode); //float c[4] = {1,1,1,1}; //glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, c); glColor3f(1,1,1); if ((mColorIndex >= 0) && (mNormalIndex >= 0)) { renderColoredSmooth(); } else if ((mColorIndex >= 0) && (mNormalIndex < 0)) renderColoredFlat(); else if ((mColorIndex < 0) && (mNormalIndex >= 0)) { getValue(color); color.glColor(); renderSmooth(); } else { getValue(color); color.glColor(); renderFlat(); } //glEnable(GL_TEXTURE_2D); // This breaks anything else that uses colormap on windows if enabled //glDisable(GL_COLOR_MATERIAL); vglerror(); for (CIterator it=mChildren.begin();it!=mChildren.end();it++) (*it)->display(model_view_3D); glPopMatrix(); }
void CPath::display(CViewableBase* renderingObject,int displayAttrib) { FUNCTION_INSIDE_DEBUG("CPath::display"); EASYLOCK(_objectMutex); // At the beginning of every 3DObject display routine: commonStart(displayAttrib); if (_shapingEnabled) { if ( ((App::ct->objCont->getEditModeType()&PATH_EDIT_MODE)==0)||(App::ct->objCont->getEditModeObjectID()!=getID()) ) { if (_pathModifID!=pathContainer->getPathModifID()) { _generatePathShape(); _pathModifID=pathContainer->getPathModifID(); } } } // Bounding box display: if (displayAttrib&sim_displayattribute_renderpass) displayBoundingBox(displayAttrib,false); // Object display: if ( getShouldObjectBeDisplayed(displayAttrib)||( ((App::ct->objCont->getEditModeType()&SHAPE_OR_PATH_EDIT_MODE)!=0)&&(App::ct->objCont->getEditModeObjectID()==getID()) ) ) { if ((App::ct->objCont->getEditModeType()&SHAPE_OR_PATH_EDIT_MODE)==0) { if (_objectProperty&sim_objectproperty_selectmodelbaseinstead) glLoadName(getModelSelectionID()); else glLoadName(getID()); } else glLoadName(-1); if ( (displayAttrib&sim_displayattribute_forcewireframe)&&(displayAttrib&sim_displayattribute_renderpass) ) glPolygonMode (GL_FRONT_AND_BACK,GL_LINE); if (displayAttrib&sim_displayattribute_selected) ogl::drawReference(pathContainer->getSquareSize()*2.0f); if ( ((App::ct->objCont->getEditModeType()&PATH_EDIT_MODE)!=0)&&(App::ct->objCont->getEditModeObjectID()==getID()) ) App::ct->objCont->_editionPath->render(true,0,false,_objectID); else { App::ct->objCont->enableAuxClippingPlanes(_objectID); if ((displayAttrib&sim_displayattribute_forvisionsensor)==0) { bool isUniqueSelectedPath=false; if ( (App::ct->objCont->getSelSize()==1)&&(App::ct->objCont->getSelID(0)==_objectID) ) { App::ct->objCont->setUniqueSelectedPathID(_objectID); isUniqueSelectedPath=App::ct->simulation->isSimulationStopped(); } pathContainer->render(false,displayAttrib,isUniqueSelectedPath,_objectID); } if (_shapingEnabled) { shapingColor.makeCurrentColor(); glBegin(GL_TRIANGLES); for (int i=0;i<int(_pathShapeIndices.size());i++) { glNormal3fv(&_pathShapeNormals[3*i]); glVertex3fv(&_pathShapeVertices[3*(_pathShapeIndices[i])]); } glEnd(); } App::ct->objCont->disableAuxClippingPlanes(); } glDisable(GL_CULL_FACE); } // At the end of every 3DObject display routine: commonFinish(); }
void CProxSensor::display(CViewableBase* renderingObject,int displayAttrib) { FUNCTION_INSIDE_DEBUG("CProxSensor::display"); EASYLOCK(_objectMutex); // At the beginning of every 3DObject display routine: commonStart(displayAttrib); // Display the bounding box: if (displayAttrib&sim_displayattribute_renderpass) displayBoundingBox(displayAttrib); // Display the object: if (getShouldObjectBeDisplayed(displayAttrib)) { App::ct->objCont->enableAuxClippingPlanes(_objectID); if ((App::ct->objCont->getEditModeType()&SHAPE_OR_PATH_EDIT_MODE)==0) { if (_objectProperty&sim_objectproperty_selectmodelbaseinstead) glLoadName(getModelSelectionID()); else glLoadName(getID()); } else glLoadName(-1); if ( (displayAttrib&sim_displayattribute_forcewireframe)&&(displayAttrib&sim_displayattribute_renderpass) ) glPolygonMode (GL_FRONT_AND_BACK,GL_LINE); if (CIloIlo::debugSensorCutting&&(sensorType!=sim_proximitysensor_ray_subtype)) { ogl::setColor(1.0f,1.0f,1.0f,EMISSION_MODE); ogl::setBlending(true); glDepthMask(GL_FALSE); glBegin(GL_LINE_STRIP); for (int klm=0;klm<int(cutEdges.size())/3;klm++) glVertex3f(cutEdges[3*klm+0],cutEdges[3*klm+1],cutEdges[3*klm+2]); glEnd(); ogl::setBlending(false); glDepthMask(GL_TRUE); } for (int i=0;i<int(convexVolume->firstVolumeCorners.size());i++) { ogl::setColor(1.0f,1.0f,1.0f,AMBIENT_MODE); glPointSize(4.0f); glBegin(GL_POINTS); glVertex3fv(convexVolume->firstVolumeCorners[i].data); glEnd(); glPointSize(1.0f); } if (_detectedPointValid) { detectionRayColor.makeCurrentColor(); glLineWidth(3.0f); glBegin(GL_LINES); glVertex3f(0.0f,0.0f,0.0f); glVertex3f(_detectedPoint(0),_detectedPoint(1),_detectedPoint(2)); glEnd(); glLineWidth(1.0f); if ( (sensorType==sim_proximitysensor_ray_subtype)&&_randomizedDetection ) { glBegin(GL_LINES); for (int i=0;i<int(_randomizedVectors.size());i++) { if (_randomizedVectorDetectionStates[i]!=0.0f) { glVertex3f(0.0f,0.0f,0.0f); glVertex3f(_randomizedVectors[i](0)*_randomizedVectorDetectionStates[i],_randomizedVectors[i](1)*_randomizedVectorDetectionStates[i],_randomizedVectors[i](2)*_randomizedVectorDetectionStates[i]); } } glEnd(); } activeVolumeColor.makeCurrentColor(); } else passiveVolumeColor.makeCurrentColor(); if ((_showVolumeWhenDetecting&&_detectedPointValid)||(_showVolumeWhenNotDetecting&&(!_detectedPointValid))) { ogl::displaySphere(getSize()/2.0f); glBegin(GL_LINES); for (int i=0;i<int(convexVolume->volumeEdges.size())/6;i++) { glVertex3fv(&convexVolume->volumeEdges[6*i+0]); glVertex3fv(&convexVolume->volumeEdges[6*i+3]); } glEnd(); closestDistanceVolumeColor.makeCurrentColor(); glBegin(GL_LINES); for (int i=0;i<int(convexVolume->nonDetectingVolumeEdges.size())/6;i++) { glVertex3fv(&convexVolume->nonDetectingVolumeEdges[6*i+0]); glVertex3fv(&convexVolume->nonDetectingVolumeEdges[6*i+3]); } glEnd(); } ogl::setColorsAllBlack(); ogl::setColor(1.0f,0.0f,0.0f,EMISSION_MODE); glBegin(GL_LINES); for (int i=0;i<int(convexVolume->normalsInside.size())/6;i++) { glVertex3fv(&convexVolume->normalsInside[6*i+0]); glVertex3fv(&convexVolume->normalsInside[6*i+3]); } glEnd(); ogl::setColor(0.0f,0.0f,1.0f,EMISSION_MODE); glBegin(GL_LINES); for (int i=0;i<int(convexVolume->normalsOutside.size())/6;i++) { glVertex3fv(&convexVolume->normalsOutside[6*i+0]); glVertex3fv(&convexVolume->normalsOutside[6*i+3]); } glEnd(); App::ct->objCont->disableAuxClippingPlanes(); } // At the end of every 3DObject display routine: commonFinish(); }
void CMill::display(CViewableBase* renderingObject,int displayAttrib) { FUNCTION_INSIDE_DEBUG("CMill::display"); EASYLOCK(_objectMutex); // At the beginning of every 3DObject display routine: commonStart(displayAttrib); // Display the bounding box: if (displayAttrib&sim_displayattribute_renderpass) displayBoundingBox(displayAttrib); // Display the object: if (getShouldObjectBeDisplayed(displayAttrib)) { if ((App::ct->objCont->getEditModeType()&SHAPE_OR_PATH_EDIT_MODE)==0) { if (_objectProperty&sim_objectproperty_selectmodelbaseinstead) glLoadName(getModelSelectionID()); else glLoadName(getID()); } else glLoadName(-1); App::ct->objCont->enableAuxClippingPlanes(_objectID); bool wire=false; if ( (displayAttrib&sim_displayattribute_forcewireframe)&&(displayAttrib&sim_displayattribute_renderpass) ) { wire=true; glPolygonMode (GL_FRONT_AND_BACK,GL_LINE); } for (int i=0;i<int(convexVolume->firstVolumeCorners.size());i++) { ogl::setColor(1.0f,1.0f,1.0f,AMBIENT_MODE); glPointSize(4.0f); glBegin(GL_POINTS); glVertex3fv(convexVolume->firstVolumeCorners[i].data); glEnd(); glPointSize(1.0f); } if (_millDataValid&&(_milledObjectCount>0)) activeVolumeColor.makeCurrentColor(); else passiveVolumeColor.makeCurrentColor(); if (_showMillBase) ogl::displayBox(_size/2.0f,_size/2.0f,_size/2.0f,!wire); glBegin(GL_LINES); for (int i=0;i<int(convexVolume->volumeEdges.size())/6;i++) { glVertex3fv(&convexVolume->volumeEdges[6*i+0]); glVertex3fv(&convexVolume->volumeEdges[6*i+3]); } glEnd(); ogl::setColorsAllBlack(); ogl::setColor(1.0f,0.0f,0.0f,EMISSION_MODE); glBegin(GL_LINES); for (int i=0;i<int(convexVolume->normalsInside.size())/6;i++) { glVertex3fv(&convexVolume->normalsInside[6*i+0]); glVertex3fv(&convexVolume->normalsInside[6*i+3]); } glEnd(); App::ct->objCont->disableAuxClippingPlanes(); } // At the end of every 3DObject display routine: commonFinish(); }