cesiumlab / cesiumlab/XbsjEarthUI

bug: 官方例子中CustomPrimitive不显示问题

Open
#79 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
734
Forks
193
PR merge metrics
No merged PRs in 30d

Description

官方例子--数字城市(earth-digitalCity.html)中createBasePoint方法中的效果不显示

// 底面动态辐射波
{
const evalString = `
p.canvasWidth = 512;
p.canvasHeight = 512;
setTimeout(() => {
p.drawCanvas(ctx => {
ctx.clearRect(0, 0, 512, 512);
ctx.strokeStyle = "rgb(255, 0, 0)";
ctx.setLineDash([80, 80]);
ctx.lineWidth = 30;
ctx.arc(256, 256, 241, 0, Math.PI * 2, true);
ctx.stroke();
});
}, 0)
`;
const preUpdateEvalString = `
if (typeof p.dAngle === 'undefined') p.dAngle = 0.0;
if (typeof p.dt === 'undefined') p.dt = 0.01;
p.dAngle += 10.0;
if (p.dAngle > 360.0) {
p.dAngle = 0.0;
}
p.rotation[0] = p.dAngle / 180.0 * Math.PI;
p.dt += 0.02;
if (p.dt > 1.0) p.dt = 0.01;
p.scale[0] = 50 * p.dt;
p.scale[1] = 50 * p.dt;
`;
const config = {
evalString,
preUpdateEvalString,
position: position,
scale: [50, 50, 1],
positions: [...XE.Obj.CustomPrimitive.Geometry.unitSquare.positions],
sts: [...XE.Obj.CustomPrimitive.Geometry.unitSquare.sts],
indices: [...XE.Obj.CustomPrimitive.Geometry.unitSquare.indices],
renderState: XE.Obj.CustomPrimitive.getRenderState(false, false),
color: [1, 1, 1, 1],
canvasWidth: 512,
canvasHeight: 512
};
let p = new XE.Obj.CustomPrimitive(this.earth);
p.xbsjFromJSON(config);
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Open the official Digital City example in earth-digitalCity.html and inspect createBasePoint, especially the CustomPrimitive configuration and its evalString/preUpdateEvalString callbacks. Run the example and compare the expected base dynamic radiation wave with the current rendering. Done means the effect is visible and animates as intended.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.