示例#1
0
void	FProgressive::Copy	(IRender_Visual *pSrc)
{
	Fvisual::Copy	(pSrc);
	FProgressive	*pFrom = (FProgressive *)pSrc;
	PCOPY			(nSWI);
	PCOPY			(xSWI);
}
示例#2
0
void CKinematicsAnimated::Copy(IRender_Visual *P) 
{
	inherited::Copy	(P);

	CKinematicsAnimated* pFrom = (CKinematicsAnimated*)P;
	PCOPY			(m_Motions);
    PCOPY			(m_Partition);

	IBlend_Startup			();
}
示例#3
0
文件: noise.c 项目: cciechad/brlcad
/**
 *@brief
 * A ridged noise pattern
 *
 *	From "Texturing and Modeling, A Procedural Approach" 2nd ed p338
 */
double
bn_noise_ridged(fastf_t *point, double h_val, double lacunarity, double octaves, double offset)
{
    struct fbm_spec		*ep;
    double			result, weight, signal, *spec_wgts;
    point_t			pt;
    int			i;

    /* The first order of business is to see if we have pre-computed
     * the spectral weights table for these parameters in a previous
     * invocation.  If not, the we compute them and save them for
     * possible future use
     */

    ep = find_spec_wgt(h_val, lacunarity, octaves);

    /* copy the point so we don't corrupt
     * the caller's copy of the variable
     */
    PCOPY(pt, point);
    spec_wgts = ep->spec_wgts;


    /* get first octave */
    signal = bn_noise_perlin(pt);

    /* get absolute value of signal (this creates the ridges) */
    if (signal < 0.0) signal = -signal;

    /* invert and translate (note that "offset shoudl be ~= 1.0 */
    signal = offset - signal;

    /* square the signal, to increase "sharpness" of ridges */
    signal *= signal;

    /* assign initial value */
    result = signal;
    weight = 1.0;

    for (i=1; i < octaves; i++ ) {
	PSCALE(pt, lacunarity);

	signal = bn_noise_perlin(pt);

	if (signal < 0.0) signal = - signal;
	signal = offset - signal;

	/* weight the contribution */
	signal *= weight;
	result += signal * spec_wgts[i];
    }
    return result;
}
示例#4
0
文件: noise.c 项目: cciechad/brlcad
/**
 * @brief
 * Procedural fBm evaluated at "point"; returns value stored in "value".
 *
 * @param   point		location to sample noise
 * @param   ``h_val''		fractal increment parameter
 * @param   ``lacunarity''	gap between successive frequencies
 * @param   ``octaves''  	number of frequencies in the fBm
 *
 * The spectral properties of the result are in the APPROXIMATE range [-1..1]
 * Depending upon the number of octaves computed, this range may be exceeded.
 * Applications should clamp or scale the result to their needs.
 * The results have a more-or-less gaussian distribution.  Typical
 * results for 1M samples include:
 *
 * @li  Min           -1.15246
 * @li  Max            1.23146
 * @li  Mean        -0.0138744
 * @li  s.d.          0.306642
 * @li  Var          0.0940295
 *
 * The function call pow() is relatively expensive.  Therfore, this function
 * pre-computes and saves the spectral weights in a table for re-use in
 * successive invocations.
 */
double
bn_noise_fbm(fastf_t *point, double h_val, double lacunarity, double octaves)
{
    struct fbm_spec		*ep;
    double			value, remainder, *spec_wgts;
    point_t			pt;
    int			i, oct;

    /* The first order of business is to see if we have pre-computed
     * the spectral weights table for these parameters in a previous
     * invocation.  If not, the we compute them and save them for
     * possible future use
     */

    ep = find_spec_wgt(h_val, lacunarity, octaves);

    /* now we're ready to compute the fBm value */

    value = 0.0;            /* initialize vars to proper values */
    /* copy the point so we don't corrupt the caller's version */
    PCOPY(pt, point);

    spec_wgts = ep->spec_wgts;

    /* inner loop of spectral construction */
    oct=(int)octaves; /* save repeating double->int cast */
    for (i=0; i < oct; i++) {
	value += bn_noise_perlin( pt ) * spec_wgts[i];
	PSCALE(pt, lacunarity);
    }

    remainder = octaves - (int)octaves;
    if ( remainder ) {
	/* add in ``octaves''  remainder
	 * ``i''  and spatial freq. are preset in loop above
	 */
	value += remainder * bn_noise_perlin( pt ) * spec_wgts[i];
    }

    return( value );

} /* bn_noise_fbm() */
示例#5
0
文件: noise.c 项目: cciechad/brlcad
double
bn_noise_mf(fastf_t *point, double h_val, double lacunarity, double octaves, double offset)
{
    double 			frequency = 1.0;
    struct fbm_spec		*ep;
    double			result, weight, signal, *spec_wgts;
    point_t			pt;
    int			i;

    /* The first order of business is to see if we have pre-computed
     * the spectral weights table for these parameters in a previous
     * invocation.  If not, the we compute them and save them for
     * possible future use
     */

    ep = find_spec_wgt( h_val, lacunarity, octaves );

    /* copy the point so we don't corrupt
     * the caller's copy of the variable
     */
    PCOPY( pt, point );
    spec_wgts = ep->spec_wgts;
    offset = 1.0;

    result = (bn_noise_perlin(pt) + offset) * spec_wgts[0];
    weight = result;

    for (i=1; i < octaves; i++) {
	PSCALE(pt, lacunarity);

	if (weight > 1.0) weight = 1.0;

	signal = ( bn_noise_perlin(pt) + offset ) * spec_wgts[i];

	signal += fabs(bn_noise_perlin( pt )) * pow(frequency, -h_val);
	frequency *= lacunarity;
	PSCALE(pt, lacunarity);
    }
    return result;
}
示例#6
0
void CKinematics::Copy(IRender_Visual *P) 
{
	inherited::Copy	(P);

	CKinematics* pFrom = (CKinematics*)P;
    PCOPY(pUserData	);
	PCOPY(bones		);
	PCOPY(iRoot		);
	PCOPY(bone_map_N);
	PCOPY(bone_map_P);
    PCOPY(visimask	);

	IBoneInstances_Create	();

	for (u32 i=0; i<children.size(); i++) 
		LL_GetChild(i)->SetParent(this);

	CalculateBones_Invalidate	();

    m_lod 			= (pFrom->m_lod)?::Render->model_Duplicate	(pFrom->m_lod):0;
}
void FTreeVisual_PM::Copy		(dxRender_Visual *pSrc)
{
	inherited::Copy				(pSrc);
	FTreeVisual_PM	*pFrom		= dynamic_cast<FTreeVisual_PM*> (pSrc);
	PCOPY						(pSWI);
}
void	FTreeVisual::Copy	(dxRender_Visual *pSrc)
{
	dxRender_Visual::Copy	(pSrc);

	FTreeVisual	*pFrom		= dynamic_cast<FTreeVisual*> (pSrc);

	PCOPY(rm_geom);

	PCOPY(p_rm_Vertices);	if (p_rm_Vertices) p_rm_Vertices->AddRef();

	PCOPY(vBase);
	PCOPY(vCount);

	PCOPY(p_rm_Indices);	if (p_rm_Indices) p_rm_Indices->AddRef();

	PCOPY(iBase);
	PCOPY(iCount);
	PCOPY(dwPrimitives);

	PCOPY(xform);
	PCOPY(c_scale);
	PCOPY(c_bias);
}