当前位置: 首页>>代码示例>>C++>>正文


C++ shadow函数代码示例

本文整理汇总了C++中shadow函数的典型用法代码示例。如果您正苦于以下问题:C++ shadow函数的具体用法?C++ shadow怎么用?C++ shadow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了shadow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: delta

// Make patch face - neighbour cell distances
void Foam::cyclicGgiFvPatch::makeDeltaCoeffs(scalarField& dc) const
{
    if (cyclicGgiPolyPatch_.master())
    {
        // Stabilised form for bad meshes.  HJ, 24/Aug/2011
        vectorField d = delta();

        dc = 1.0/max(nf() & d, 0.05*mag(d));

        if (bridgeOverlap())
        {
            scalarField bridgeDeltas = nf() & fvPatch::delta();

            bridge(bridgeDeltas, dc);
        }
    }
    else
    {
        scalarField masterDeltas(shadow().size());
        shadow().makeDeltaCoeffs(masterDeltas);
        dc = interpolate(masterDeltas);

        if (bridgeOverlap())
        {
            scalarField bridgeDeltas = nf() & fvPatch::delta();

            bridge(bridgeDeltas, dc);
        }
    }
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-foam-extend-3.0,代码行数:31,代码来源:cyclicGgiFvPatch.C

示例2: decorationRect

QRect Toplevel::visibleRect() const
{
    QRect r = decorationRect();
    if (hasShadow() && !shadow()->shadowRegion().isEmpty()) {
        r |= shadow()->shadowRegion().boundingRect();
    }
    return r.translated(geometry().topLeft());
}
开发者ID:CyberShadow,项目名称:kwin,代码行数:8,代码来源:toplevel.cpp

示例3: index

bool Foam::overlapGgiPolyPatch::master() const
{
    // The first overlapggi interface is master,second one is slave
    if (angle() == shadow().angle())
    {
        return index() < shadowIndex();
    }

    // Master is the one with the larger angle
    return angle() > shadow().angle();
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:11,代码来源:overlapGgiPolyPatch.C

示例4: unoptimizedPaint

void BoxStyle::unoptimizedPaint(QPainter* painter, int xOffset, int yOffset, int contentBoxWidth,
				int contentBoxHeight) const
{
	qreal x = xOffset;
	qreal y = yOffset;

	int outlineWidth = outline_.style()!=Qt::NoPen ? outline_.width() : 0;
	// Move the figure when using antialiasing. The outline will start at a pixel boundary. This makes it sharper.
	if ( painter->testRenderHint(QPainter::Antialiasing) || painter->testRenderHint(QPainter::HighQualityAntialiasing) )
		if ( outline().style() != Qt::NoPen)
		{
			x = xOffset + outlineWidth/2.0;
			y = yOffset + outlineWidth/2.0;
		}

	// Draw shadow
	if ( shadow() != Qt::NoBrush )
	{
		painter->setPen(Qt::NoPen);
		painter->setBrush(shadow());
		painter->drawPath(getRectanglePath(xOffset + xShadowOffset(), yOffset + yShadowOffset(),
				contentBoxWidth, contentBoxHeight));
	}

	// Draw box.
	painter->setPen(outline());

	// Set the brush and fix the gradient if needed.
	if ( background().style() == Qt::LinearGradientPattern
			&& background().gradient()->coordinateMode() == QGradient::LogicalMode )
	{
		QLinearGradient g = *(static_cast<const QLinearGradient*> (background().gradient()));
		g.setStart(x + g.start().x(), y + g.start().y());
		g.setFinalStop(x + g.finalStop().x(), y + g.finalStop().y());
		painter->setBrush(g);

	}
	else if ( background().style()  == Qt::RadialGradientPattern
			&& background().gradient()->coordinateMode() == QGradient::LogicalMode )
	{
		QRadialGradient g = *(static_cast<const QRadialGradient*> (background().gradient()));
		g.setCenter(x + g.center().x(), y + g.center().y());
		g.setFocalPoint(x + g.focalPoint().x(), y + g.focalPoint().y());
		painter->setBrush(g);
	}
	else
	{
		painter->setBrush(background());
	}

	painter->drawPath(getRectanglePath(x, y, contentBoxWidth - outlineWidth, contentBoxHeight - outlineWidth));
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:52,代码来源:BoxStyle.cpp

示例5: FatalErrorIn

void Foam::overlapGgiPolyPatch::calcLocalParallel() const
{
    // Calculate patch-to-zone addressing
    if (localParallelPtr_)
    {
        FatalErrorIn("void overlapGgiPolyPatch::calcLocalParallel() const")
            << "Local parallel switch already calculated"
            << abort(FatalError);
    }

    // If running in serial, all GGIs are local parallel
    // HJ, 1/Jun/2011
    localParallelPtr_ = new bool(false);
    bool& emptyOrComplete = *localParallelPtr_;

    // If running in serial, all GGIs are expanded to zone size.
    // This happens on decomposition and reconstruction where
    // size and shadow size may be zero, but zone size may not
    // HJ, 1/Jun/2011
    if (!Pstream::parRun())
    {
        emptyOrComplete = false;
    }
    else
    {
        // Calculate localisation on master and shadow
        emptyOrComplete =
            (
                zone().size() == size()
             && shadow().zone().size() == shadow().size()
            )
         || (size() == 0 && shadow().size() == 0);

        reduce(emptyOrComplete, andOp<bool>());
    }

    if (debug && Pstream::parRun())
    {
        Info<< "Overlap GGI patch Master: " << name()
            << " Slave: " << shadowName() << " is ";

        if (emptyOrComplete)
        {
           Info<< "local parallel" << endl;
        }
        else
        {
            Info<< "split between multiple processors" << endl;
        }
    }
}
开发者ID:CFDEMproject,项目名称:OpenFOAM-1.6-ext,代码行数:51,代码来源:overlapGgiPolyPatch.C

示例6: nf

// Make patch weighting factors
void Foam::regionCoupleFvPatch::makeWeights(scalarField& w) const
{
    if (rcPolyPatch_.coupled())
    {
        if (rcPolyPatch_.master())
        {
            vectorField n = nf();

            // Note: mag in the dot-product.
            // For all valid meshes, the non-orthogonality will be less than
            // 90 deg and the dot-product will be positive.  For invalid
            // meshes (d & s <= 0), this will stabilise the calculation
            // but the result will be poor.  HJ, 24/Aug/2011
            scalarField nfc =
                mag(n & (rcPolyPatch_.reconFaceCellCentres() - Cf()));

            w = nfc/(mag(n & (Cf() - Cn())) + nfc);

            if (bridgeOverlap())
            {
                // Set overlap weights to 0.5 and use mirrored neighbour field
                // for interpolation.  HJ, 21/Jan/2009
                bridge(scalarField(size(), 0.5), w);
            }
        }
        else
        {
            // Pick up weights from the master side
            scalarField masterWeights(shadow().size());
            shadow().makeWeights(masterWeights);

            scalarField oneMinusW = 1 - masterWeights;

            w = interpolate(oneMinusW);

            if (bridgeOverlap())
            {
                // Set overlap weights to 0.5 and use mirrored neighbour field
                // for interpolation.  HJ, 21/Jan/2009
                bridge(scalarField(size(), 0.5), w);
            }
        }
    }
    else
    {
        fvPatch::makeWeights(w);
    }
}
开发者ID:CFMS,项目名称:foam-extend-foam-extend-3.2,代码行数:49,代码来源:regionCoupleFvPatch.C

示例7: Cn

// Return delta (P to N) vectors across coupled patch
Foam::tmp<Foam::vectorField> Foam::cyclicGgiFvPatch::delta() const
{
    if (cyclicGgiPolyPatch_.master())
    {
        tmp<vectorField> tDelta =
            cyclicGgiPolyPatch_.reconFaceCellCentres() - Cn();

        if (bridgeOverlap())
        {
            vectorField bridgeDeltas = Cf() - Cn();

            bridge(bridgeDeltas, tDelta());
        }

        return tDelta;
    }
    else
    {
        tmp<vectorField> tDelta = interpolate
        (
            shadow().Cn() - cyclicGgiPolyPatch_.shadow().reconFaceCellCentres()
        );

        if (bridgeOverlap())
        {
            vectorField bridgeDeltas = Cf() - Cn();

            bridge(bridgeDeltas, tDelta());
        }

        return tDelta;
    }
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-foam-extend-3.0,代码行数:34,代码来源:cyclicGgiFvPatch.C

示例8: ray_shade

Color ray_shade(int level, Real w, Ray v, RContext *rc, Object *ol)
{
  Inode *i = ray_intersect(ol, v);
  if (i != NULL) { Light *l; Real wf;
    Material *m = i->m;
    Vector3 p = ray_point(v, i->t); 
    Cone  recv = cone_make(p, i->n, PIOVER2);
    Color c = c_mult(m->c, c_scale(m->ka, ambient(rc)));
    rc->p = p;

    for (l = rc->l; l != NULL; l = l->next) 
      if ((*l->transport)(l, recv, rc) && (wf = shadow(l, p, ol)) > RAY_WF_MIN)
	c = c_add(c, c_mult(m->c,
		     c_scale(wf * m->kd * v3_dot(l->outdir,i->n), l->outcol)));

    if (level++ < MAX_RAY_LEVEL) {
      if ((wf = w * m->ks) > RAY_WF_MIN) {
	Ray r = ray_make(p, reflect_dir(v.d, i->n));
        c = c_add(c, c_mult(m->s,
		     c_scale(m->ks, ray_shade(level, wf, r, rc, ol))));
      }
      if ((wf = w * m->kt) > RAY_WF_MIN) {
	Ray t = ray_make(p, refract_dir(v.d, i->n, (i->enter)? 1/m->ir: m->ir));
	if (v3_sqrnorm(t.d) > 0) {
	  c = c_add(c, c_mult(m->s,
		       c_scale(m->kt, ray_shade(level, wf, t, rc, ol))));
	}
      }
    }
    inode_free(i); 
    return c;
  } else {
    return BG_COLOR;
  }
}
开发者ID:mattjakob,项目名称:s3d,代码行数:35,代码来源:rshade.c

示例9: borderColor

void Graphic::drawCell (int y, int x, int val) {

    sf::Color borderColor(101, 123, 131);
    sf::Color bgColor(88, 110, 117);
    sf::Color textColor(238, 232, 213);

    sf::RectangleShape square(sf::Vector2f(100, 100));

    square.setOutlineColor(borderColor);
    square.setOutlineThickness(2);
    square.setFillColor(bgColor);
    square.setPosition(x * 110 + 100 + 10, y * 110 + 10);
    this->_win->draw(square);

    // text
    std::string valStr = std::to_string(val);
    sf::Text    text(valStr, this->_font);
    sf::Text    shadow(valStr, this->_font);
    int         textX = static_cast<int>(x * 110 + 100 + 10 + 50 - text.getLocalBounds().width / 2);
    int         textY = y * 110 + 10 + 30;

    text.setCharacterSize(30);
    shadow.setCharacterSize(30);
    text.setColor(textColor);
    shadow.setColor(sf::Color(7, 54, 66));
    text.setPosition(textX, textY);
    shadow.setPosition(textX, textY + 2);
    this->_win->draw(shadow);
    this->_win->draw(text);
}
开发者ID:meriadec,项目名称:N-puzzle,代码行数:30,代码来源:Graphic.class.cpp

示例10: omp_get_wtime

Eigen::Matrix3Xd GraspSet::shadowVoxelsToPoints(const std::vector<Eigen::Vector3i>& voxels, double voxel_grid_size) const
{
  // Convert voxels back to points.
  double t0_voxels = omp_get_wtime();
  boost::mt19937 *rng = new boost::mt19937();
  rng->seed(time(NULL));
  boost::normal_distribution<> distribution(0.0, 1.0);
  boost::variate_generator<boost::mt19937, boost::normal_distribution<> > generator(*rng, distribution);

  Eigen::Matrix3Xd shadow(3, voxels.size());

  for (int i = 0; i < voxels.size(); i++)
  {
    shadow.col(i) = voxels[i].cast<double>() * voxel_grid_size + Eigen::Vector3d::Ones() * generator()
        * voxel_grid_size * 0.3;
    //    shadow.col(i) = voxels[i].cast<double>() * voxel_grid_size;
    //    shadow.col(i)(0) += generator() * voxel_grid_size * 0.3;
    //    shadow.col(i)(1) += generator() * voxel_grid_size * 0.3;
    //    shadow.col(i)(2) += generator() * voxel_grid_size * 0.3;
  }
  if (MEASURE_TIME)
    std::cout << "voxels-to-points runtime: " << omp_get_wtime() - t0_voxels << "s\n";

  return shadow;
}
开发者ID:2scholz,项目名称:gpg,代码行数:25,代码来源:grasp_set.cpp

示例11: fenster

//////////////////////////////
// Unterprogramm für Fensterdemo
void fenster(uint8_t art) {
    uint8_t x;
    uint8_t y;
    uint8_t color = art;

    winak(original);
    textbackground(WHITE);
    clrscr();

    for (y = 0; y < 4; y++) {
        for (x = 0; x < 4; x++) {
            wiinit(3 + x * 9, 1 + y * 8, 7, 6, demowin);
            textbackground(color);
            clrscr();
            if ((art & 0x01) == 0x01)
            rahm();
            if ((art & 0x02) == 0x02)
            shadow();
            /*
             //priat( 1 , 1, "Fenster 1");
             */
            color += 5;
        }
    }
    while (!kbhit())
    ;
    getch();
}
开发者ID:anchorz,项目名称:sdcc-z1013-kc85,代码行数:30,代码来源:main.c

示例12: renderPixelStandard

/* task that renders a single screen tile */
Vec3fa renderPixelStandard(float x, float y, const ISPCCamera& camera, RayStats& stats)
{
  /* initialize ray */
  Ray ray(Vec3fa(camera.xfm.p), Vec3fa(normalize(x*camera.xfm.l.vx + y*camera.xfm.l.vy + camera.xfm.l.vz)), 0.0f, inf);

  /* intersect ray with scene */
  RTCIntersectContext context;
  rtcInitIntersectContext(&context);
  rtcIntersect1(g_scene,&context,RTCRayHit_(ray));
  RayStats_addRay(stats);

  /* shade pixels */
  Vec3fa color = Vec3fa(0.0f);
  if (ray.geomID != RTC_INVALID_GEOMETRY_ID)
  {
    Vec3fa diffuse = colors[ray.geomID];
    color = color + diffuse*0.1f;
    Vec3fa lightDir = normalize(Vec3fa(-1,-1,-1));

    /* initialize shadow ray */
    Ray shadow(ray.org + ray.tfar*ray.dir, neg(lightDir), 0.001f, inf);

    /* trace shadow ray */
    rtcOccluded1(g_scene,&context,RTCRay_(shadow));
    RayStats_addShadowRay(stats);

    /* add light contribution */
    if (shadow.tfar >= 0.0f)
      color = color + diffuse*clamp(-dot(lightDir,normalize(ray.Ng)),0.0f,1.0f);
  }
  return color;
}
开发者ID:appleseedhq,项目名称:appleseed-deps,代码行数:33,代码来源:dynamic_scene_device.cpp

示例13: LogError

void TileMap::addObjectToMap(GameState &state, sp<Vehicle> vehicle)
{
	if (vehicle->tileObject)
	{
		LogError("Vehicle already has tile object");
	}
	if (vehicle->shadowObject)
	{
		LogError("Vehicle already has shadow object");
	}
	if (vehicle->crashed && vehicle->smokeDoodad)
	{
		LogError("Vehicle already has smoke object");
	}
	// FIXME: mksp<> doesn't work for private (but accessible due to friend)
	// constructors?
	sp<TileObjectVehicle> obj(new TileObjectVehicle(*this, vehicle));
	obj->setPosition(vehicle->getPosition());
	vehicle->tileObject = obj;

	if (vehicle->type->directional_shadow_sprites.size() > 0)
	{
		sp<TileObjectShadow> shadow(new TileObjectShadow(*this, vehicle));
		shadow->setPosition(vehicle->getPosition());
		vehicle->shadowObject = shadow;
	}
	if (vehicle->crashed)
	{
		sp<Doodad> smoke = mksp<Doodad>(vehicle->position + SMOKE_DOODAD_SHIFT,
		                                StateRef<DoodadType>{&state, "DOODAD_13_SMOKE_FUME"});
		addObjectToMap(smoke);
		vehicle->smokeDoodad = smoke;
	}
}
开发者ID:JonnyH,项目名称:OpenApoc,代码行数:34,代码来源:tilemap.cpp

示例14: lighting

rgb lighting(scene s, ray r, hit_test h)
{
  rgb result;
  if (h.miss)
    return s.bg;
  vec hit_position = ray_position(r, h.dist);
  if (shadow(hit_position, s.light, s.spheres)) {
    result = rgb_modulate(h.surf, s.amb);
  }
  else {  
    double dot = vec_dot(h.surf_norm, s.light.direction);
    double d = double_max(0, dot);
    rgb diffuse_light = rgb_scale(d, s.light.color);
    rgb lsum = rgb_add(s.amb, diffuse_light);
    result = rgb_modulate(h.surf, lsum);
  }
  /**** === implement specular reflection here === ****/
 
  if (rgb_nonzero(h.shine)) {
    rgb ss;
    vec N = h.surf_norm;
    vec L = s.light.direction;
    rgb S = h.shine;
    vec R = vec_sub( vec_scale(2* vec_dot(N,L),N),L);
    vec V = vec_neg(r.direction);
    if (vec_dot(N,L)>0){
      ss = rgb_scale( pow( double_max( vec_dot(R,V),0), 6), S);
      //rgb_print(k);
    }
    else
      ss = rgb_expr(0,0,0);
    return rgb_add(result,ss);
  }
  return result;
}
开发者ID:yunchenliu,项目名称:Sample_C_Code,代码行数:35,代码来源:raytracer.c

示例15: delta

void Foam::mixingPlaneFvPatch::makeDeltaCoeffs(scalarField& dc) const
{
    if (mixingPlanePolyPatch_.master())
    {
        // Stabilised form for bad meshes.  HJ, 24/Aug/2011
        vectorField d = delta();

        dc = 1.0/max(nf() & d, 0.05*mag(d));
    }
    else
    {
        scalarField masterDeltas(shadow().size());
        shadow().makeDeltaCoeffs(masterDeltas);
        dc = interpolate(masterDeltas);
    }
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-foam-extend-3.0,代码行数:16,代码来源:mixingPlaneFvPatch.C


注:本文中的shadow函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。